Skip to main content

Deployment

Purpose​

This page documents the deployment process for Maqsafy services, including pre-deployment checks, deployment commands, post-deployment validation, and rollback notes.

Deployment Scope​

ItemDescription
BackendLaravel / PHP services
FrontendNuxt application
Web ServerNginx reverse proxy
DatabaseMySQL
QueueRedis or configured queue driver
ContainersDocker, where applicable

Pre-Deployment Checklist​

Before deploying to production, verify the following:

  • The release has been tested on staging.
  • Database migrations have been reviewed.
  • A recent backup is available.
  • Environment variables are configured.
  • Queue workers are running.
  • External integrations are available.
  • Rollback steps are known.
  • No real credentials are written in the release notes or documentation.

General Laravel Deployment Commands​

Laravel officially recommends caching configuration, routes, and views during production deployment to improve performance. Laravel also provides queue:restart to gracefully restart queue workers after their current jobs are completed.

git pull
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan queue:restart

Frontend Deployment Notes​

If the frontend is built separately, document the exact build process used by the production environment.

Example:

npm install
npm run build

If Docker is used, document the image build and restart process instead of generic commands.

Docker Deployment Notes​

Use this section only if the service runs inside Docker.

docker ps
docker compose pull
docker compose up -d
docker logs <container-name>

Nginx Validation​

After deployment, validate Nginx configuration if changes were made.

sudo nginx -t
sudo systemctl reload nginx

Post-Deployment Checks​

After deployment, verify:

  • Homepage or health endpoint is reachable.
  • Login works.
  • One protected API endpoint works.
  • Queue workers are processing jobs.
  • Redis connection works.
  • Database connection works.
  • Nginx has no critical errors.
  • Application logs do not show new critical exceptions.

Health Check Examples​

curl -I https://example.com
curl https://example.com/health

Rollback​

Document the rollback process used by the actual production environment.

Example placeholder:

git checkout <previous-release-tag>
composer install --no-dev --optimize-autoloader
php artisan migrate:rollback --force
php artisan queue:restart

Deployment Rules​

  • Do not deploy to production without a recent backup.
  • Do not deploy during peak time unless required.
  • Do not run destructive database commands without approval.
  • Do not expose production credentials in logs, screenshots, or documentation.
  • Dangerous commands must include a warning and approval requirement.