diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad58591 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +data +config.yml diff --git a/config.yml.example b/config.yml.example new file mode 100644 index 0000000..1c3c520 --- /dev/null +++ b/config.yml.example @@ -0,0 +1,11 @@ +--- +listen: + address: 0.0.0.0 + port: 80 + +db: + host: mariadb + port: 3306 + username: yaskm + password: P4ssw0rd! + database: yaskm diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..109adf0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,43 @@ +--- +services: + yaskm: + image: ${YASKM_REGISTRY}/yaskm:${YASKM_VERSION} + restart: unless-stopped + labels: + - traefik.enable=${TRAEFIK_ENABLED} + - traefik.docker.network=${TRAEFIK_NETWORK} + ### Section HTTP + - traefik.http.routers.http-${TRAEFIK_ROUTER}.entrypoints=http + # redirect to HTTPS only + - traefik.http.routers.http-${TRAEFIK_ROUTER}.middlewares=http-to-https + - traefik.http.routers.http-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE} + ### Section HTTPS + - traefik.http.routers.https-${TRAEFIK_ROUTER}.entrypoints=https + # configure the exposed service + - traefik.http.routers.https-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE} + # of course, enable TLS and it's certificate provider + - traefik.http.routers.https-${TRAEFIK_ROUTER}.tls=${TRAEFIK_TLSENABLED} + - traefik.http.routers.https-${TRAEFIK_ROUTER}.tls.certresolver=${TRAEFIK_CERTRESOLVER} + # specify a service so a custom port can be used + - traefik.http.services.${TRAEFIK_SERVICE}.loadbalancer.server.port=${TRAEFIK_SERVICE_PORT} + networks: + - internal + - traefik + volumes: + - ./config.yml:/config.yml + mariadb: + image: docker.io/mariadb:${MARIADB_VERSION} + restart: unless-stopped + environment: + - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} + - MARIADB_USER=${MARIADB_USER} + - MARIADB_PASSWORD=${MARIADB_PASSWORD} + - MARIADB_DATABASE=${MARIADB_DATABASE} + volumes: + - ${MARIADB_DATA}:/var/lib/mysql + +networks: + internal: + traefik: + external: true + name: ${TRAEFIK_NETWORK} diff --git a/env.example b/env.example new file mode 100644 index 0000000..4e21801 --- /dev/null +++ b/env.example @@ -0,0 +1,21 @@ +# Træfik +TRAEFIK_ENABLED=true +TRAEFIK_CERTRESOLVER=letsencrypt +TRAEFIK_NETWORK=traefik +TRAEFIK_MATCHRULE=Host(`yaskm.example.com`) +TRAEFIK_ROUTER=yaksm_example_com +TRAEFIK_SERVICE=yaksm_example_com +TRAEFIK_SERVICE_PORT=80 +TRAEFIK_TLSENABLED=true + +# YAKSM +YASKM_REGISTRY=git.bjphoster.com/source +YASKM_VERSION=latest + +# MariaDB +MARIADB_VERSION=latest +MARIADB_DATA=./data +MARIADB_ROOT_PASSWORD=r00t +MARIADB_DATABASE=yaskm +MARIADB_USER=yaskm +MARIADB_PASSWORD=P4ssw0rd!