3
DEPLOY-SCRIPTS
Jonathan Miller edited this page 2026-06-21 02:21:16 +00:00

Deploy Scripts

Scripts for deploying, syncing, and managing Joomla and Dolibarr sites.

Scripts

Script Purpose
deploy/deploy-joomla.php Smart Joomla deploy via XML manifest
deploy/deploy-sftp.php Generic SFTP deployment
deploy/deploy-dolibarr.php Deploy Dolibarr modules
deploy/sync-joomla.php Sync between servers (excludes configuration.php)
deploy/backup-before-deploy.php Snapshot server before deploying
deploy/rollback-joomla.php Restore from pre-deploy snapshot
deploy/health-check.php Post-deploy HTTP/admin/API verification

Environments

deploy-sftp.php supports 4 environments via --env:

Env Config File Notes
dev scripts/sftp-config/sftp-config.dev.json Development server
demo scripts/sftp-config/sftp-config.demo.json Demo/staging server
rs scripts/sftp-config/sftp-config.rs.json Production (single)
live scripts/sftp-config/sftp-config.live.json or LIVE_TARGETS env Production (multi-instance)

Usage

# Single-target deploy
php bin/moko deploy:sftp --path . --env dev
php bin/moko deploy:sftp --path . --env demo
php bin/moko deploy:sftp --path . --env rs--dry-run

# Multi-instance live deploy (via LIVE_TARGETS env var)
export LIVE_TARGETS='[{"host":" web1","user":"deploy","remote_path":"/var/www/module/","ssh_key_file":"~/.ssh/id_rsa"}]'
php bin/moko deploy:sftp --path . --env live

Multi-Instance Live Deploy

When LIVE_TARGETS env var is set (typically from a Gitea Actions secret), deploy-sftp.php iterates over each target and deploys sequentially.

Format (JSON array):

[
  {"host": "web1.example.com", "user": "deploy", "remote_path": "/var/www/module/", "ssh_key_file": "~/.ssh/id_rsa"},
  {"host": "web2.example.com", "user": "deploy", "remote_path": "/var/www/module/", "ssh_key_file": "~/.ssh/id_rsa"}
]

Each target uses the same config format as sftp-config.*.json. Failed targets are logged but don't stop the remaining deploys.

Typical Workflow

  1. backup-before-deploy.php — snapshot current state
  2. deploy-joomla.php or deploy-sftp.php — deploy changes
  3. health-check.php — verify site is responding
  4. rollback-joomla.php — rollback if health check fails