Compare commits

..

1 Commits

Author SHA1 Message Date
6aef4d222c turned base into guacamole deployment 2022-10-27 08:41:50 +02:00
4 changed files with 132 additions and 12 deletions

View File

@ -1,7 +1,17 @@
---
services:
app:
guacamole:
image: guacamole/guacamole:${GUACAMOLE_VERSION}
restart: unless-stopped
depends_on:
- guacd
- mariadb
environment:
- GUACD_HOSTNAME=guacd
- MYSQL_HOSTNAME=mariadb
- MYSQL_DATABASE=${MARIADB_NAME}
- MYSQL_USER=${MARIADB_USER}
- MYSQL_PASSWORD=${MARIADB_PASS}
labels:
### Section Træfik
- traefik.enable=${TRAEFIK_ENABLED}
@ -22,15 +32,48 @@ services:
# specify a service so a custom port can be used
- traefik.http.services.${TRAEFIK_SERVICE}.loadbalancer.server.port=${TRAEFIK_SERVICE_PORT}
### Section Diun
- diun.enable=${DIUN_ENABLE}
- diun.watch_repo=${DIUN_WATCHREPO}
- diun.sort_tags=${DIUN_SORTALGO}
- diun.include_tags=${DIUN_INCLUDE}
- diun.exclude_tags=${DIUN_EXCLUDE}
- diun.enable=${DIUN_GUACAMOLE_ENABLE}
- diun.watch_repo=${DIUN_GUACAMOLE_WATCHREPO}
- diun.sort_tags=${DIUN_GUACAMOLE_SORTALGO}
- diun.include_tags=${DIUN_GUACAMOLE_INCLUDE}
- diun.exclude_tags=${DIUN_GUACAMOLE_EXCLUDE}
networks:
- internal
- traefik
guacd:
image: guacamole/guacd:${GUACD_VERSION}
restart: unless-stopped
labels:
### Section Diun
- diun.enable=${DIUN_GUACD_ENABLE}
- diun.watch_repo=${DIUN_GUACD_WATCHREPO}
- diun.sort_tags=${DIUN_GUACD_SORTALGO}
- diun.include_tags=${DIUN_GUACD_INCLUDE}
- diun.exclude_tags=${DIUN_GUACD_EXCLUDE}
networks:
- internal
mariadb:
image: mariadb:${MARIADB_VERSION}
restart: unless-stopped
environment:
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT}
- MARIADB_DATABASE=${MARIADB_NAME}
- MARIADB_USER=${MARIADB_USER}
- MARIADB_PASSWORD=${MARIADB_PASS}
labels:
### Section Diun
- diun.enable=${DIUN_MARIADB_ENABLE}
- diun.watch_repo=${DIUN_MARIADB_WATCHREPO}
- diun.sort_tags=${DIUN_MARIADB_SORTALGO}
- diun.include_tags=${DIUN_MARIADB_INCLUDE}
- diun.exclude_tags=${DIUN_MARIADB_EXCLUDE}
networks:
- internal
volumes:
- ${MARIADB_DATA}:/var/lib/mysql
networks:
internal:
traefik:
external: true
name: ${TRAEFIK_NETWORK}

View File

@ -3,7 +3,7 @@ TRAEFIK_ENABLED=true
TRAEFIK_NETWORK=traefik
TRAEFIK_ROUTER=app_example_com
TRAEFIK_SERVICE=app_example_com
TRAEFIK_SERVICE_PORT=80
TRAEFIK_SERVICE_PORT=8080
TRAEFIK_MATCHRULE=Host(`app.example.com`)
TRAEFIK_TLSENABLED=true
TRAEFIK_CERTRESOLVER=letsencrypt
@ -11,8 +11,32 @@ TRAEFIK_HTTP_MIDDLEWARES=http-to-https
TRAEFIK_HTTPS_MIDDLEWARES=hsts
# Diun
DIUN_ENABLE=true
DIUN_WATCHREPO=true
DIUN_SORTALGO=semver
DIUN_INCLUDE=
DIUN_EXCLUDE=
DIUN_GUACAMOLE_ENABLE=true
DIUN_GUACAMOLE_WATCHREPO=true
DIUN_GUACAMOLE_SORTALGO=semver
DIUN_GUACAMOLE_INCLUDE=([0-9]+)\.([0-9]+)\.([0-9]+)
DIUN_GUACAMOLE_EXCLUDE=
DIUN_GUACD_ENABLE=true
DIUN_GUACD_WATCHREPO=true
DIUN_GUACD_SORTALGO=semver
DIUN_GUACD_INCLUDE=([0-9]+)\.([0-9]+)\.([0-9]+)
DIUN_GUACD_EXCLUDE=
DIUN_MARIADB_ENABLE=true
DIUN_MARIADB_WATCHREPO=true
DIUN_MARIADB_SORTALGO=semver
DIUN_MARIADB_INCLUDE=([0-9]+)\.([0-9]+)\.([0-9]+)
DIUN_MARIADB_EXCLUDE=
# Guacamole
GUACAMOLE_VERSION=1.4.0
# Guacd
GUACD_VERSION=1.4.0
# MariaDB
MARIADB_VERSION=10.9.3
MARIADB_DATA=./data/mariadb
MARIADB_ROOT=
MARIADB_NAME=guacamole
MARIADB_USER=guacamole
MARIADB_PASS=

37
init.sh Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -e
WAIT_TIMEOUT=10
# Retrieve proper environment variables
GUACAMOLE_VERSION=$(cat .env | grep GUACAMOLE_VERSION | sed 's/GUACAMOLE_VERSION=//')
MARIADB_NAME=$(cat .env | grep MARIADB_NAME | sed 's/MARIADB_NAME=//')
# Pull the Guacamole image
docker pull guacamole/guacamole:"${GUACAMOLE_VERSION}"
# Generate initial database schema from Guacamole's image
docker run -it --rm \
guacamole/guacamole:"${GUACAMOLE_VERSION}" \
/opt/guacamole/bin/initdb.sh \
--mysql > initdb.sql
# Start the database instance
docker compose up -d mariadb
# Wait a couple of seconds that the database is ready
for I in $(eval echo "{$WAIT_TIMEOUT..1}"); do
printf " ${I}"
sleep 1
done
echo
# Initialize the database
docker compose exec \
--no-TTY -e MARIADB_NAME="${MARIADB_NAME}" mariadb \
sh -c 'exec mysql -uroot -p"$MARIADB_ROOT_PASSWORD" "$MARIADB_NAME"' < initdb.sql
# Remove the unnecessary database init file
rm -rf initdb.sql
# Stop & remove the database container for good measure
docker compose rm -fs mariadb

16
start.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
WAIT_TIMEOUT=5
# Start the database instance
docker compose up -d mariadb
# Wait a couple of seconds that the database is ready
for I in $(eval echo "{$WAIT_TIMEOUT..1}"); do
printf " ${I}"
sleep 1
done
echo
# Start the rest of the containers
docker compose up -d