Deployment
SyncSHOP is released with Deployer from a developer machine to a Linux server. Nothing deploys on its own: each release is started by hand, and it stops before touching the server if any quality gate fails.
What the server needs
- PHP 8.5 with
bcmath,curl,fileinfo,gd,intl,mbstring,openssl,pdo_pgsql,sodium,zip - PostgreSQL 16 or newer (18 recommended)
- Redis 7
- Node 22 and Composer 2 (assets are built on the server)
- nginx with PHP-FPM, and TLS for the shop's domain
- SSH access for the deploy user, and read access to the repository (a deploy key)
One-time setup
-
Database. Create a database and an owner role. As the owner (or a superuser), enable the extensions:
CREATE EXTENSION IF NOT EXISTS citext; CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm; CREATE EXTENSION IF NOT EXISTS ltree;The first migration creates them too, but only when the role is allowed to.
-
Hosts file. On your machine, copy
deploy/hosts.example.ymltodeploy/hosts.ymland fill in the server. The file is ignored by git, so server details never reach the repository. -
Shared
.env. Create<deploy_path>/shared/.env(mode600) from.env.example, with at least:APP_ENV=production APP_DEBUG=false APP_URL=https://shop.example.ro SESSION_SECURE_COOKIE=true LOG_LEVEL=warning BROADCAST_CONNECTION=reverb REVERB_HOST=shop.example.ro REVERB_PORT=443 REVERB_SCHEME=https REVERB_SERVER_HOST=127.0.0.1 REVERB_SERVER_PORT=8080Generate
APP_KEYand theREVERB_APP_*values on the server, never on a shared machine. -
Services. Install the templates from
deploy/server/after replacing<user>and<deploy_path>:Template Installed as horizon.service/etc/systemd/system/syncshop-horizon.service(queues)reverb.service/etc/systemd/system/syncshop-reverb.service(WebSockets)sudoers/etc/sudoers.d/syncshop(lets the deploy reload PHP-FPM)nginx-reverb.confincluded in the shop's nginx serverblockAdd the scheduler to the deploy user's crontab; it runs every task registered in SyncSHOP's scheduler:
* * * * * cd <deploy_path>/current && php artisan schedule:run >> /dev/null 2>&1 -
Web root. Point nginx's document root at
<deploy_path>/current/public. -
First release, then install. Run the first
vendor/bin/dep deploy, then install the shop once, in the browser at/installor on the server withphp artisan syncshop:install(see Installation). Later releases don't touch the install.
Releasing
vendor/bin/dep deploy production # the host name from deploy/hosts.yml
vendor/bin/dep rollback production # back to the previous release (the database stays as it is)
A release runs in this order:
- Quality gate, on your machine. The branch must be pushed: the gate refuses if your local branch differs from the one on the server's remote. It exports that exact commit to a temporary folder, installs dependencies, builds the assets and runs
composer check. Any failure ends the release here. - On the server: clone the commit, install Composer packages without dev dependencies, build and pre-compress the assets, link storage and cache the configuration.
- Database: on hosts with
env_name: prod, apg_dumpgoes to~/backups(the last ten are kept), then migrations run,permissions:syncbrings the permission catalog and system roles up to date, andaddresses:syncloads the counties, localities and postcodes. - Preflight:
php artisan app:preflightchecks the configuration, Redis, PostgreSQL (including that the address data is loaded), PHP and storage. A failure stops the release before it goes live. Run it by hand on a new server first. - Go live: the
currentsymlink switches to the new release, PHP-FPM reloads, and Horizon, Reverb and the queue workers restart on the new code.
Migrations only move forward in production: a rollback switches the code back, not the schema. Restore a ~/backups dump if a migration must be undone.
Updating SyncSHOP
On a server that runs SyncSHOP from Composer, php artisan syncshop:update checks, backs up, updates and rolls back
by itself on failure (Updates, data feeds and releases). A shop deployed with Deployer
updates in its project instead: composer update "syncshop/*", run the tests, commit composer.lock, then
vendor/bin/dep deploy production (the recipe in syncshop/skeleton).