2.3 KiB
2.3 KiB
GitLab -> Server Deploy
This project is prepared for a GitLab-first delivery flow:
- Push source code to GitLab.
- GitLab CI runs tests.
- GitLab CI builds and pushes container images to GitLab Container Registry.
- The server only receives the deployment bundle and pulls images from the registry.
For a same-host shell-runner flow that rebuilds call-center-app directly on push to main, see:
docs/runbooks/gitlab-cicd.md
Files used
.gitlab-ci.ymldeployment/docker-compose.server.registry.ymldeployment/docker-compose.asterisk.server.registry.ymldeployment/.env.images.example
GitLab CI variables
Required for image publishing:
CI_REGISTRYCI_REGISTRY_USERCI_REGISTRY_PASSWORDCI_REGISTRY_IMAGE
Required for the optional deploy job:
DEPLOY_HOSTDEPLOY_USERDEPLOY_PATHDEPLOY_SSH_PRIVATE_KEY
DEPLOY_PATH should point to a minimal runtime directory on the server, for example:
/opt/call-center
The server runtime directory should contain:
.env.production.data_local/.asterisk_assets/(can stay empty)deployment/
Server deploy bundle
The server no longer needs the full project checkout. It only needs:
deployment/.env.production.data_local/.asterisk_assets/if you use custom prompt files
The app image is resolved through APP_IMAGE.
The Asterisk image is resolved through ASTERISK_IMAGE.
Store them in deployment/.env.images, for example:
APP_IMAGE=registry.gitlab.example.com/group/project/app:<tag>
ASTERISK_IMAGE=registry.gitlab.example.com/group/project/asterisk:<tag>
Manual server deploy
From the server:
cd /opt/call-center/deployment
docker login <registry>
docker compose --env-file .env.images -f docker-compose.server.registry.yml pull
docker compose --env-file .env.images -f docker-compose.server.registry.yml up -d
docker compose --env-file .env.images -f docker-compose.asterisk.server.registry.yml pull
docker compose --env-file .env.images -f docker-compose.asterisk.server.registry.yml up -d
Notes
deployment/docker-compose.server.ymlis still the source-build variant.deployment/docker-compose.server.registry.ymlis the registry/pull-only variant for the server.- The deploy job in
.gitlab-ci.ymlis manual on the default branch by design.