diff --git a/DEPLOYMENT_GUIDE.md b/DEPLOYMENT_GUIDE.md index 61f4a21..f18eeff 100644 --- a/DEPLOYMENT_GUIDE.md +++ b/DEPLOYMENT_GUIDE.md @@ -1,10 +1,10 @@ -# Deployment Guide - Using Wrapper API +# Deployment Guide - Using SAAC API -This guide explains how to deploy your recruitment site using the Coolify Wrapper API at `apps.startanaicompany.com`. +This guide explains how to deploy your recruitment site using the Coolify SAAC API at `apps.startanaicompany.com`. -## What is the Wrapper API? +## What is the SAAC API? -The Wrapper API is a secure gateway that allows you to deploy applications to our Coolify infrastructure without needing direct access to Coolify. Each user gets their own API key and can only manage their own applications. +The SAAC API is a secure gateway that allows you to deploy applications to our Coolify infrastructure without needing direct access to Coolify. Each user gets their own API key and can only manage their own applications. **Benefits:** - ✅ No need for master Coolify credentials @@ -42,12 +42,12 @@ curl -X POST https://apps.startanaicompany.com/api/v1/register \ **Save it to your environment:** ```bash -export WRAPPER_API_KEY="cw_abc123xyz789..." +export SAAC_API_KEY="cw_abc123xyz789..." # Add to your shell profile for persistence -echo 'export WRAPPER_API_KEY="cw_abc123xyz789..."' >> ~/.bashrc +echo 'export SAAC_API_KEY="cw_abc123xyz789..."' >> ~/.bashrc # or for zsh: -echo 'export WRAPPER_API_KEY="cw_abc123xyz789..."' >> ~/.zshrc +echo 'export SAAC_API_KEY="cw_abc123xyz789..."' >> ~/.zshrc ``` ### Step 2: Customize Your Site @@ -107,21 +107,21 @@ The script will: ### List Your Applications ```bash -curl -H "X-API-Key: $WRAPPER_API_KEY" \ +curl -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications ``` ### View Application Details ```bash -curl -H "X-API-Key: $WRAPPER_API_KEY" \ +curl -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID ``` ### View Deployment Logs ```bash -curl -H "X-API-Key: $WRAPPER_API_KEY" \ +curl -H "X-API-Key: $SAAC_API_KEY" \ "https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID/logs?tail=100" ``` @@ -129,7 +129,7 @@ curl -H "X-API-Key: $WRAPPER_API_KEY" \ ```bash curl -X POST \ - -H "X-API-Key: $WRAPPER_API_KEY" \ + -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID/deploy ``` @@ -137,7 +137,7 @@ curl -X POST \ ```bash curl -X PATCH \ - -H "X-API-Key: $WRAPPER_API_KEY" \ + -H "X-API-Key: $SAAC_API_KEY" \ -H "Content-Type: application/json" \ https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID/env \ -d '{ @@ -151,7 +151,7 @@ curl -X PATCH \ After updating env vars, redeploy: ```bash curl -X POST \ - -H "X-API-Key: $WRAPPER_API_KEY" \ + -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID/deploy ``` @@ -159,7 +159,7 @@ curl -X POST \ ```bash curl -X DELETE \ - -H "X-API-Key: $WRAPPER_API_KEY" \ + -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID ``` @@ -168,9 +168,9 @@ curl -X DELETE \ ## Automatic Deployments Once deployed, every push to your repository's `master` branch will automatically: -1. Trigger webhook to Wrapper API -2. Wrapper authenticates with your API key -3. Wrapper tells Coolify to redeploy +1. Trigger webhook to SAAC API +2. SAAC authenticates with your API key +3. SAAC deploys your updated code 4. Your site updates in 2-3 minutes **No manual intervention needed!** @@ -194,13 +194,13 @@ DNS propagation takes 2-5 minutes. Make sure you've exported your API key: ```bash -echo $WRAPPER_API_KEY +echo $SAAC_API_KEY # Should show: cw_abc123xyz... ``` If empty, export it again: ```bash -export WRAPPER_API_KEY="your_api_key_here" +export SAAC_API_KEY="your_api_key_here" ``` ### "Application limit reached" Error @@ -208,11 +208,11 @@ export WRAPPER_API_KEY="your_api_key_here" You've hit your quota (default: 50 apps). Delete unused apps: ```bash # List your apps -curl -H "X-API-Key: $WRAPPER_API_KEY" \ +curl -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications # Delete an app -curl -X DELETE -H "X-API-Key: $WRAPPER_API_KEY" \ +curl -X DELETE -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications/APP_UUID ``` @@ -227,7 +227,7 @@ You're making too many requests. Wait and try again: Check logs for specific errors: ```bash -curl -H "X-API-Key: $WRAPPER_API_KEY" \ +curl -H "X-API-Key: $SAAC_API_KEY" \ "https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID/logs?tail=200" ``` @@ -240,7 +240,7 @@ Common issues: 1. **Check deployment status**: ```bash - curl -H "X-API-Key: $WRAPPER_API_KEY" \ + curl -H "X-API-Key: $SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID ``` @@ -259,7 +259,7 @@ Common issues: If you lost your API key, regenerate it: ```bash curl -X POST \ - -H "X-API-Key: $OLD_WRAPPER_API_KEY" \ + -H "X-API-Key: $OLD_SAAC_API_KEY" \ https://apps.startanaicompany.com/api/v1/users/regenerate-key ``` @@ -277,10 +277,10 @@ If you can't access the old key, contact support. 2. **Use environment variables** ```bash # Good - export WRAPPER_API_KEY="cw_..." + export SAAC_API_KEY="cw_..." # Bad - don't hardcode in scripts - WRAPPER_API_KEY="cw_..." ./deploy.sh + SAAC_API_KEY="cw_..." ./deploy.sh ``` 3. **Rotate keys periodically** @@ -316,11 +316,11 @@ If you hit a rate limit, wait for the reset time before retrying. **Documentation:** - Template README: [README.md](README.md) -- Wrapper API docs: Coming soon +- SAAC API docs: Coming soon **Issues:** - Template issues: https://git.startanaicompany.com/StartanAICompany/ai-recruit-site-template/issues -- Wrapper issues: https://git.startanaicompany.com/mikael.westoo/coolifywrapper/issues +- SAAC API issues: https://git.startanaicompany.com/mikael.westoo/coolifywrapper/issues **Contact:** - Email: info@startanaicompany.com diff --git a/README.md b/README.md index 6c26916..f846024 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ This repository is marked as a template. You can create your own recruitment sit ### Prerequisites - Gitea account at git.startanaicompany.com -- Wrapper API key (get from apps.startanaicompany.com) +- SAAC API key (get from apps.startanaicompany.com) - Basic command line knowledge **📖 Detailed Guide:** See [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md) for complete instructions. @@ -101,7 +101,7 @@ curl -X POST https://apps.startanaicompany.com/api/v1/register \ Save the returned API key: ```bash -export WRAPPER_API_KEY="cw_your_api_key_here" +export SAAC_API_KEY="cw_your_api_key_here" ``` ### Step 4: Deploy @@ -114,7 +114,7 @@ chmod +x deploy-to-apps.sh ``` The script will: -- Create a Coolify application via Wrapper API +- Create application on StartAnAiCompany infrastructure - Configure domain (yournamerecruit.startanaicompany.com) - Set up webhooks for automatic deployments - Trigger initial deployment diff --git a/deploy-to-apps.example.sh b/deploy-to-apps.example.sh index d810b5c..69bcae2 100644 --- a/deploy-to-apps.example.sh +++ b/deploy-to-apps.example.sh @@ -1,17 +1,17 @@ #!/bin/bash # ======================================== -# AI Recruitment Site - Wrapper API Deployment Script +# AI Recruitment Site - SAAC Deployment Script # ======================================== -# This script deploys your recruitment site via the Coolify Wrapper API -# at apps.startanaicompany.com +# This script deploys your recruitment site to StartAnAiCompany infrastructure +# via apps.startanaicompany.com # # IMPORTANT: Copy this file to deploy-to-apps.sh and customize it # DO NOT commit deploy-to-apps.sh to git (it's in .gitignore) # # Prerequisites: # 1. Register for API key at: https://apps.startanaicompany.com/api/v1/register -# 2. Set WRAPPER_API_KEY environment variable +# 2. Set SAAC_API_KEY environment variable # 3. Set GITEA_API_TOKEN environment variable (optional, for webhooks) # 4. Customize your .env file with company information @@ -26,8 +26,8 @@ fi source .env # Check required environment variables -if [ -z "$WRAPPER_API_KEY" ]; then - echo "❌ Error: WRAPPER_API_KEY environment variable not set" +if [ -z "$SAAC_API_KEY" ]; then + echo "❌ Error: SAAC_API_KEY environment variable not set" echo "" echo "To get your API key:" echo "1. Register at: curl -X POST https://apps.startanaicompany.com/api/v1/register \\" @@ -35,7 +35,7 @@ if [ -z "$WRAPPER_API_KEY" ]; then echo " -d '{\"email\":\"your@email.com\",\"gitea_username\":\"${GITEA_USERNAME}\"}'" echo "" echo "2. Save the returned API key" - echo "3. Export it: export WRAPPER_API_KEY='your_api_key_here'" + echo "3. Export it: export SAAC_API_KEY='your_api_key_here'" echo "" exit 1 fi @@ -61,8 +61,8 @@ if [ -z "$GITEA_REPO_NAME" ]; then exit 1 fi -# Wrapper API configuration -WRAPPER_API="https://apps.startanaicompany.com/api/v1" +# SAAC API configuration +SAAC_API="https://apps.startanaicompany.com/api/v1" # Repository URL (HTTPS for Coolify to clone) REPO_URL="https://git.startanaicompany.com/${GITEA_USERNAME}/${GITEA_REPO_NAME}.git" @@ -79,10 +79,10 @@ echo " Repository: $REPO_URL" echo " Domain: https://$FULL_DOMAIN" echo "" -# Create Coolify application via wrapper API -echo "📝 Creating application via Wrapper API..." -APP_RESPONSE=$(curl -s -X POST "${WRAPPER_API}/applications" \ - -H "X-API-Key: ${WRAPPER_API_KEY}" \ +# Create application via SAAC API +echo "📝 Creating application on StartAnAiCompany server..." +APP_RESPONSE=$(curl -s -X POST "${SAAC_API}/applications" \ + -H "X-API-Key: ${SAAC_API_KEY}" \ -H "Content-Type: application/json" \ -d "{ \"name\": \"${SUBDOMAIN}-recruit\", @@ -148,7 +148,7 @@ else \"http_method\": \"GET\" }, \"events\": [\"push\"], - \"authorization_header\": \"Bearer ${WRAPPER_API_KEY}\", + \"authorization_header\": \"Bearer ${SAAC_API_KEY}\", \"active\": true }") @@ -190,12 +190,12 @@ echo " ${DOMAIN}/admin/login" echo "" echo "🔍 Monitor deployment:" echo " View logs:" -echo " curl -H \"X-API-Key: \$WRAPPER_API_KEY\" \\" -echo " ${WRAPPER_API}/applications/${APP_UUID}/logs" +echo " curl -H \"X-API-Key: \$SAAC_API_KEY\" \\" +echo " ${SAAC_API}/applications/${APP_UUID}/logs" echo "" echo " List your applications:" -echo " curl -H \"X-API-Key: \$WRAPPER_API_KEY\" \\" -echo " ${WRAPPER_API}/applications" +echo " curl -H \"X-API-Key: \$SAAC_API_KEY\" \\" +echo " ${SAAC_API}/applications" echo "" # Save deployment info @@ -208,14 +208,14 @@ Domain: $DOMAIN Application UUID: $APP_UUID Repository: $REPO_URL -Wrapper API: ${WRAPPER_API} -Your API Key: ${WRAPPER_API_KEY} +SAAC API: ${SAAC_API} +Your API Key: ${SAAC_API_KEY} Monitor deployment: - curl -H "X-API-Key: \$WRAPPER_API_KEY" ${WRAPPER_API}/applications/${APP_UUID}/logs + curl -H "X-API-Key: \$SAAC_API_KEY" ${SAAC_API}/applications/${APP_UUID}/logs Trigger manual deployment: - curl -X POST -H "X-API-Key: \$WRAPPER_API_KEY" ${WRAPPER_API}/applications/${APP_UUID}/deploy + curl -X POST -H "X-API-Key: \$SAAC_API_KEY" ${SAAC_API}/applications/${APP_UUID}/deploy DEPLOYMENT_INFO echo "💾 Deployment information saved to deployment-info.txt"