Commit Graph

35 Commits

Author SHA1 Message Date
d28fb10360 Implement enhanced deployment script with auto-detection
Major Enhancement: Smart deployment with setup/update modes

Features Added:
==============

1. **Auto-Detection Mode** (default)
   - Checks for .deployment-uuid file
   - First run → Setup mode (creates new deployment)
   - Subsequent runs → Update mode (updates existing)
   - No flags needed for common workflows

2. **Three Operation Modes:**

   A. Setup Mode (--setup or auto if no UUID)
      - Creates NEW application via POST /api/v1/applications
      - Saves UUID to .deployment-uuid file (git-ignored)
      - Sets up Gitea webhook (one-time)
      - Warns if UUID file already exists

   B. Update Mode (--update or auto if UUID exists)
      - Reads UUID from .deployment-uuid
      - Verifies application exists: GET /api/v1/applications/:uuid
      - Updates env vars: PATCH /api/v1/applications/:uuid/env
      - Triggers redeploy: POST /api/v1/applications/:uuid/deploy
      - GITEA_API_TOKEN not required (webhook already configured)

   C. Status Mode (--status)
      - Fetches current deployment details
      - Shows application info, status, domain
      - Provides monitoring commands

3. **UUID Persistence**
   - .deployment-uuid file stores application UUID
   - Enables stateful deployments
   - Prevents duplicate application creation
   - Git-ignored for security

4. **Improved User Experience**
   - Clear mode indication (SETUP/UPDATE/STATUS)
   - Verification step before overwriting existing deployment
   - Comprehensive error messages with actionable steps
   - Updated deployment-info.txt with mode information
   - Smart dependency checks (GITEA_TOKEN only for setup)

5. **Updated .gitignore**
   - Added .deployment-uuid to prevent accidental commits

Usage Examples:
===============

# First deployment (auto-detects no UUID → setup)
./deploy-to-apps.sh
→ Creates application, saves UUID, sets up webhook

# Update after changing .env (auto-detects UUID → update)
./deploy-to-apps.sh
→ Updates env vars, triggers redeployment

# Force new deployment
./deploy-to-apps.sh --setup

# Check status
./deploy-to-apps.sh --status

Benefits:
=========
 Idempotent - Can run multiple times safely
 Stateful - Remembers previous deployments
 User-friendly - Automatic mode detection
 Safe - Prevents duplicate applications
 Flexible - Supports multiple scenarios
 Clear feedback - Shows exactly what's happening

Files Modified:
===============
- deploy-to-apps.example.sh: Complete rewrite with 3 modes
- .gitignore: Added .deployment-uuid
- DEPLOYMENT_SCRIPT_PROPOSAL.md: Full design document

Migration for Existing Users:
==============================
If you already deployed with the old script:
1. Find your UUID: curl -H "X-API-Key: $SAAC_API_KEY" $SAAC_API/applications
2. Save it: echo "your-uuid" > .deployment-uuid
3. Run updates: ./deploy-to-apps.sh

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 17:42:08 +01:00
2f0e1b19bb Fix deployment script to match Coolify Wrapper API requirements
Changes:
1. Repository URL format: HTTPS → SSH
   - Changed from: https://git.startanaicompany.com/user/repo.git
   - Changed to: git@git.startanaicompany.com:user/repo.git
   - Reason: Coolify requires SSH format for private repo deployments

2. API field name: git_token → gitea_api_token
   - Changed from: "git_token": "${GITEA_API_TOKEN}"
   - Changed to: "gitea_api_token": "${GITEA_API_TOKEN}"
   - Reason: Match Coolify Wrapper API specification

These changes ensure the deployment script works with the Coolify
Wrapper API at apps.startanaicompany.com

The wrapper will now:
- Accept the SSH Git URL format
- Properly receive the Gitea API token
- Set up deploy keys and webhooks automatically
2026-01-24 17:26:43 +01:00
bcc07b33fc Add GITEA_API_TOKEN to deployment API for private repo access
SAAC API now receives user's GITEA_API_TOKEN to enable Coolify to clone private repositories.

Changes:
- Added early validation of GITEA_API_TOKEN (before app creation)
- Pass git_token parameter to SAAC API in application creation request
- Removed duplicate GITEA_API_TOKEN check in webhook section
- Updated error message to explain both use cases (cloning + webhooks)

The SAAC API will use this token to configure Coolify with authenticated git access:
https://${GITEA_API_TOKEN}@git.startanaicompany.com/${user}/${repo}.git

This enables automatic deployments for private repositories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:59:10 +01:00
09c198490d Make GITEA_API_TOKEN required for automatic deployments
Automatic deployments are essential for the template, so GITEA_API_TOKEN is now required.

Changes:
- .env.example: Marked both API keys as REQUIRED
- deploy-to-apps.example.sh: Script now exits with error if GITEA_API_TOKEN not set
- Added clear instructions on how to get Gitea API token

Without webhooks, users would need to manually trigger deployments after every push,
which defeats the purpose of automated infrastructure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:40:50 +01:00
6cd928d983 Add GITEA_API_TOKEN documentation to .env.example
Users need GITEA_API_TOKEN for automatic webhook setup during deployment.
Marked as optional with clear instructions on where to get it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:38:16 +01:00
672226ca49 Remove internal infrastructure references from user documentation
- Removed SAAC API repository link (internal implementation detail)
- Changed DNS target from app.coolify.io to apps.startanaicompany.com
- Updated .env.example to only reference SAAC_API_KEY (not internal tokens)
- Simplified support section to only show template issues

Users should only interact with the SAAC API as a service, not see internal implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:34:55 +01:00
6fc5a1d1e8 Add cc/ directory to gitignore
Claude Code results directory should not be committed to the repository.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:28:58 +01:00
3127459cea Remove all Coolify branding, replace with StartAnAiCompany
Users should see this as the "StartAnAiCompany platform" not as a Coolify proxy.

Changes:
- README.md: "StartAnAiCompany infrastructure" and "StartAnAiCompany platform"
- DEPLOYMENT_GUIDE.md: Removed all Coolify references
- deploy-to-apps.example.sh: "deployment platform" instead of "Coolify"

Now all user-facing documentation uses StartAnAiCompany/SAAC branding exclusively.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:27:56 +01:00
1772b3ad77 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>
2026-01-24 08:25:35 +01:00
f5e0050465 Rebrand from Wrapper API to SAAC API
Changed all references from "Coolify Wrapper" / "WRAPPER_API_KEY" to
"SAAC" / "SAAC_API_KEY" for better branding and user experience.

SAAC = StartAnAiCompany - makes it clear users are deploying to
StartAnAiCompany infrastructure rather than a "wrapper" service.

Changes:
- WRAPPER_API_KEY → SAAC_API_KEY throughout
- "Wrapper API" → "SAAC API" in all documentation
- Updated user-facing messages to reference StartAnAiCompany

This makes the service feel more direct and brand-focused rather
than like a proxy/wrapper layer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:14:34 +01:00
338d4243bb Add Coolify Wrapper API integration
This enables deployment via apps.startanaicompany.com instead of direct Coolify access.

New files:
- deploy-to-apps.example.sh: Deployment script using Wrapper API
- DEPLOYMENT_GUIDE.md: Comprehensive deployment documentation

Updated files:
- README.md: Updated deployment steps to use Wrapper API
- .gitignore: Added deploy-to-apps.sh to exclusions

Benefits:
- Users no longer need master Coolify token
- Each user gets their own API key
- Automatic resource isolation
- Rate limiting and audit logging
- Simpler deployment process

The old deploy-to-coolify.example.sh remains for reference but new
deployments should use the wrapper API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 08:08:11 +01:00
547948c98c Fix domain format to match desired pattern
Changed from double subdomain format (anna.recruitai.startanaicompany.com)
to single concatenated format (annarecruit.startanaicompany.com).

Changes:
- deploy-to-coolify.example.sh: Updated FULL_DOMAIN to ${SUBDOMAIN}recruit.startanaicompany.com
- .env.example: Updated comment to show correct example (annarecruit.startanaicompany.com)
- README.md: Updated domain examples to use correct format
- COOLIFY_SETUP.md: Updated all DNS and domain examples to use correct format

This ensures deployments generate domains like:
- annarecruit.startanaicompany.com (when SUBDOMAIN=anna)
- johnrecruit.startanaicompany.com (when SUBDOMAIN=john)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 07:27:37 +01:00
ff17d580ed Add comprehensive Coolify setup documentation
Created COOLIFY_SETUP.md with complete instructions for:
- One-time Coolify instance setup (API tokens, projects, UUIDs)
- Per-deployment setup for each recruitment site
- DNS configuration with Cloudflare
- Webhook configuration for automatic deployments
- Troubleshooting common issues
- Security best practices
- Scaling multiple sites
- Advanced configuration options

Updated README.md to reference the new setup guide.

This provides all the information users need to set up their own
Coolify instance and deploy multiple recruitment sites from the template.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 07:19:46 +01:00
5aeee20888 Remove deployment-specific files from template
Removed files containing deployment-specific information:
- DEPLOYMENT_STATUS.md (contained UUIDs, IPs, specific deployment details)
- DEPLOYMENT_GUIDE.md (old deployment guide)
- .webhook-test (test file)

These files are not relevant for template users.
All configuration is now handled via .env.example and README.md.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 23:44:12 +01:00
fc0309787a Fix webhook configuration for automatic deployments
Updated webhook to use correct Coolify API endpoint:
- Changed from /webhooks/source/gitea/events/manual/{uuid} to /api/v1/deploy?uuid={uuid}
- Added Bearer token authorization header to webhook
- Removed unnecessary webhook secret generation
- Uses GET request to /deploy endpoint as per Coolify API docs

This fix enables automatic deployments when pushing to repository.

Reference: https://coolify.io/docs/api-reference/api/operations/deploy-by-tag-or-uuid

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 23:37:53 +01:00
463ff25475 Test webhook autodeploy
Testing the updated webhook configuration with correct Coolify API endpoint.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 23:36:18 +01:00
7cbe3de772 Update README for template usage
Completely rewrote README to focus on template functionality:
- Clear "Use This Template" instructions
- Quick 3-step deployment guide
- Comprehensive customization guide
- AI agent modification documentation
- Environment variables reference table
- Troubleshooting section
- First-time setup instructions

Removed old deployment-specific content and replaced with
template-focused documentation for 10,000+ users to fork and customize.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 23:30:31 +01:00
7347586407 Add automated deployment script template
Created deploy-to-coolify.example.sh script that:
- Reads configuration from .env file
- Creates Coolify application via API
- Configures domain and Traefik labels
- Sets up GitHub webhook for automatic deployments
- Generates deployment secrets automatically
- Provides step-by-step deployment feedback

Updated .gitignore to exclude:
- deploy-to-coolify.sh (customized copy)
- deployment-info.txt (contains secrets)

Users copy the example script and customize for their deployment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 23:28:58 +01:00
9a97a575c6 Add dynamic configuration to all HTML pages
Added init.js script and data attributes to all HTML files:
- All pages now load company configuration dynamically
- Added data-company-name attributes for company name elements
- Title tags will be updated by init.js at runtime
- Enables full customization without editing HTML files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 23:27:36 +01:00
ac21e428a5 Convert to template with dynamic configuration
Add comprehensive environment-based configuration system:
- Created config.js module to centralize all environment variables
- Updated server.js to use config module for all settings
- Added /api/config endpoint to expose company info to frontend
- Created init.js to dynamically inject config into HTML pages
- Updated .env.example with comprehensive configuration options
- Added data attributes to index.html for dynamic content
- Updated Dockerfile to include config.js

This allows users to customize:
- Company name, tagline, and description
- Branding colors (primary, accent, dark)
- Contact information (email, phone, address, hours)
- Social media links
- About page content
- Services offered

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 23:26:57 +01:00
d6523bc4b1 Remove deprecated docker-compose.coolify.yml
Coolify uses docker-compose.yml directly, so the .coolify.yml variant
is redundant and causes confusion. Only docker-compose.yml is needed.
2026-01-23 23:05:11 +01:00
61269bb9a4 Remove .html extensions from all links and URLs
- Updated all navigation links in HTML files
- Updated all hrefs and window.location redirects in JavaScript
- All links now use clean URLs without .html extensions
- Improves SEO and provides cleaner user experience
2026-01-23 22:40:26 +01:00
2d6b2eece2 Update README - repository moved to StartanAICompany org 2026-01-23 22:36:02 +01:00
6c7e6fb845 Remove obsolete deployment files - Coolify handles deployment
- Removed deploy.sh (manual deployment script not needed)
- Removed deploy_key.pub (SSH keys managed by Coolify)
- Added deploy files to .gitignore for security
- Deployment now handled via Coolify webhooks
2026-01-23 22:27:31 +01:00
14a5b50fa8 Fix admin login - accept both fullName and full-name form fields
Form sends 'full-name' but server expected 'fullName'.
Now accepts both formats for compatibility.
2026-01-23 22:22:23 +01:00
dc2fd61856 Test webhook auto-deployment with UUID 2026-01-23 22:18:51 +01:00
d5bba2c0fd Update deployment status - fully operational
- All migrations running successfully
- Database initialized with sample data
- Webhook configured with secret for auto-deployment
- Site fully functional at https://recruitai.startanaicompany.com
2026-01-23 22:17:37 +01:00
8653b00921 Fix database migrations - run from app container instead of volume mount
- Removed migrations volume mount from docker-compose.yml
- Added automatic migration runner in server.js on startup
- Migrations now run from files built into Docker image
- Fixes 'relation does not exist' errors
2026-01-23 22:12:16 +01:00
a44f8e18d7 Remove volume mount for public directory - files built into image
The volume mount was overwriting the public directory from the Docker
image with an empty directory from the host, causing ENOENT errors.
Public files are now served from the Docker image via COPY command.
2026-01-23 21:59:41 +01:00
40f4a41203 Fix public directory copy in Dockerfile - use trailing slashes 2026-01-23 21:54:46 +01:00
e0ad2bc49e Fix root path routing - serve index.html for / 2026-01-23 21:45:38 +01:00
42993ced70 Fix deployment issues
- Remove healthcheck from Dockerfile (Coolify handles this)
- Make database connection non-blocking
- Add Coolify-specific docker-compose file
- Improve error handling for database connection
2026-01-23 21:34:33 +01:00
c914be9b46 Add deployment status documentation 2026-01-23 21:26:53 +01:00
30f094f049 Add deployment script and documentation
- Deployment script for Coolify setup
- Comprehensive deployment guide
- SSH public key included
- Updated .gitignore to exclude private key
2026-01-23 21:23:39 +01:00
406d278a39 Initial commit: AI Recruitment Site for Ryans Recruit Firm
- Complete PostgreSQL schema with migrations
- Node.js/Express backend with authentication
- Public website (home, about, services, jobs, apply, contact)
- Admin dashboard with applicant and job management
- CV upload and storage in PostgreSQL BYTEA
- Docker Compose setup for deployment
- Session-based authentication
- Responsive design with Ryan brand colors
2026-01-23 21:17:24 +01:00