Skip to content

DevOps Guide — New Project Setup


Overview

Step 1: CloudPanel  → Create WordPress site
Step 2: CloudPanel  → Install SSL
Step 3: Git Bash    → Run script (auto: repo + secrets + files)
Step 4:             → Send handover to developer

Step 1: CloudPanel — Create WordPress Site

https://development.enfection.com:8443
→ Sites → + Add Site → New WordPress Site

Domain Name:        rocell.development.enfection.com
PHP Version:        8.2
WP Admin User:      admin
WP Admin Password:  (generate strong password — save it)
WP Admin Email:     devops@enfection.com
→ Create

CloudPanel automatically creates the site, database, and installs WordPress.

Verify:

https://rocell.development.enfection.com/wp-admin  ✅


Step 2: SSL — Let's Encrypt

CloudPanel → Sites → rocell.development.enfection.com
→ SSL/TLS → Actions → New Let's Encrypt Certificate → Create

Wait 30 seconds. Verify padlock:

https://rocell.development.enfection.com  ✅


Step 3: Run Script (Git Bash — Local Machine)

cd C:/Enfection/DevOps-Process/wordpress-devops-infrastructure
scripts/new-project.sh rocell "Rocell Website"

Script automatically does:

Task Result
GitHub private repo create [client]-wordpress-theme
deploy.yml push staging CI/CD pipeline
deploy-production.yml push production CI/CD pipeline
sonar-project.properties push SonarQube config
.gitignore push ignore file
docker/docker-compose.yml push production Docker setup
docker/nginx.conf push Nginx config
main + staging branches create both branches ready
8 GitHub secrets add staging filled, prod = PENDING

8 Secrets status after script:

Secret Status
STAGING_SERVER_IP ✅ auto-filled
STAGING_SSH_USER ✅ auto-filled
STAGING_SSH_KEY ✅ auto-filled
SONAR_TOKEN ✅ auto-filled
SONAR_HOST_URL ✅ auto-filled
PROD_SSH_USER ✅ auto-filled (ubuntu)
PROD_SERVER_IP ⚠ PENDING — add after Lightsail setup
PROD_SSH_KEY ⚠ PENDING — add after Lightsail setup

Step 3b: Production Setup (Lightsail)

When ready to go to production:

1. Create Lightsail instance:

AWS Lightsail → Create instance
→ OS only → Ubuntu 24.04 LTS
→ $10/month (2GB RAM)
→ Launch script:
#!/bin/bash
apt-get update -y
apt-get install -y docker.io docker-compose
systemctl enable docker
systemctl start docker
usermod -aG docker ubuntu
→ Create → get Static IP → attach

2. Download + convert Lightsail SSH key:

Lightsail → Account → SSH keys
→ Download: LightsailDefaultKey-ap-south-1.pem

PuTTYgen → Load .pem
→ Conversions → Export OpenSSH key
→ Save as: C:\Users\chamo\.ssh\lightsail-production

3. Update PROD secrets in GitHub repo:

github.com/ChamodTharuka/[client]-wordpress-theme
→ Settings → Secrets → Actions
→ Update PROD_SERVER_IP = [lightsail static IP]
→ Update PROD_SSH_KEY   = [contents of lightsail-production file]

4. Merge staging → main to deploy:

git checkout main
git merge staging
git push origin main
# → Auto deploys to Lightsail production ✅


Step 4: Developer Handover

Send to developer:

GitHub Repo:   https://github.com/ChamodTharuka/rocell-wordpress-theme
Branch:        staging

Staging Site:  https://rocell.development.enfection.com
WP Admin:      https://rocell.development.enfection.com/wp-admin
WP User:       admin
WP Password:   [password from Step 1]

Developer Guide: Developer Guide → New Project


One-Time Setup (First Time Only)

Do this once. Never repeat.

Install GitHub CLI

winget install --id GitHub.cli

Reopen Git Bash, then login:

gh auth login
# → GitHub.com → HTTPS → Login with a web browser

Save Deploy Key

Convert enfection-staging-key.ppk → OpenSSH using PuTTYgen:

PuTTYgen → Load → enfection-staging-key.ppk
→ Conversions → Export OpenSSH key
→ Save as: C:\Users\chamo\.ssh\deploy_key

Create Config File

cat > ~/.enfection-config << 'EOF'
STAGING_SERVER_IP=13.234.20.114
STAGING_SSH_USER=ubuntu
STAGING_SSH_KEY_PATH=~/.ssh/deploy_key
SONAR_HOST_URL=https://sonarqube.enfection.com
SONAR_TOKEN=your-sonarqube-user-token
GITHUB_USER=ChamodTharuka
EOF

Get SonarQube Token (one token — works for all projects)

https://sonarqube.enfection.com
→ My Account → Security → Generate Tokens
→ Name: enfection-global
→ Type: User Token
→ Generate → Copy → paste into ~/.enfection-config