All frontend applications must follow the structure and guidelines below to ensure consistency, security, and automation readiness.
- All frontend repositories must be cloned to:
/home/<username>/<project-name>/
- The application is built and served from this location.
/home/<username>/<project-name>/dist/
We are considering the default build folder to be named as "dist", if it's different in your case, replace every instance of "dist" to the build folder name of yours as per the project setup.
- Ubuntu 20.04+ (recommended)
- SSH access with password or private key authentication
- Web server installed (e.g., nginx)
- Node.js and npm installed globally on the system
- Optional: PM2 for SSR/Next.js (if needed)
βΉοΈ Ensure Node.js and npm are installed using NodeSource or your preferred method.
Use the same version used by the frontend team for local builds. Ask them directly if unsure.
Each repository must include:
package.json
package-lock.json
.gitignore
(withdist/
ignored)- Proper build scripts
All frontend projects must define these scripts:
"scripts": {
"build": "vite build",
"dev": "vite",
"preview": "vite preview"
}
Other frameworks like Next.js can override with:
"build": "next build && next export"
pull_and_build.yml
Purpose: Pull the latest code on the server and build the frontend.
Tasks:
- SSH into the server
- Pull from GitHub or re-clone cleanly
- Run
npm ci
andnpm run build
- Move the existing
dist/
todist_prev/
- Build a new app into
dist/
- Reload nginx to serve the updated files
rollback.yml
Purpose: Restore the last known good build if anything fails (e.g., broken deployment, failed health check).
Tasks:
- Delete the broken
dist/
- Move
dist_prev/
back todist/
- Reload nginx
slack_alert_and_healthcheck.yml
Purpose:
- Ping the deployed URL (via
curl
orhttp_status
) - Send a Slack message using a webhook
Scenarios:
- β If the site is healthy β send a "Deployed Successfully" message
- β If the site fails health check:
- Trigger
rollback.yml
- Send a "Deployment Failed. Rolled back." alert
- Trigger
This is the central orchestrator for the deployment pipeline.
Steps:
- Triggered on push to
<branch_name>
(or manual dispatch) - Calls
pull_and_build.yml
- Calls
slack_alert_and_healthcheck.yml
- If health check fails, runs
rollback.yml
- Slack alert is always sent (on success or failure)
All deployment jobs send a Slack message to the configured webhook.
You will receive:
- β Success notifications
- β Failure notifications (including cause and rollback confirmation)
Make sure the SLACK_WEBHOOK_URL
is added to the repo secrets.
Contact Alkaison for help in setup or further improvements as per your project.