Remove obsolete Coolify deployment files
- Removed deploy-to-coolify.example.sh (replaced by deploy-to-apps.example.sh) - Removed COOLIFY_SETUP.md (replaced by DEPLOYMENT_GUIDE.md) - Updated .gitignore to remove deploy-to-coolify.sh reference - Updated README troubleshooting to use SAAC API instead of direct Coolify API All users now deploy via the SAAC API at apps.startanaicompany.com rather than directly to Coolify. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,6 +13,5 @@ deploy_key
|
|||||||
# Deployment keys and scripts
|
# Deployment keys and scripts
|
||||||
deploy_key*
|
deploy_key*
|
||||||
deploy.sh
|
deploy.sh
|
||||||
deploy-to-coolify.sh
|
|
||||||
deploy-to-apps.sh
|
deploy-to-apps.sh
|
||||||
deployment-info.txt
|
deployment-info.txt
|
||||||
|
|||||||
296
COOLIFY_SETUP.md
296
COOLIFY_SETUP.md
@@ -1,296 +0,0 @@
|
|||||||
# Coolify Setup Guide
|
|
||||||
|
|
||||||
This guide explains how to set up Coolify for deploying AI recruitment sites from this template.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Coolify instance (self-hosted or cloud)
|
|
||||||
- Coolify API token
|
|
||||||
- Gitea account and API token
|
|
||||||
- Cloudflare account for DNS (optional but recommended)
|
|
||||||
|
|
||||||
## One-Time Coolify Setup
|
|
||||||
|
|
||||||
These steps only need to be done once when setting up your Coolify instance for the first time.
|
|
||||||
|
|
||||||
### 1. Get Coolify API Token
|
|
||||||
|
|
||||||
1. Log in to your Coolify instance at `https://app.coolify.io` (or your self-hosted URL)
|
|
||||||
2. Go to **Settings** → **API Tokens**
|
|
||||||
3. Click **Create New Token**
|
|
||||||
4. Copy the token and save it securely
|
|
||||||
5. Export it as an environment variable:
|
|
||||||
```bash
|
|
||||||
export COOLIFY_API_TOKEN="your-token-here"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Create Coolify Project (One Time)
|
|
||||||
|
|
||||||
If this is your first deployment, create a project for all recruitment sites:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
COOLIFY_API="https://app.coolify.io/api/v1"
|
|
||||||
|
|
||||||
curl -X POST "${COOLIFY_API}/projects" \
|
|
||||||
-H "Authorization: Bearer ${COOLIFY_API_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"name": "RecruitAI",
|
|
||||||
"description": "AI Recruitment Sites from Template"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
Save the returned `uuid` - you'll need it for deployments.
|
|
||||||
|
|
||||||
### 3. Get Server and Destination UUIDs
|
|
||||||
|
|
||||||
Find your server UUID:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -s "${COOLIFY_API}/servers" \
|
|
||||||
-H "Authorization: Bearer ${COOLIFY_API_TOKEN}" | jq '.'
|
|
||||||
```
|
|
||||||
|
|
||||||
Find your destination UUID (usually "coolify" network):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -s "${COOLIFY_API}/servers/{SERVER_UUID}/destinations" \
|
|
||||||
-H "Authorization: Bearer ${COOLIFY_API_TOKEN}" | jq '.'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Update Deployment Script
|
|
||||||
|
|
||||||
Edit `deploy-to-coolify.example.sh` with your UUIDs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
COOLIFY_PROJECT_UUID="your-project-uuid"
|
|
||||||
COOLIFY_SERVER_UUID="your-server-uuid"
|
|
||||||
COOLIFY_DESTINATION_UUID="your-destination-uuid"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Per-Deployment Setup
|
|
||||||
|
|
||||||
These steps are done for each new recruitment site you deploy from the template.
|
|
||||||
|
|
||||||
### 1. Use the Template
|
|
||||||
|
|
||||||
On Gitea:
|
|
||||||
1. Go to https://git.startanaicompany.com/StartanAICompany/ai-recruit-site-template
|
|
||||||
2. Click **Use this template**
|
|
||||||
3. Name your repository (e.g., `acme-recruit-site`)
|
|
||||||
4. Create the repository
|
|
||||||
|
|
||||||
### 2. Clone and Configure
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://git.startanaicompany.com/yourusername/acme-recruit-site.git
|
|
||||||
cd acme-recruit-site
|
|
||||||
|
|
||||||
# Copy and edit environment file
|
|
||||||
cp .env.example .env
|
|
||||||
nano .env
|
|
||||||
```
|
|
||||||
|
|
||||||
Configure at minimum:
|
|
||||||
```bash
|
|
||||||
COMPANY_NAME="ACME Recruitment"
|
|
||||||
SUBDOMAIN=acme
|
|
||||||
GITEA_USERNAME=yourusername
|
|
||||||
GITEA_REPO_NAME=acme-recruit-site
|
|
||||||
CONTACT_EMAIL=info@acmerecruitment.com
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Get Gitea API Token
|
|
||||||
|
|
||||||
1. Log in to Gitea at https://git.startanaicompany.com
|
|
||||||
2. Go to **Settings** → **Applications** → **Generate New Token**
|
|
||||||
3. Name it (e.g., "Coolify Deployment")
|
|
||||||
4. Copy the token
|
|
||||||
5. Export it:
|
|
||||||
```bash
|
|
||||||
export GITEA_API_TOKEN="your-gitea-token"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Run Deployment Script
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Copy the example script
|
|
||||||
cp deploy-to-coolify.example.sh deploy-to-coolify.sh
|
|
||||||
|
|
||||||
# Make it executable
|
|
||||||
chmod +x deploy-to-coolify.sh
|
|
||||||
|
|
||||||
# Run it
|
|
||||||
./deploy-to-coolify.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
The script will:
|
|
||||||
- Create a Coolify application
|
|
||||||
- Configure the domain (subdomainrecruit.startanaicompany.com)
|
|
||||||
- Set up Traefik labels for HTTPS
|
|
||||||
- Configure webhook for automatic deployments
|
|
||||||
- Trigger initial deployment
|
|
||||||
|
|
||||||
### 5. Configure DNS
|
|
||||||
|
|
||||||
Add a CNAME record in Cloudflare (or your DNS provider):
|
|
||||||
|
|
||||||
- **Type**: CNAME
|
|
||||||
- **Name**: `acmerecruit` (or your subdomain + "recruit")
|
|
||||||
- **Target**: `app.coolify.io` (or your Coolify instance domain)
|
|
||||||
- **Proxy**: Enabled (for Cloudflare)
|
|
||||||
|
|
||||||
Wait 2-3 minutes for DNS propagation and deployment to complete.
|
|
||||||
|
|
||||||
### 6. Access Your Site
|
|
||||||
|
|
||||||
Your site will be available at:
|
|
||||||
- **Public Site**: `https://acmerecruit.startanaicompany.com`
|
|
||||||
- **Admin Panel**: `https://acmerecruit.startanaicompany.com/admin/login`
|
|
||||||
|
|
||||||
On first visit to admin, create your admin account.
|
|
||||||
|
|
||||||
## Automatic Deployments
|
|
||||||
|
|
||||||
After setup, any push to your repository's `master` branch will automatically:
|
|
||||||
1. Trigger a webhook to Coolify
|
|
||||||
2. Pull the latest code
|
|
||||||
3. Rebuild the Docker containers
|
|
||||||
4. Deploy the updated site
|
|
||||||
|
|
||||||
No manual intervention needed!
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Deployment Failed
|
|
||||||
|
|
||||||
Check Coolify logs:
|
|
||||||
1. Go to https://app.coolify.io
|
|
||||||
2. Navigate to your application
|
|
||||||
3. Click **Logs** tab
|
|
||||||
4. Look for errors
|
|
||||||
|
|
||||||
Common issues:
|
|
||||||
- **Database connection failed**: Check DB_PASSWORD in environment variables
|
|
||||||
- **Build failed**: Check Dockerfile syntax
|
|
||||||
- **Port conflict**: Ensure port 3000 is exposed
|
|
||||||
|
|
||||||
### Webhook Not Working
|
|
||||||
|
|
||||||
Verify webhook is configured:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -s "https://git.startanaicompany.com/api/v1/repos/yourusername/yourrepo/hooks" \
|
|
||||||
-H "Authorization: token ${GITEA_API_TOKEN}" | jq '.'
|
|
||||||
```
|
|
||||||
|
|
||||||
Should show a webhook with URL: `https://app.coolify.io/api/v1/deploy?uuid=...`
|
|
||||||
|
|
||||||
### DNS Not Resolving
|
|
||||||
|
|
||||||
Check DNS configuration:
|
|
||||||
```bash
|
|
||||||
dig acmerecruit.startanaicompany.com
|
|
||||||
```
|
|
||||||
|
|
||||||
Should point to your Coolify server or Cloudflare.
|
|
||||||
|
|
||||||
### Site Not Loading
|
|
||||||
|
|
||||||
1. Check deployment status in Coolify
|
|
||||||
2. Verify containers are running:
|
|
||||||
```bash
|
|
||||||
# From Coolify server
|
|
||||||
docker ps | grep acme
|
|
||||||
```
|
|
||||||
3. Check application logs in Coolify dashboard
|
|
||||||
|
|
||||||
## Environment Variables in Coolify
|
|
||||||
|
|
||||||
You can also set environment variables directly in Coolify UI:
|
|
||||||
|
|
||||||
1. Go to your application in Coolify
|
|
||||||
2. Click **Environment Variables** tab
|
|
||||||
3. Add variables (they override .env file)
|
|
||||||
|
|
||||||
Useful for:
|
|
||||||
- Secrets (DB_PASSWORD, SESSION_SECRET)
|
|
||||||
- Production-specific values
|
|
||||||
- API keys
|
|
||||||
|
|
||||||
## Security Best Practices
|
|
||||||
|
|
||||||
1. **Never commit .env files** - They're in .gitignore
|
|
||||||
2. **Use strong passwords** - Generate with `openssl rand -hex 32`
|
|
||||||
3. **Rotate tokens** - Regenerate API tokens periodically
|
|
||||||
4. **Limit access** - Only grant necessary permissions
|
|
||||||
5. **Enable HTTPS** - Always use https:// for production
|
|
||||||
6. **Monitor logs** - Check for suspicious activity
|
|
||||||
|
|
||||||
## Resource Requirements
|
|
||||||
|
|
||||||
Per deployment:
|
|
||||||
- **CPU**: 1 core minimum
|
|
||||||
- **RAM**: 512MB minimum (1GB recommended)
|
|
||||||
- **Storage**: 1GB for app + database
|
|
||||||
|
|
||||||
For multiple sites on one Coolify instance, scale accordingly.
|
|
||||||
|
|
||||||
## Scaling Multiple Sites
|
|
||||||
|
|
||||||
To deploy multiple recruitment sites:
|
|
||||||
|
|
||||||
1. Each site gets its own:
|
|
||||||
- Repository (from template)
|
|
||||||
- Coolify application
|
|
||||||
- Subdomain
|
|
||||||
- Database
|
|
||||||
|
|
||||||
2. All sites share:
|
|
||||||
- Coolify project
|
|
||||||
- Server resources
|
|
||||||
- DNS domain
|
|
||||||
|
|
||||||
3. Resource isolation:
|
|
||||||
- Each site runs in separate Docker containers
|
|
||||||
- Separate PostgreSQL instances
|
|
||||||
- Independent environment variables
|
|
||||||
|
|
||||||
## Advanced Configuration
|
|
||||||
|
|
||||||
### Custom Domain
|
|
||||||
|
|
||||||
To use a custom domain instead of subdomain:
|
|
||||||
|
|
||||||
1. In `.env`, set:
|
|
||||||
```bash
|
|
||||||
CUSTOM_DOMAIN=recruiting.yourcompany.com
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Update deployment script to use CUSTOM_DOMAIN
|
|
||||||
|
|
||||||
3. Add DNS record pointing to Coolify
|
|
||||||
|
|
||||||
### SSL Certificates
|
|
||||||
|
|
||||||
Coolify uses Let's Encrypt automatically for HTTPS.
|
|
||||||
|
|
||||||
For custom certificates:
|
|
||||||
1. Go to Coolify → Your Application → Settings
|
|
||||||
2. Upload custom SSL certificate
|
|
||||||
3. Configure certificate details
|
|
||||||
|
|
||||||
### Database Backups
|
|
||||||
|
|
||||||
Enable automatic backups in Coolify:
|
|
||||||
1. Go to your PostgreSQL service
|
|
||||||
2. Click **Backups** tab
|
|
||||||
3. Configure backup schedule
|
|
||||||
4. Set retention policy
|
|
||||||
|
|
||||||
## Support
|
|
||||||
|
|
||||||
For issues:
|
|
||||||
- **Template Issues**: https://git.startanaicompany.com/StartanAICompany/ai-recruit-site-template/issues
|
|
||||||
- **Coolify Issues**: https://coolify.io/docs or GitHub issues
|
|
||||||
- **General Help**: Check README.md in the template repository
|
|
||||||
@@ -302,12 +302,13 @@ npm start
|
|||||||
### Deployment Issues
|
### Deployment Issues
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check Coolify logs
|
# Check deployment logs via SAAC API
|
||||||
# Visit: https://app.coolify.io → Your Application → Logs
|
curl -H "X-API-Key: $SAAC_API_KEY" \
|
||||||
|
"https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID/logs?tail=100"
|
||||||
|
|
||||||
# Re-trigger deployment
|
# Re-trigger deployment
|
||||||
curl -X POST "https://app.coolify.io/api/v1/applications/YOUR_APP_UUID/restart" \
|
curl -X POST -H "X-API-Key: $SAAC_API_KEY" \
|
||||||
-H "Authorization: Bearer $COOLIFY_API_TOKEN"
|
https://apps.startanaicompany.com/api/v1/applications/YOUR_APP_UUID/deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
### Database Issues
|
### Database Issues
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"session_id": "0e856c02-31a4-4e41-927f-79c3d8e1e364",
|
|
||||||
"transcript_path": "/home/milko/.claude/projects/-home-milko-projects-ryan-airecruit-site/0e856c02-31a4-4e41-927f-79c3d8e1e364.jsonl",
|
|
||||||
"cwd": "/home/milko/projects/ryan/airecruit-site/ai-recruit-site-template",
|
|
||||||
"permission_mode": "bypassPermissions",
|
|
||||||
"hook_event_name": "UserPromptSubmit",
|
|
||||||
"prompt": "you deploy, I should not do it"
|
|
||||||
}
|
|
||||||
@@ -1,244 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# ========================================
|
|
||||||
# AI Recruitment Site - Coolify Deployment Script
|
|
||||||
# ========================================
|
|
||||||
# This script automatically deploys your customized recruitment site to Coolify
|
|
||||||
#
|
|
||||||
# IMPORTANT: Copy this file to deploy-to-coolify.sh and customize it
|
|
||||||
# DO NOT commit deploy-to-coolify.sh to git (it's in .gitignore)
|
|
||||||
#
|
|
||||||
# Prerequisites:
|
|
||||||
# 1. Set environment variables: COOLIFY_API_TOKEN and GITEA_API_TOKEN
|
|
||||||
# 2. Customize your .env file with company information
|
|
||||||
# 3. Ensure you have jq and curl installed
|
|
||||||
|
|
||||||
set -e # Exit on error
|
|
||||||
|
|
||||||
# Load environment variables from .env
|
|
||||||
if [ ! -f .env ]; then
|
|
||||||
echo "❌ Error: .env file not found. Copy .env.example to .env and customize it."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source .env
|
|
||||||
|
|
||||||
# Check required environment variables (from shell environment, not .env)
|
|
||||||
if [ -z "$COOLIFY_API_TOKEN" ]; then
|
|
||||||
echo "❌ Error: COOLIFY_API_TOKEN environment variable not set"
|
|
||||||
echo " Export it: export COOLIFY_API_TOKEN='your-token-here'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$GITEA_API_TOKEN" ]; then
|
|
||||||
echo "❌ Error: GITEA_API_TOKEN environment variable not set"
|
|
||||||
echo " Export it: export GITEA_API_TOKEN='your-token-here'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check required .env variables
|
|
||||||
if [ -z "$COMPANY_NAME" ]; then
|
|
||||||
echo "❌ Error: COMPANY_NAME not set in .env"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SUBDOMAIN" ]; then
|
|
||||||
echo "❌ Error: SUBDOMAIN not set in .env"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$GITEA_USERNAME" ]; then
|
|
||||||
echo "❌ Error: GITEA_USERNAME not set in .env"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$GITEA_REPO_NAME" ]; then
|
|
||||||
echo "❌ Error: GITEA_REPO_NAME not set in .env"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate secrets if not provided
|
|
||||||
if [ -z "$DB_PASSWORD" ]; then
|
|
||||||
DB_PASSWORD=$(openssl rand -hex 16)
|
|
||||||
echo "Generated DB_PASSWORD: $DB_PASSWORD"
|
|
||||||
echo "DB_PASSWORD=\"$DB_PASSWORD\"" >> .env
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SESSION_SECRET" ]; then
|
|
||||||
SESSION_SECRET=$(openssl rand -hex 32)
|
|
||||||
echo "Generated SESSION_SECRET: $SESSION_SECRET"
|
|
||||||
echo "SESSION_SECRET=\"$SESSION_SECRET\"" >> .env
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Coolify configuration
|
|
||||||
COOLIFY_API="https://app.coolify.io/api/v1"
|
|
||||||
COOLIFY_PROJECT_UUID="y8804s80goowsccwk8400kwo" # RecruitAI project
|
|
||||||
COOLIFY_SERVER_UUID="ngkwo8css8og0s00c4ows44o" # h001 server
|
|
||||||
COOLIFY_DESTINATION_UUID="eg0g8s04soo84ock8kw4wkgo" # coolify destination
|
|
||||||
|
|
||||||
# Repository URL
|
|
||||||
REPO_URL="https://git.startanaicompany.com/${GITEA_USERNAME}/${GITEA_REPO_NAME}.git"
|
|
||||||
|
|
||||||
# Domain (e.g., annarecruit.startanaicompany.com or johnrecruit.startanaicompany.com)
|
|
||||||
FULL_DOMAIN="${SUBDOMAIN}recruit.startanaicompany.com"
|
|
||||||
|
|
||||||
echo "========================================="
|
|
||||||
echo " AI Recruitment Site Deployment"
|
|
||||||
echo "========================================="
|
|
||||||
echo "📦 Configuration:"
|
|
||||||
echo " Company: $COMPANY_NAME"
|
|
||||||
echo " Repository: $REPO_URL"
|
|
||||||
echo " Domain: https://$FULL_DOMAIN"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Create Coolify application
|
|
||||||
echo "📝 Creating Coolify application..."
|
|
||||||
APP_RESPONSE=$(curl -s -X POST "${COOLIFY_API}/applications" \
|
|
||||||
-H "Authorization: Bearer ${COOLIFY_API_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{
|
|
||||||
\"project_uuid\": \"${COOLIFY_PROJECT_UUID}\",
|
|
||||||
\"server_uuid\": \"${COOLIFY_SERVER_UUID}\",
|
|
||||||
\"environment_name\": \"production\",
|
|
||||||
\"destination_uuid\": \"${COOLIFY_DESTINATION_UUID}\",
|
|
||||||
\"git_repository\": \"${REPO_URL}\",
|
|
||||||
\"git_branch\": \"master\",
|
|
||||||
\"build_pack\": \"dockercompose\",
|
|
||||||
\"docker_compose_location\": \"/docker-compose.yml\",
|
|
||||||
\"name\": \"${SUBDOMAIN}-recruit\",
|
|
||||||
\"ports_exposes\": \"3000\"
|
|
||||||
}")
|
|
||||||
|
|
||||||
APP_UUID=$(echo "$APP_RESPONSE" | jq -r '.uuid')
|
|
||||||
|
|
||||||
if [ "$APP_UUID" == "null" ] || [ -z "$APP_UUID" ]; then
|
|
||||||
echo "❌ Failed to create application"
|
|
||||||
echo "$APP_RESPONSE" | jq '.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✅ Application created: $APP_UUID"
|
|
||||||
echo " Save this UUID for future reference!"
|
|
||||||
|
|
||||||
# Configure domain
|
|
||||||
echo "🌐 Configuring domain..."
|
|
||||||
curl -s -X PATCH "${COOLIFY_API}/applications/${APP_UUID}" \
|
|
||||||
-H "Authorization: Bearer ${COOLIFY_API_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{
|
|
||||||
\"docker_compose_domains\": {
|
|
||||||
\"app\": {
|
|
||||||
\"domain\": \"https://${FULL_DOMAIN}\"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}" > /dev/null
|
|
||||||
|
|
||||||
echo "✅ Domain configured: https://$FULL_DOMAIN"
|
|
||||||
|
|
||||||
# Configure custom labels for Traefik
|
|
||||||
echo "🏷️ Configuring Traefik labels..."
|
|
||||||
LABELS=$(cat <<LABELS_EOF
|
|
||||||
traefik.enable=true
|
|
||||||
traefik.http.middlewares.gzip.compress=true
|
|
||||||
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
|
|
||||||
traefik.http.services.https-0-${APP_UUID}-app.loadbalancer.server.port=3000
|
|
||||||
LABELS_EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
LABELS_BASE64=$(echo "$LABELS" | base64 -w 0)
|
|
||||||
|
|
||||||
curl -s -X PATCH "${COOLIFY_API}/applications/${APP_UUID}" \
|
|
||||||
-H "Authorization: Bearer ${COOLIFY_API_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{
|
|
||||||
\"custom_labels\": \"${LABELS_BASE64}\"
|
|
||||||
}" > /dev/null
|
|
||||||
|
|
||||||
echo "✅ Traefik labels configured"
|
|
||||||
|
|
||||||
# Configure webhook for automatic deployments
|
|
||||||
echo "🪝 Setting up deployment webhook..."
|
|
||||||
|
|
||||||
# Coolify webhook URL uses the /deploy endpoint
|
|
||||||
WEBHOOK_URL="${COOLIFY_API}/deploy?uuid=${APP_UUID}"
|
|
||||||
|
|
||||||
# Create webhook in Gitea
|
|
||||||
GITEA_API="https://git.startanaicompany.com/api/v1"
|
|
||||||
WEBHOOK_RESPONSE=$(curl -s -X POST "${GITEA_API}/repos/${GITEA_USERNAME}/${GITEA_REPO_NAME}/hooks" \
|
|
||||||
-H "Authorization: token ${GITEA_API_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{
|
|
||||||
\"type\": \"gitea\",
|
|
||||||
\"config\": {
|
|
||||||
\"url\": \"${WEBHOOK_URL}\",
|
|
||||||
\"content_type\": \"json\",
|
|
||||||
\"http_method\": \"GET\"
|
|
||||||
},
|
|
||||||
\"events\": [\"push\"],
|
|
||||||
\"authorization_header\": \"Bearer ${COOLIFY_API_TOKEN}\",
|
|
||||||
\"active\": true
|
|
||||||
}")
|
|
||||||
|
|
||||||
WEBHOOK_ID=$(echo "$WEBHOOK_RESPONSE" | jq -r '.id')
|
|
||||||
|
|
||||||
if [ "$WEBHOOK_ID" == "null" ] || [ -z "$WEBHOOK_ID" ]; then
|
|
||||||
echo "⚠️ Warning: Failed to create Gitea webhook (may already exist)"
|
|
||||||
else
|
|
||||||
echo "✅ Webhook configured for automatic deployments"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure DNS with Cloudflare
|
|
||||||
echo "🌍 Configuring DNS (Cloudflare)..."
|
|
||||||
echo " Manual step required:"
|
|
||||||
echo " 1. Go to Cloudflare DNS settings for startanaicompany.com"
|
|
||||||
echo " 2. Add CNAME record: ${SUBDOMAIN}.recruitai -> app.coolify.io"
|
|
||||||
echo " 3. Set Proxy status to 'Proxied'"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Trigger initial deployment
|
|
||||||
echo "🚀 Triggering initial deployment..."
|
|
||||||
curl -s -X POST "${COOLIFY_API}/applications/${APP_UUID}/restart" \
|
|
||||||
-H "Authorization: Bearer ${COOLIFY_API_TOKEN}" > /dev/null
|
|
||||||
|
|
||||||
echo "✅ Deployment triggered"
|
|
||||||
echo ""
|
|
||||||
echo "========================================="
|
|
||||||
echo " Deployment Complete!"
|
|
||||||
echo "========================================="
|
|
||||||
echo ""
|
|
||||||
echo "📋 Deployment Details:"
|
|
||||||
echo " Application UUID: $APP_UUID"
|
|
||||||
echo " Domain: https://$FULL_DOMAIN"
|
|
||||||
echo ""
|
|
||||||
echo "⏳ Your site will be available in 2-3 minutes at:"
|
|
||||||
echo " https://$FULL_DOMAIN"
|
|
||||||
echo ""
|
|
||||||
echo "📝 Next Steps:"
|
|
||||||
echo " 1. Configure Cloudflare DNS (see above)"
|
|
||||||
echo " 2. Wait 2-3 minutes for deployment to complete"
|
|
||||||
echo " 3. Visit https://$FULL_DOMAIN"
|
|
||||||
echo " 4. Create your first admin account via the login page"
|
|
||||||
echo ""
|
|
||||||
echo "🔍 Monitor deployment:"
|
|
||||||
echo " Coolify Dashboard: https://app.coolify.io"
|
|
||||||
echo " Application: https://app.coolify.io/project/${COOLIFY_PROJECT_UUID}/${COOLIFY_SERVER_UUID}/application/${APP_UUID}"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Save deployment info
|
|
||||||
cat > deployment-info.txt <<DEPLOYMENT_INFO
|
|
||||||
Deployment Information
|
|
||||||
======================
|
|
||||||
Date: $(date)
|
|
||||||
Company: $COMPANY_NAME
|
|
||||||
Domain: https://$FULL_DOMAIN
|
|
||||||
Application UUID: $APP_UUID
|
|
||||||
Repository: $REPO_URL
|
|
||||||
|
|
||||||
Database Password: $DB_PASSWORD
|
|
||||||
Session Secret: $SESSION_SECRET
|
|
||||||
|
|
||||||
Coolify Dashboard: https://app.coolify.io/project/${COOLIFY_PROJECT_UUID}/${COOLIFY_SERVER_UUID}/application/${APP_UUID}
|
|
||||||
DEPLOYMENT_INFO
|
|
||||||
|
|
||||||
echo "💾 Deployment information saved to deployment-info.txt"
|
|
||||||
echo " ⚠️ Keep this file secure - it contains sensitive information!"
|
|
||||||
Reference in New Issue
Block a user