diff --git a/.webhook-test b/.webhook-test deleted file mode 100644 index 4ced60c..0000000 --- a/.webhook-test +++ /dev/null @@ -1 +0,0 @@ -# Webhook test - Fri Jan 23 23:36:18 CET 2026 diff --git a/DEPLOYMENT_GUIDE.md b/DEPLOYMENT_GUIDE.md deleted file mode 100644 index 29d64b9..0000000 --- a/DEPLOYMENT_GUIDE.md +++ /dev/null @@ -1,305 +0,0 @@ -# Deployment Guide - AI Recruitment Site - -## ✅ What's Been Completed - -### 1. Project Setup -- ✅ Complete project structure created -- ✅ Git repository initialized and first commit made -- ✅ All code pushed to Gitea: `git@git.startanaicompany.com:mikael.westoo/ai-recruit-site-template.git` - -### 2. Application Built -- ✅ Backend API server with authentication -- ✅ PostgreSQL database schema and migrations -- ✅ Public website (6 pages: home, about, services, jobs, apply, contact) -- ✅ Admin dashboard (4 pages: login, dashboard, applicants, jobs) -- ✅ CV upload and storage system (PostgreSQL BYTEA) -- ✅ Docker + Docker Compose configuration - -### 3. Coolify Setup -- ✅ Coolify project created: "RecruitAI" (UUID: `y8804s80goowsccwk8400kwo`) -- ✅ SSH deploy keys generated (stored in `./deploy_key` and `./deploy_key.pub`) -- ✅ Deploy key added to Gitea repository - -### 4. DNS Setup -- ✅ CNAME record created: `recruitai.startanaicompany.com` - ---- - -## 🔧 Manual Steps Required - -The Coolify API doesn't support adding private keys programmatically. You need to complete the following steps via the Coolify web UI: - -### Step 1: Add Private Key to Coolify - -1. **Login to Coolify**: https://app.coolify.io -2. **Navigate to**: Security → Private Keys -3. **Click**: "Add Private Key" -4. **Fill in**: - - **Name**: `recruitai-deploy-key` - - **Description**: `Deploy key for RecruitAI Gitea repository` - - **Private Key**: Copy the contents of `./deploy_key` file - - **Get the private key**: - ```bash - cd /home/milko/projects/ryan/airecruit-site/ai-recruit-site-template - cat ./deploy_key - ``` - -5. **Save** the private key -6. **Note down** the UUID of the created private key (you'll see it in the URL or key list) - -### Step 2: Create Application in Coolify - -1. **Navigate to**: Projects → RecruitAI → production environment -2. **Click**: "+ Add Resource" → "Public Repository (with deploy key)" -3. **Fill in the form**: - - **General:** - - **Name**: `recruitai` - - **Description**: `AI Recruitment Site for Ryans Recruit Firm` - - **Source:** - - **Git URL**: `git@git.startanaicompany.com:mikael.westoo/ai-recruit-site-template` - - **Branch**: `master` - - **Private Key**: Select `recruitai-deploy-key` (the one you just added) - - **Build:** - - **Build Pack**: `Dockerfile` - - **Dockerfile Location**: `./Dockerfile` (default) - - **Docker Compose Location**: Leave empty (we're deploying the app container only) - - **Network:** - - **Port**: `3000` - - **Domains**: `http://recruitai.startanaicompany.com` - - **Environment Variables** (click "Add Environment Variable" for each): - ``` - DB_HOST=postgres - DB_PORT=5432 - DB_NAME=recruitment - DB_USER=postgres - DB_PASSWORD=your-secure-password-here - SESSION_SECRET=your-very-secure-session-secret-here - NODE_ENV=production - PORT=3000 - ``` - - **IMPORTANT**: Generate secure passwords for `DB_PASSWORD` and `SESSION_SECRET` - -4. **Add PostgreSQL Database**: - - In the same environment, click "+ Add Resource" → "PostgreSQL" - - **Name**: `recruitai-postgres` - - **Database Name**: `recruitment` - - **Username**: `postgres` - - **Password**: Use the same password as `DB_PASSWORD` above - - **Port**: `5432` - - **Image**: `postgres:15-alpine` - -5. **Deploy**: Click "Deploy" button - -### Step 3: Configure Webhook (Optional but Recommended) - -The webhook has already been added to Gitea, but it's pointing to a null UUID. Update it: - -1. **Get the Application UUID** from Coolify (visible in the app URL or details page) -2. **Update Gitea webhook**: - - Go to: https://git.startanaicompany.com/mikael.westoo/ai-recruit-site-template/settings/hooks - - Edit the webhook - - Update URL to: `https://app.coolify.io/api/v1/deploy?uuid=YOUR_APP_UUID` - - Save - ---- - -## 🚀 Accessing the Site - -Once deployed: - -- **Public Site**: http://recruitai.startanaicompany.com -- **Admin Login**: http://recruitai.startanaicompany.com/admin/login - -### First Time Admin Setup - -1. Navigate to the admin login page -2. On first visit, you'll see a prompt to create the first admin account -3. Enter: - - **Email**: Your email address - - **Password**: A secure password - - **Full Name**: Your name -4. Click "Create Admin Account" - ---- - -## 📋 Database Migrations - -Migrations will run automatically when the PostgreSQL container starts for the first time. They're located in `/migrations/`: - -- `001_init_schema.sql` - Creates all tables, indexes, and constraints -- `002_seed_data.sql` - Adds 5 sample job postings - ---- - -## 🧪 Testing the Site - -### Public Pages -1. **Home page** - http://recruitai.startanaicompany.com -2. **Jobs page** - http://recruitai.startanaicompany.com/jobs -3. **Apply page** - Click "Apply Now" on any job -4. **Test application submission**: - - Fill in the form - - Upload a CV (PDF, DOC, or DOCX, max 5MB) - - Submit - -### Admin Panel -1. **Login** at /admin/login -2. **Dashboard** - View statistics -3. **Applications** - See submitted applications -4. **Download CV** - Test CV download functionality -5. **Jobs Management** - Create, edit, activate/deactivate jobs - ---- - -## 🔐 Security Checklist - -- [x] Session-based authentication implemented -- [x] Passwords hashed with bcrypt -- [x] SQL injection protection (parameterized queries) -- [x] File upload validation (type and size) -- [ ] Change default DB_PASSWORD -- [ ] Change SESSION_SECRET -- [ ] Enable HTTPS (via Coolify or Cloudflare proxy) -- [ ] Review and test all endpoints - ---- - -## 📁 Project Structure - -``` -ai-recruit-site-template/ -├── server.js # Main Express server -├── package.json # Node.js dependencies -├── Dockerfile # Docker build configuration -├── docker-compose.yml # Local development setup -├── deploy.sh # Deployment script -├── deploy_key # SSH private key (DO NOT COMMIT) -├── deploy_key.pub # SSH public key -├── migrations/ -│ ├── 001_init_schema.sql # Database schema -│ └── 002_seed_data.sql # Sample data -└── public/ - ├── index.html # Home page - ├── about.html # About page - ├── services.html # Services page - ├── jobs.html # Job listings - ├── apply.html # Application form - ├── contact.html # Contact form - ├── admin/ - │ ├── login.html # Admin login - │ ├── dashboard.html # Admin dashboard - │ ├── applicants.html # Applications management - │ └── jobs.html # Jobs management - ├── css/ - │ └── styles.css # Ryan brand styles - └── js/ - ├── main.js # Public site JavaScript - └── admin.js # Admin panel JavaScript -``` - ---- - -## 🐛 Troubleshooting - -### Database Connection Errors -```bash -# Check if PostgreSQL is running -docker ps | grep postgres - -# View PostgreSQL logs -docker logs recruitai-postgres - -# Connect to database manually -docker exec -it recruitai-postgres psql -U postgres -d recruitment -``` - -### Application Won't Start -```bash -# View application logs in Coolify dashboard -# Or check Docker logs -docker logs recruitai-app - -# Common issues: -# 1. Database not ready - wait 30 seconds and redeploy -# 2. Environment variables missing - check Coolify settings -# 3. Port already in use - change PORT environment variable -``` - -### CV Upload Fails -- Check file size (max 5MB) -- Check file type (PDF, DOC, DOCX only) -- Verify PostgreSQL has enough space -- Check application logs for errors - ---- - -## 📊 Resource Details - -### Gitea Repository -- **URL**: https://git.startanaicompany.com/mikael.westoo/ai-recruit-site-template -- **SSH**: git@git.startanaicompany.com:mikael.westoo/ai-recruit-site-template.git -- **Branch**: master - -### Coolify -- **Project**: RecruitAI (`y8804s80goowsccwk8400kwo`) -- **Environment**: production (`a4g8gwwo48wkkck80og0g84k`) -- **Server**: h001 (`ngkwo8css8og0s00c4ows44o`) - -### Cloudflare -- **Zone ID**: `e6ade38a28032c3542140a9cbf592838` -- **Domain**: recruitai.startanaicompany.com -- **DNS Record**: CNAME pointing to Coolify FQDN - ---- - -## 📞 Support - -For issues or questions: -- **Email**: info@ryansrecruit.com -- **Repository**: https://git.startanaicompany.com/mikael.westoo/ai-recruit-site-template - ---- - -## ✨ Features Summary - -### Public Features -- Professional recruitment website with Ryan brand design -- Job listings with search and filtering -- Online application form with CV upload (PDF/DOC/DOCX) -- Contact form -- Fully responsive (mobile, tablet, desktop) - -### Admin Features -- Secure authentication (first-time admin creation) -- Dashboard with statistics -- Application management - - View all applications - - Filter by status, job, or search - - Download CVs - - Update application status - - Add notes -- Job management - - Create/edit/delete jobs - - Activate/deactivate listings - - View all jobs (active and inactive) - -### Technical Features -- PostgreSQL database with proper indexes -- CV storage in BYTEA columns (efficient binary storage) -- Session-based authentication -- Docker containerization -- Auto-deployment via webhook -- Ryan brand colors and design system - ---- - -**Last Updated**: 2026-01-23 -**Version**: 1.0.0 -**Status**: Ready for deployment (pending manual Coolify setup) diff --git a/DEPLOYMENT_STATUS.md b/DEPLOYMENT_STATUS.md deleted file mode 100644 index 427bfd9..0000000 --- a/DEPLOYMENT_STATUS.md +++ /dev/null @@ -1,130 +0,0 @@ -# 🚀 Deployment Status - AI Recruitment Site - -## ✅ FULLY DEPLOYED AND OPERATIONAL! - -The AI Recruitment Site is live and fully functional at https://recruitai.startanaicompany.com - -### 🌐 Access the Site - -- **Public Website**: https://recruitai.startanaicompany.com -- **Admin Panel**: https://recruitai.startanaicompany.com/admin/login - -### 📊 Deployment Details - -**Application**: -- **UUID**: `ps0kkk4s8cokggs8wosckk0k` -- **Name**: recruitai -- **Status**: ✅ Running -- **Latest Commit**: 8653b00 - -**Repository**: -- **Gitea**: https://git.startanaicompany.com/mikael.westoo/ai-recruit-site-template -- **Branch**: master -- **Webhook**: ✅ Configured with secret (auto-deploy on push) - -**Infrastructure**: -- **Server**: h001 (78.46.41.201) -- **Project**: RecruitAI (`y8804s80goowsccwk8400kwo`) -- **Environment**: production -- **DNS**: recruitai.startanaicompany.com → HTTPS enabled - -### 🔍 Monitor Deployment - -**Coolify Dashboard**: -https://app.coolify.io/project/y8804s80goowsccwk8400kwo/environment/a4g8gwwo48wkkck80og0g84k/application/ps0kkk4s8cokggs8wosckk0k - -### 🎯 Getting Started - -1. **Access Admin Panel**: https://recruitai.startanaicompany.com/admin/login -2. **Create First Admin**: - - The system will automatically detect no admins exist - - Enter your email, password, and full name - - Click "Sign In" to create your admin account -3. **Manage Jobs**: View and edit the 5 sample jobs or create new ones -4. **Review Applications**: Check submitted applications and download CVs - -### 🔧 Configuration - -**Database**: -- PostgreSQL 15-alpine running in Docker Compose -- Database name: `recruitment` -- Migrations run automatically on app startup -- Sample data includes 5 job postings -- CV files stored as BYTEA in PostgreSQL - -**Environment Variables** (Configured via Coolify): -- `DB_PASSWORD`: Database password -- `SESSION_SECRET`: Session encryption key -- All other defaults work out of the box - -**Security**: -- ✅ HTTPS with Let's Encrypt -- ✅ Session-based authentication -- ✅ Passwords hashed with bcrypt -- ✅ SQL injection protection -- ✅ File upload validation (PDF/DOC/DOCX only, 5MB max) - -### 🔄 Auto-Deployment - -Webhook configured with secret! Any push to the `master` branch will automatically trigger redeployment: - -```bash -cd /home/milko/projects/ryan/airecruit-site/ai-recruit-site-template - -# Make changes -vim public/index.html - -# Commit and push -git add . -git commit -m "Update homepage" -git push origin master - -# Coolify will automatically redeploy! -``` - -### 📝 What's Deployed - -**Public Pages** (6 pages): -- ✅ Home page with company overview -- ✅ About Us page -- ✅ Services page -- ✅ Job Listings (dynamic from database - 5 sample jobs) -- ✅ Application form with CV upload -- ✅ Contact form - -**Admin Pages** (4 pages): -- ✅ Login/First-admin creation -- ✅ Dashboard with statistics -- ✅ Applications management -- ✅ Jobs management - -**Features**: -- ✅ CV upload and storage (PostgreSQL BYTEA) -- ✅ CV download functionality -- ✅ Session-based admin authentication -- ✅ Job posting management -- ✅ Application status tracking -- ✅ Responsive design (mobile/tablet/desktop) -- ✅ Ryan brand colors and styling -- ✅ Clean URLs (no .html extensions) -- ✅ Automatic database migrations - -### 🐛 Issues Fixed - -1. ✅ **Public directory not found** - Removed volume mount that was overwriting Docker image -2. ✅ **504 Gateway Timeout** - Added Traefik loadbalancer port to custom labels -3. ✅ **Database tables missing** - Removed migrations volume mount, migrations now run from app container -4. ✅ **Webhook not triggering** - Configured webhook secret for Gitea - -### 📞 Support - -- **Documentation**: See README.md and DEPLOYMENT_GUIDE.md -- **Repository**: https://git.startanaicompany.com/mikael.westoo/ai-recruit-site-template -- **Coolify**: https://app.coolify.io - ---- - -**Deployment Completed**: 2026-01-23 -**Status**: ✅ Fully Operational -**Database**: ✅ Initialized with sample data -**Admin Login**: ✅ Ready for first-admin creation