docs: add all snippets for docker-compose deployments

This commit is contained in:
Thomas Boerger 2024-04-20 15:29:49 +02:00
parent 377048f6ed
commit f0026b3134
No known key found for this signature in database
GPG Key ID: F630596501026DB5
13 changed files with 325 additions and 0 deletions

View File

@ -0,0 +1,131 @@
# Compose
With the `docker-compose` snippets within this directory you are able to plug
different setups of Semaphore UI together. Below you can find some example
combinations.
Some of the snippets define environment variables which could be optionally
overwritten if needed.
## Server
First of all we need the server definition and we need to decide if we want to
build the image dynamically or if we just want to use a released image.
### Build
This simply takes the currently cloned source and builds a new image including
all local changes.
```console
docker-compose -f deployment/compose/server/base.yml -f deployment/compose/server/build.yml up
```
### Image
This simply downloads the defined image from DockerHub and starts/configures it
properly based on the integrated bootstrapping scripts.
```console
docker-compose -f deployment/compose/server/base.yml -f deployment/compose/server/image.yml up
```
### Config
If you want to provide a custom `config.json` file to add options which are not
exposed as environment variables you could add this snippet which sources the
file from the current working directory.
```console
docker-compose <server from above> -f deployment/compose/server/config.yml up
```
## Runner
If you want to try the remote runner functionality of Semaphore you could just
add this snippet to get a runner up and connected to semaphore. Similar to the
examples above for the server you got different options like building the runner
from the source or using our prebuilt images.
### Build
This simply takes the currently cloned source and builds a new image including
all local changes.
```console
docker-compose <server from above> -f deployment/compose/runner/base.yml -f deployment/compose/runner/build.yml up
```
### Image
This simply downloads the defined image from DockerHub and starts/configures it
properly based on the integrated bootstrapping scripts.
```console
docker-compose <server from above> -f deployment/compose/runner/base.yml -f deployment/compose/runner/image.yml up
```
### Config
If you want to provide a custom `config.json` file to add options which are not
exposed as environment variables you could add this snippet which sources the
file from the current working directory.
```console
docker-compose <runner from above> -f deployment/compose/runner/config.yml up
```
## Database
After deciding the base of it you should choose one of the supported databases.
Here we got currently the following options so far.
### SQLite
This simply configures a named volume for the SQLite storage used as a database
backend.
```console
docker-compose <server/runner from above> -f deployment/compose/store/sqlite.yml up
```
### BoltDB
This simply configures a named volume for the BoltDB storage used as a database
backend.
```console
docker-compose <server/runner from above> -f deployment/compose/store/boltdb.yml up
```
### MariaDB
This simply starts an additional container for a MariaDB instance used as a
database backend including the required credentials.
```console
docker-compose <server/runner from above> -f deployment/compose/store/mariadb.yml up
```
### MySQL
This simply starts an additional container for a MySQL instance used as a
database backend including the required credentials.
```console
docker-compose <server/runner from above> -f deployment/compose/store/mysql.yml up
```
### PostgreSQL
This simply starts an additional container for a PostgreSQL instance used as a
database backend including the required credentials.
```console
docker-compose <server/runner from above> -f deployment/compose/store/postgres.yml up
```
## Cleanup
After playing with the setup you are able to stop the whole setup by just
replacing `up` at the end of the command with `down`.

View File

@ -0,0 +1,13 @@
version: "3.4"
services:
runner:
image: docker.io/semaphoreui/runner:${SEMAPHORE_VERSION:-latest}
restart: always
environment:
SEMAPHORE_RUNNER_API_URL: ${SEMAPHORE_RUNNER_API_URL:-http://server:3000/api}
SEMAPHORE_RUNNER_REGISTRATION_TOKEN: ${SEMAPHORE_RUNNER_REGISTRATION_TOKEN:-H1wDyorbg6gTSwJlVwle2Fne}
server:
environment:
SEMAPHORE_RUNNER_REGISTRATION_TOKEN: ${SEMAPHORE_RUNNER_REGISTRATION_TOKEN:-H1wDyorbg6gTSwJlVwle2Fne}

View File

@ -0,0 +1,7 @@
version: "3.4"
services:
runner:
build:
context: ../../../
dockerfile: deployment/docker/runner/Dockerfile

View File

@ -0,0 +1,6 @@
version: "3.4"
services:
runner:
volumes:
- ${SEMAPHORE_RUNNER_LOCAL_CONFIG:-runner.json}:/etc/semaphore/config.json:Z

View File

@ -0,0 +1,20 @@
version: "3.4"
volumes:
server:
services:
server:
image: docker.io/semaphoreui/semaphore:${SEMAPHORE_VERSION:-latest}
restart: always
environment:
SEMAPHORE_ADMIN_NAME: ${SEMAPHORE_ADMIN_NAME:-Admin}
SEMAPHORE_ADMIN: ${SEMAPHORE_ADMIN_USERNAME:-admin}
SEMAPHORE_ADMIN_PASSWORD: ${SEMAPHORE_ADMIN_PASSWORD:-p455w0rd}
SEMAPHORE_ADMIN_EMAIL: ${SEMAPHORE_ADMIN_EMAIL:-admin@localhost}
SEMAPHORE_WEB_ROOT: ${SEMAPHORE_WEB_ROOT:-http://0.0.0.0:3000}
SEMAPHORE_ACCESS_KEY_ENCRYPTION: ${SEMAPHORE_ACCESS_KEY_ENCRYPTION:-IlRqgrrO5Gp27MlWakDX1xVrPv4jhoUx+ARY+qGyDxQ=}
volumes:
- server:/var/lib/semaphore
ports:
- "3000:3000"

View File

@ -0,0 +1,7 @@
version: "3.4"
services:
server:
build:
context: ../../../
dockerfile: deployment/docker/runner/Dockerfile

View File

@ -0,0 +1,6 @@
version: "3.4"
services:
server:
volumes:
- ${SEMAPHORE_RUNNER_LOCAL_CONFIG:-config.json}:/etc/semaphore/config.json:Z

View File

@ -0,0 +1,12 @@
version: "3.4"
volumes:
boltdb:
services:
server:
environment:
- SEMAPHORE_DB_DIALECT=bolt
- SEMAPHORE_DB_PATH=/var/lib/database
volumes:
- boltdb:/var/lib/database

View File

@ -0,0 +1,31 @@
version: "3.4"
volumes:
mariadb:
postgres:
services:
mariadb:
image: mariadb:10.8
restart: always
environment:
- MARIADB_ROOT_PASSWORD=root
- MARIADB_USER=semaphore
- MARIADB_PASSWORD=semaphore
- MARIADB_DATABASE=semaphore
volumes:
- mariadb:/var/lib/mysql
ports:
- 3306:3306
postgres:
image: postgres:14.3
restart: always
environment:
- POSTGRES_USER=semaphore
- POSTGRES_PASSWORD=semaphore
- POSTGRES_DB=semaphore
volumes:
- postgres:/var/lib/postgresql
ports:
- 5432:5432

View File

@ -0,0 +1,27 @@
version: "3.4"
volumes:
mariadb:
services:
server:
environment:
- SEMAPHORE_DB_DIALECT=mysql
- SEMAPHORE_DB_HOST=db
- SEMAPHORE_DB_PORT=3306
- SEMAPHORE_DB_USER=${MARIADB_USERNAME:-semaphore}
- SEMAPHORE_DB_PASS=${MARIADB_PASSWORD:-semaphore}
- SEMAPHORE_DB=${MARIADB_DATABASE:-semaphore}
depends_on:
- db
db:
image: mariadb:10.8
restart: always
environment:
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT:-root}
- MARIADB_USER=${MARIADB_USERNAME:-semaphore}
- MARIADB_PASSWORD=${MARIADB_PASSWORD:-semaphore}
- MARIADB_DATABASE=${MARIADB_DATABASE:-semaphore}
volumes:
- mariadb:/var/lib/mysql

View File

@ -0,0 +1,27 @@
version: "3.4"
volumes:
mysql:
services:
server:
environment:
- SEMAPHORE_DB_DIALECT=mysql
- SEMAPHORE_DB_HOST=db
- SEMAPHORE_DB_PORT=3306
- SEMAPHORE_DB_USER=${MYSQL_USERNAME:-semaphore}
- SEMAPHORE_DB_PASS=${MYSQL_PASSWORD:-semaphore}
- SEMAPHORE_DB=${MYSQL_DATABASE:-semaphore}
depends_on:
- db
db:
image: mysql:8.0
restart: always
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT:-root}
- MYSQL_USER=${MYSQL_USERNAME:-semaphore}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-semaphore}
- MYSQL_DATABASE=${MYSQL_DATABASE:-semaphore}
volumes:
- mysql:/var/lib/mysql

View File

@ -0,0 +1,26 @@
version: "3.4"
volumes:
postgres:
services:
server:
environment:
- SEMAPHORE_DB_DIALECT=postgres
- SEMAPHORE_DB_HOST=db
- SEMAPHORE_DB_PORT=5432
- SEMAPHORE_DB_USER=${POSTGRES_USERNAME:-semaphore}
- SEMAPHORE_DB_PASS=${POSTGRES_PASSWORD:-semaphore}
- SEMAPHORE_DB=${POSTGRES_DATABASE:-semaphore}
depends_on:
- db
db:
image: postgres:14.3
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USERNAME:-semaphore}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-semaphore}
- POSTGRES_DB=${POSTGRES_DATABASE:-semaphore}
volumes:
- postgres:/var/lib/postgresql

View File

@ -0,0 +1,12 @@
version: "3.4"
volumes:
sqlite:
services:
server:
environment:
- SEMAPHORE_DB_DIALECT=sqlite
- SEMAPHORE_DB_PATH=/var/lib/database
volumes:
- sqlite:/var/lib/database