Pipeline
This guide explains how to set up a GitLab pipeline for your Brezel instance. The pipeline will build and deploy your instance to one or multiple available deployment targets:
- An Ubuntu/Debian virtual server, using SSH
- Docker
- Kubernetes
Virtual Server using SSH
This section assumes you have access to a brezel
user via SSH on a virtual server.
1. Generate an SSH keypair
On your local Linux/Unix machine, generate an RSA key pair:
This will output something like:
Enter the path of the key. The name could be gitlab_rsa
.
No passphrase. Hit enter.
Hit enter. It will then output something like this:
Authorize the brezel
user to access the virtual server via the private key. Login:
Copy the contents of gitlab_rsa.pub
and append it to ~/.ssh/authorized_keys
:
2. Configure GitLab
In GitLab, go to the instance repository, to Settings > CI/CD > Variables and click on Add variable.
Key | Value | Protect variable |
---|---|---|
PRIVATE_KEY | Contents of your gitlab_rsa private key | ✅ |
PROD_HOST | brezel.example.io | ✅ |
PROD_PORT | 22 (222 on Hetzner managed servers) | ✅ |
PROD_USER | brezel | ✅ |
PROD_PATH | /var/www/vhosts/brezel.example.io | ✅ |
VITE_APP_API_URL | https://api.example.brezel.io | ✅ |
VITE_APP_SYSTEM | example | ✅ |
Make sure to add an empty newline at the end of PRIVATE_KEY!
3. Configure your .gitlab-ci.yml
In your repository, there should be a .gitlab-ci.yml.example
file. Create the .gitlab-ci.yml
file:
Add the file to git:
In your .gitlab-ci.yml
, uncomment the SSH deployment line:
Special case: Plesk
If your deployment target is a server managed by Plesk, then PHP is under a different path.
Go to gitlab/.ssh.gitlab-ci.yml
and change all occurrences of php
in the script:
sections to
Keep in mind to also change the paths of composer. If you downloaded composer to ~/bin/composer
, the lines should be