Deployment and Updates
Deploy a website to production
All these instructions are executed in the Docker container.
Add website to configuration file
If you created the site from scratch instead of cloning it, make sure the website is added to the $DEPLOYER_DIR/sites.php file. You can validate this by running:
site-add www.example.com [email protected]:example/example.git
Note: If the site requires special configuration, you’ll need to manually edit the $DEPLOYER_DIR/sites.php file.
Style tests, code quality, and unit tests
Run style tests, code quality, and unit tests in the Docker container with:
site www.example.com
site-check
Push changes to GitHub
If everything is correct, push the changes to GitHub:
site www.example.com
site-send "Website update."
Note: If the GitHub repository has a configured webhook, the website will be deployed automatically when pushing changes and passing the style tests, code quality, and unit tests in the GitHub Actions workflow.
Deployment
It’s not necessary to deploy to the production server if the GitHub repository has a configured webhook.
If there are no errors, you can deploy to the production server with:
#DEPLOYER_HOST=hosting.example.com # Only if not configured in .env
site-deploy www.example.com
If an error occurs when deploying and you try to make a new deploy, it’s very likely that the deploy is locked. If this happens, you can unlock and deploy again with:
#DEPLOYER_HOST=hosting.example.com # Only if not configured in .env
site-deploy-locked www.example.com
Update components
Update Docker
On your local machine, run:
DEV_DIR=$HOME/dev
DOCKER_DIR=$DEV_DIR/docker-sites-php
cd $DOCKER_DIR
git pull
docker-compose build --no-cache
docker-compose up -d
You must add the SSH keys to the Docker container again and configure Git inside the container.
Update PHP Deployer
Enter the container and run:
cd $DEPLOYER_DIR
git pull
composer update
Update website
Enter the container and run:
site www.example.com
site-update