diff --git a/.gitignore b/.gitignore index 4c49bd7..c20027c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +# Try and prevent passwords: .env diff --git a/README.md b/README.md index 369fc3e..967d386 100644 --- a/README.md +++ b/README.md @@ -1 +1,22 @@ -# docker-compose-cookbooks +# Nick Yeoman's Collection of Docker compose files + +Checkout [https://www.nickyeoman.com/](https://www.nickyeoman.com/) to learn more. + +With the exception of traefik and portainer the process is pretty much the same. + +The idea is to run all these services off of one host and they are setup so +you can run multiple versions of any software just by changing the .env file + +The process is: + +1. cd ~/Git/docker-cookbooks/app-you-want-to-use +1. cp env-sample .env +1. vi .env + 1. PREFIX in .env should the project_name (for example nick_yeoman or ny) +1. docker-compose -p project_name up -d + +To create multiple projects is a little bit more tricky as you have to +define new directories for the .env file. + +To do this I've just been copying the app folder to a domain-name folder. +Which isn't ideal, but I don't know how to do this more elegantly. diff --git a/bookstack/ImportFromText.py b/bookstack/ImportFromText.py index 2b8bb0e..a4badf9 100644 --- a/bookstack/ImportFromText.py +++ b/bookstack/ImportFromText.py @@ -1,5 +1,6 @@ ################################################################################ # use like this: python3 run.py > test.sql +# TODO: you need to change the last comma to a semi colon for it to work in mysql ################################################################################ import os @@ -44,5 +45,3 @@ for filename in os.listdir(directory): continue else: continue - -# TODO: you need to change the last comma to a semi colon for it to work in mysql diff --git a/bookstack/docker-compose.yml b/bookstack/docker-compose.yml index 5b8ce0f..3019aee 100644 --- a/bookstack/docker-compose.yml +++ b/bookstack/docker-compose.yml @@ -1,11 +1,14 @@ ################################################################################ +# Bookstack # make sure you use the $PREFIX from .env for project_name # docker-compose -p project_name up -d # -# If you are importing directly using the db you have to do the following in the container: +# Importing directly to the db (phpmydadmin) +# you have to run the following in the container: # php artisan bookstack:regenerate-permissions +# +# Version 1 ################################################################################ - version: '2' volumes: @@ -16,41 +19,28 @@ volumes: networks: traefik_web: external: - name: traefik_web + name: ${NETWORK_NAME} services: bookstack-db: - image: mariadb:10.4.11 + image: mariadb:${DB_V} restart: always volumes: - bookstack-db:/var/lib/mysql networks: - - traefik_web + - ${NETWORK_NAME} environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_USER: bookstack MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_DATABASE: bookstack - # It's only exposed if someone knows the ip - bookstack-phpdb: - #https://hub.docker.com/r/phpmyadmin/phpmyadmin/tags - image: phpmyadmin/phpmyadmin:5.0 - environment: - - PMA_ARBITRARY=1 - external_links: - - bookstack-db - depends_on: - - bookstack-db - networks: - - traefik_web - # https://hub.docker.com/r/solidnerd/bookstack bookstack: - image: solidnerd/bookstack:0.29.0 + image: solidnerd/bookstack:${BOOKSTACK_V} depends_on: - - bookstack-db + - bookstack-db environment: - DB_HOST=${PREFIX}_bookstack-db_1:3306 - DB_DATABASE=bookstack @@ -58,7 +48,7 @@ services: - DB_PASSWORD=${MYSQL_PASSWORD} - APP_URL=https://${DOMAIN_NAME} networks: - - traefik_web + - ${NETWORK_NAME} volumes: - bookstack-uploads:/var/www/bookstack/public/uploads - bookstack-storage:/var/www/bookstack/storage/uploads diff --git a/bookstack/env-sample b/bookstack/env-sample index b44f89a..5fbdff2 100644 --- a/bookstack/env-sample +++ b/bookstack/env-sample @@ -1,4 +1,14 @@ +# Domains & Project +PREFIX=p1 +DOMAIN_NAME=bookstack.nickyeoman.com + +# Passwords MYSQL_ROOT_PASSWORD=ChangeMe2ASecurepass! MYSQL_PASSWORD=Again2ASecurepass! -DOMAIN_NAME=bookstack.nickyeoman.com -PREFIX=p1 + +# Software versions +DB_V=10.4.11 +BOOKSTACK_V=0.29.0 + +# Network +NETWORK_NAME=traefik_web diff --git a/docker-reset.bash b/docker-reset.bash new file mode 100644 index 0000000..98e38d0 --- /dev/null +++ b/docker-reset.bash @@ -0,0 +1,24 @@ +#!/bin/bash + +# Docker clean up guilde https://gist.github.com/bastman/5b57ddb3c11942094f8d0a97d461b430 + +# kill all containers +docker stop $(docker ps -aq) + +docker system prune + +#remove all containers +#docker rm $(docker ps -aq) + +#remove all images +#docker rmi $(docker images -q) + +#delete all volumnes +#docker volume rm $(docker volume ls -qf dangling=true) +#docker volume ls -qf dangling=true | xargs -r docker volume rm + +#remove all networks +docker network prune +#docker network ls +#docker network ls | grep "bridge" +#docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }') diff --git a/gitea/docker-compose.yml b/gitea/docker-compose.yml index e117d0b..67c9752 100644 --- a/gitea/docker-compose.yml +++ b/gitea/docker-compose.yml @@ -1,3 +1,14 @@ +################################################################################ +# Gitea +# make sure you use the $PREFIX from .env for project_name +# docker-compose -p project_name up -d +# +# Importing directly to the db (phpmydadmin) +# you have to run the following in the container: +# php artisan bookstack:regenerate-permissions +# +# Version 1 +################################################################################ version: '3.3' volumes: @@ -6,14 +17,15 @@ volumes: networks: traefik_web: external: - name: traefik_web + name: ${NETWORK_NAME} services: gitea: - image: gitea/gitea:latest - networks: - - traefik_web + # https://hub.docker.com/r/gitea/gitea + image: gitea/gitea:${GITEA_V} + networks: + - ${NETWORK_NAME} environment: - USER_UID=1000 - USER_GID=1000 @@ -23,11 +35,10 @@ services: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: - - "222:22" + - "${GITEA_PORT}:22" labels: - "traefik.enable=true" - - "traefik.http.routers.gitea.rule=Host(`gitea.nickyeoman.com`)" - - "traefik.http.routers.gitea.entrypoints=websecure" - - "traefik.http.routers.gitea.tls=true" - - "traefik.http.services.gite.loadbalancer.server.port=3000" - + - "traefik.http.routers.${PREFIX}_gitea.rule=Host(`${DOMAIN_NAME}`)" + - "traefik.http.routers.${PREFIX}_gitea.entrypoints=websecure" + - "traefik.http.routers.${PREFIX}_gitea.tls=true" + - "traefik.http.services.${PREFIX}_gitea.loadbalancer.server.port=3000" diff --git a/gitea/env-sample b/gitea/env-sample new file mode 100644 index 0000000..3affd57 --- /dev/null +++ b/gitea/env-sample @@ -0,0 +1,10 @@ +# Domains & Project +PREFIX=p1 +DOMAIN_NAME=gitea.nickyeoman.com + +# Software versions +GITEA_V=1.11.4 +GITEA_PORT=22 + +# Network +NETWORK_NAME=traefik_web diff --git a/joomla/docker-compose.yml b/joomla/docker-compose.yml index bacbb5e..6354442 100644 --- a/joomla/docker-compose.yml +++ b/joomla/docker-compose.yml @@ -1,7 +1,10 @@ ################################################################################ +# Joomla # Update the .env file # make sure you use the $PREFIX from .env for project_name # docker-compose -p project_name up -d +# +# Version 1 ################################################################################ version: '3.3' @@ -12,17 +15,17 @@ volumes: networks: traefik_web: external: - name: traefik_web + name: ${NETWORK_NAME} services: mariadb: - image: mariadb:10.4.11 + image: mariadb:${JOOMLADB_V} restart: always volumes: - mariadb:/var/lib/mysql networks: - - traefik_web + - ${NETWORK_NAME} environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_USER: joomla @@ -30,12 +33,12 @@ services: MYSQL_DATABASE: joomla joomla: - image: joomla:3.9.16-apache + image: joomla:${JOOMLA_V} restart: always links: - ${PREFIX}_mariadb_1 networks: - - traefik_web + - ${NETWORK_NAME} volumes: - joomla:/var/www/html labels: diff --git a/joomla/env-sample b/joomla/env-sample index 6aedd1a..3e4d37c 100644 --- a/joomla/env-sample +++ b/joomla/env-sample @@ -1,5 +1,14 @@ -# Rename this file to .env +# Domains & Project +PREFIX=p1 DOMAIN_NAME=joomla.nickyeoman.com -PREFIX=project_name + +# PASSWORDS MYSQL_PASSWORD=MyNotSecurePassword1234 MYSQL_ROOT_PASSWORD=AlsoNotSecure + +# Software versions +JOOMLA_V=3.9.16-apache +JOOMLADB_V=10.4.11 + +# Network +NETWORK_NAME=traefik_web diff --git a/nextcloud/docker-compose.yml b/nextcloud/docker-compose.yml index 574c035..96d55c1 100644 --- a/nextcloud/docker-compose.yml +++ b/nextcloud/docker-compose.yml @@ -1,3 +1,10 @@ +################################################################################ +# Nextcloud +# make sure you use the $PREFIX from .env for project_name +# docker-compose -p project_name up -d +# +# Version 1 +################################################################################ version: '3.3' volumes: @@ -9,17 +16,17 @@ volumes: networks: traefik_web: external: - name: traefik_web + name: ${NETWORK_NAME} services: mariadb: - image: mariadb:10.4.11 + image: mariadb:${DB_V} restart: always volumes: - mariadb:/var/lib/mysql networks: - - traefik_web + - ${NETWORK_NAME} environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_USER: nextcloud @@ -27,21 +34,21 @@ services: MYSQL_DATABASE: nextcloud nextcloud: - image: nextcloud:18.0.3-apache + image: nextcloud:${NEXTCLOUD_V} stdin_open: true tty: true networks: - - traefik_web + - ${NETWORK_NAME} restart: always depends_on: - - mariadb + - ${PREFIX}_mariadb_1 links: - - mariadb + - ${PREFIX}_mariadb_1 volumes: - nextcloud:/var/www/html labels: - "traefik.enable=true" - - "traefik.http.routers.nextcloud.rule=Host(`${DOMAIN_NAME}`)" - - "traefik.http.routers.nextcloud.entrypoints=websecure" - - "traefik.http.routers.nextcloud.tls=true" - - "traefik.http.services.nextcloud.loadbalancer.server.port=80" + - "traefik.http.routers.${PREFIX}_nextcloud.rule=Host(`${DOMAIN_NAME}`)" + - "traefik.http.routers.${PREFIX}_nextcloud.entrypoints=websecure" + - "traefik.http.routers.${PREFIX}_nextcloud.tls=true" + - "traefik.http.services.${PREFIX}_nextcloud.loadbalancer.server.port=80" diff --git a/nextcloud/env-sample b/nextcloud/env-sample index b03d604..a9fffad 100644 --- a/nextcloud/env-sample +++ b/nextcloud/env-sample @@ -1,4 +1,15 @@ -# Rename this file to .env +# Domains & Project +PREFIX=p1 DOMAIN_NAME=nextcloud.nickyeoman.com -MYSQL_PASSWORD=MyNotSecurePassword1234 -MYSQL_ROOT_PASSWORD=AlsoNotSecure +PHPDB_DOMAIN_NAME=bookstack-db.nickyeoman.com + +# Passwords +MYSQL_ROOT_PASSWORD=ChangeMe2ASecurepass! +MYSQL_PASSWORD=Again2ASecurepass! + +# Software versions +DB_V=10.4.11 +NEXTCLOUD_V=18.0.3-apache + +# Network +NETWORK_NAME=traefik_web diff --git a/passbolt/docker-compose.yml b/passbolt/docker-compose.yml index e41ee25..aed3c56 100644 --- a/passbolt/docker-compose.yml +++ b/passbolt/docker-compose.yml @@ -1,57 +1,60 @@ +################################################################################ +# Passbolt +# make sure you use the $PREFIX from .env for project_name +# docker-compose -p project_name up -d +# +# Version 1 +################################################################################ version: '3.3' volumes: pb-mariadb: - pb-gpg_volume: - pb-images_volume: + pb-gpg: + pb-images: networks: traefik_web: external: - name: traefik_web + name: ${NETWORK_NAME} services: pb-mariadb: - image: mariadb:10.4.11 - container_name: pb-mariadb - hostname: pb-mariadb + image: mariadb:${DB_V} restart: always volumes: - pb-mariadb:/var/lib/mysql networks: - - traefik_web + - ${NETWORK_NAME} environment: - MYSQL_ROOT_PASSWORD: thasdfisIsRoot29837! - MYSQL_PASSWORD: p@ssblt!!1NOW - MYSQL_DATABASE: db_passbolt + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_PASSWORD: ${MYSQL_PASSWORD} + MYSQL_DATABASE: passbolt MYSQL_USER: passbolt # https://help.passbolt.com/hosting/install/ce/docker.html # once it's running you will have to manually create your first user: # as www-data user: ./cake passbolt register_user -u -f -l -r admin passbolt: - image: passbolt/passbolt:2.12.0-debian - container_name: pb-passbolt - hostname: passbolt + image: passbolt/passbolt:${PASSBOLT_V} networks: - - traefik_web + - ${NETWORK_NAME} restart: always tty: true tmpfs: - /run depends_on: - - pb-mariadb + - ${PREFIX}_pb-mariadb_1 env_file: - passbolt.env - command: ["/usr/bin/wait-for.sh", "-t", "0", "pb-mariadb:3306", "--", "/docker-entrypoint.sh"] + command: ["/usr/bin/wait-for.sh", "-t", "0", "${PREFIX}_pb-mariadb_1:3306", "--", "/docker-entrypoint.sh"] volumes: - - pb-gpg_volume:/var/www/passbolt/config/gpg - - pb-images_volume:/var/www/passbolt/webroot/img/public + - pb-gpg:/var/www/passbolt/config/gpg + - pb-images:/var/www/passbolt/webroot/img/public - ./license:/var/www/passbolt/config/license labels: - "traefik.enable=true" - - "traefik.http.routers.passbolt.rule=Host(`passbolt.nickyeoman.com`)" - - "traefik.http.routers.passbolt.entrypoints=websecure" - - "traefik.http.routers.passbolt.tls=true" - - "traefik.http.services.passbolt.loadbalancer.server.port=80" + - "traefik.http.routers.${PREFIX}_passbolt.rule=Host(`${DOMAIN_NAME}`)" + - "traefik.http.routers.${PREFIX}_passbolt.entrypoints=websecure" + - "traefik.http.routers.${PREFIX}_passbolt.tls=true" + - "traefik.http.services.${PREFIX}_passbolt.loadbalancer.server.port=80" diff --git a/passbolt/env-sample b/passbolt/env-sample new file mode 100644 index 0000000..9065630 --- /dev/null +++ b/passbolt/env-sample @@ -0,0 +1,14 @@ +# Domains & Project +PREFIX=p1 +DOMAIN_NAME=passbolt.nickyeoman.com + +# Passwords +MYSQL_ROOT_PASSWORD=ChangeMe2ASecurepass! +MYSQL_PASSWORD=Again2ASecurepass! + +# Software versions +DB_V=10.4.11 +PASSBOLT_V=2.12.0-debian + +# Network +NETWORK_NAME=traefik_web diff --git a/passbolt/passbolt.env b/passbolt/passbolt.env index e26cf6e..2aabdbc 100644 --- a/passbolt/passbolt.env +++ b/passbolt/passbolt.env @@ -1,3 +1,5 @@ +#TODO: I'm not sure if this is still in use or has been implemented, test further. + # URL APP_FULL_BASE_URL=https://passbolt.nickyeoman.com diff --git a/phpmyadmin/docker-compose.yml b/phpmyadmin/docker-compose.yml new file mode 100644 index 0000000..7cbbf1d --- /dev/null +++ b/phpmyadmin/docker-compose.yml @@ -0,0 +1,31 @@ +################################################################################ +# phpmyadmin +# make sure you use the $PREFIX from .env for project_name +# docker-compose -p project_name up -d +# +# Version 1 +################################################################################ +version: '2' + +networks: + traefik_web: + external: + name: ${NETWORK_NAME} + +services: + + # It's only exposed if someone knows the ip + phpmyadmin: + #https://hub.docker.com/r/phpmyadmin/phpmyadmin/tags + image: phpmyadmin/phpmyadmin:${PHPMYADMIN_V} + environment: + - PMA_ARBITRARY=1 + restart: unless-stopped + networks: + - ${NETWORK_NAME} + labels: + - "traefik.enable=true" + - "traefik.http.routers.${PREFIX}_phpmyadmin.rule=Host(`${DOMAIN_NAME}`)" + - "traefik.http.routers.${PREFIX}_phpmyadmin.entrypoints=websecure" + - "traefik.http.routers.${PREFIX}_phpmyadmin.tls=true" + - "traefik.http.services.${PREFIX}_phpmyadmin.loadbalancer.server.port=80" diff --git a/phpmyadmin/env-sample b/phpmyadmin/env-sample new file mode 100644 index 0000000..3c84bce --- /dev/null +++ b/phpmyadmin/env-sample @@ -0,0 +1,9 @@ +# Domains & Project +PREFIX=p1 +DOMAIN_NAME=phpmyadmin.nickyeoman.com + +# Software versions +PHPMYADMIN_V=5.0 + +# Network +NETWORK_NAME=traefik_web diff --git a/portainer/docker-compose.yml b/portainer/docker-compose.yml index dda5a5b..663dda5 100644 --- a/portainer/docker-compose.yml +++ b/portainer/docker-compose.yml @@ -1,3 +1,12 @@ +################################################################################ +# Portainer +# You should only need one instance of this running +# Change .env then +# docker-compose up -d +# +# Version 1 +################################################################################ + version: '3.3' volumes: @@ -6,25 +15,26 @@ volumes: networks: traefik_web: external: - name: traefik_web + name: ${NETWORK_NAME} services: portainer: - image: portainer/portainer + # https://hub.docker.com/r/portainer/portainer + image: portainer/portainer:${PORTAINER_V} container_name: portainer hostname: portainer command: -H unix:///var/run/docker.sock - restart: always + restart: unless-stopped networks: - - traefik_web + - ${NETWORK_NAME} volumes: - /var/run/docker.sock:/var/run/docker.sock - portainer:/data command: -H unix:///var/run/docker.sock labels: - "traefik.enable=true" - - "traefik.http.routers.portainer.rule=Host(`portainer.nickyeoman.com`)" + - "traefik.http.routers.portainer.rule=Host(`${DOMAIN_NAME}`)" - "traefik.http.routers.portainer.entrypoints=websecure" - "traefik.http.routers.portainer.tls=true" - "traefik.http.services.portainer.loadbalancer.server.port=9000" diff --git a/portainer/env-sample b/portainer/env-sample new file mode 100644 index 0000000..49a8ea9 --- /dev/null +++ b/portainer/env-sample @@ -0,0 +1,8 @@ +# Domains & Project +DOMAIN_NAME=passbolt.nickyeoman.com + +# Software versions +PORTAINER_V=1.23.2 + +# Network +NETWORK_NAME=traefik_web diff --git a/rocketchat/docker-compose.yml b/rocketchat/docker-compose.yml index 9a563e4..5e81a56 100644 --- a/rocketchat/docker-compose.yml +++ b/rocketchat/docker-compose.yml @@ -1,13 +1,16 @@ +############################################################################### +# Rocket Chat # Update the .env file # make sure you use the $PREFIX from .env for project_name # docker-compose -p project_name up -d +############################################################################### version: '2' networks: traefik_web: external: - name: traefik_web + name: ${NETWORK_NAME} volumes: rocketchat: @@ -16,8 +19,10 @@ volumes: rocketchat-scripts: services: + rocketchat: - image: rocketchat/rocket.chat:latest + # https://hub.docker.com/r/rocketchat/rocket.chat + image: rocketchat/rocket.chat:${ROCKETCHAT_V} command: > bash -c "for i in `seq 1 30`; do @@ -30,17 +35,17 @@ services: volumes: - rocketchat:/app/uploads networks: - - traefik_web + - ${NETWORK_NAME} environment: - PORT=3000 - - ROOT_URL=http://chat.nickyeoman.com - - MONGO_URL=mongodb://mongo:27017/rocketchat - - MONGO_OPLOG_URL=mongodb://mongo:27017/local + - ROOT_URL=https://${DOMAIN_NAME} + - MONGO_URL=mongodb://${PREFIX}_rc-db_1:27017/rocketchat + - MONGO_OPLOG_URL=mongodb://${PREFIX}_rc-db_1:27017/local - MAIL_URL=smtp://smtp.email # - HTTP_PROXY=http://proxy.domain.com # - HTTPS_PROXY=http://proxy.domain.com depends_on: - - mongo + - rc-db ports: - 3000:3000 labels: @@ -50,14 +55,14 @@ services: - "traefik.http.routers.${PREFIX}_chat.tls=true" - "traefik.http.services.${PREFIX}_chat.loadbalancer.server.port=3000" - mongo: + rc-db: image: mongo:4.0 restart: unless-stopped volumes: - rocketchat-db:/data/db #- ./data/dump:/dump networks: - - traefik_web + - ${NETWORK_NAME} command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1 labels: - "traefik.enable=false" @@ -78,9 +83,9 @@ services: sleep 5; done; (exit $$s)" depends_on: - - mongo + - ${PREFIX}_rc-db_1 networks: - - traefik_web + - ${NETWORK_NAME} # hubot, the popular chatbot (add the bot user first and change the password before starting this image) hubot: @@ -101,7 +106,7 @@ services: volumes: - rocketchat-scripts:/home/hubot/scripts networks: - - traefik_web + - ${NETWORK_NAME} # this is used to expose the hubot port for notifications on the host on port 3001, e.g. for hubot-jenkins-notifier ports: - 3001:8080 diff --git a/rocketchat/env-sample b/rocketchat/env-sample index 6aedd1a..e963d92 100644 --- a/rocketchat/env-sample +++ b/rocketchat/env-sample @@ -1,5 +1,13 @@ -# Rename this file to .env +# Domains & Project +PREFIX=p1 DOMAIN_NAME=joomla.nickyeoman.com -PREFIX=project_name + +# Passwords MYSQL_PASSWORD=MyNotSecurePassword1234 MYSQL_ROOT_PASSWORD=AlsoNotSecure + +# Software versions +ROCKETCHAT_V=3.1.1 + +# Network +NETWORK_NAME=traefik_web diff --git a/stashapp/config b/stashapp/config new file mode 100644 index 0000000..cd4d08f --- /dev/null +++ b/stashapp/config @@ -0,0 +1 @@ +#not sure what to put here diff --git a/stashapp/docker-compose.yml b/stashapp/docker-compose.yml new file mode 100644 index 0000000..33e929e --- /dev/null +++ b/stashapp/docker-compose.yml @@ -0,0 +1,57 @@ +################################################################################ +# Stash +# make sure you use the $PREFIX from .env for project_name +# docker-compose -p project_name up -d +# +# Version 1 +################################################################################ +version: '3.4' + +volumes: + stash: + stash-metadata: + stash-cache: + stash-generated: + +networks: + traefik_web: + external: + name: ${NETWORK_NAME} + +services: + stash: + # https://hub.docker.com/r/stashapp/stash + image: stashapp/stash:latest + restart: unless-stopped + logging: + driver: "json-file" + options: + max-file: "10" + max-size: "2m" + environment: + - STASH_STASH=/data/ + - STASH_GENERATED=/generated/ + - STASH_METADATA=/metadata/ + - STASH_CACHE=/cache/ + networks: + - ${NETWORK_NAME} + volumes: + - /etc/localtime:/etc/localtime:ro + ## Adjust below paths (the left part) to your liking. + ## E.g. you can change ./config:/root/.stash to ./stash:/root/.stash + ## Keep configs here. + #- ./config:/root/.stash + ## Point this at your collection. + - stash:/data + ## This is where your stash's metadata lives + - stash-metadata:/metadata + ## Any other cache content. + - stash-cache:/cache + ## Where to store generated content (screenshots,previews,transcodes,sprites) + - stash-generated:/generated + labels: + - "traefik.enable=true" + - "traefik.http.routers.${PREFIX}_stash.rule=Host(`${DOMAIN_NAME}`)" + - "traefik.http.routers.${PREFIX}_stash.entrypoints=websecure" + - "traefik.http.routers.${PREFIX}_stash.tls=true" + - "traefik.http.services.${PREFIX}_stash.loadbalancer.server.port=9999" diff --git a/stashapp/env-sample b/stashapp/env-sample new file mode 100644 index 0000000..ce2a2f9 --- /dev/null +++ b/stashapp/env-sample @@ -0,0 +1,6 @@ +# Domain and project +DOMAIN_NAME=stash.nickyeoman.com +PREFIX=p1 + +# Network +NETWORK_NAME=traefik_web diff --git a/traefik/docker-compose.yml b/traefik/docker-compose.yml index e88cf3a..18b2243 100644 --- a/traefik/docker-compose.yml +++ b/traefik/docker-compose.yml @@ -1,17 +1,21 @@ ############################################################################### +# Traefik +# +# Should only need one instance of this. +# Make sure the .env file is updated # docker-compose up -d ############################################################################### - version: '3.3' networks: - web: + ${NETWORK_NAME}: driver: bridge services: traefik: - image: "traefik:v2.1.3" + # https://hub.docker.com/_/traefik + image: "traefik:${TRAEFIK_V}" container_name: "traefik" restart: unless-stopped command: @@ -25,17 +29,15 @@ services: volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" networks: - - web + - ${NETWORK_NAME} labels: # Dashboard - - "traefik.http.routers.traefik.rule=Host(`proxy.nickyeoman.com`)" + - "traefik.http.routers.traefik.rule=Host(`${DOMAIN_NAME}`)" - "traefik.http.routers.traefik.service=api@internal" - "traefik.http.routers.traefik.tls.certresolver=leresolver" - "traefik.http.routers.traefik.entrypoints=websecure" - "traefik.http.routers.traefik.middlewares=authtraefik" - # https://medium.com/@techupbusiness/add-basic-authentication-in-docker-compose-files-with-traefik-34c781234970 - # echo $(htpasswd -nbB "") | sed -e s/\\$/\\$\\$/g - - "traefik.http.middlewares.authtraefik.basicauth.users=nick:encryptedpasswordgoeshere" + - "traefik.http.middlewares.authtraefik.basicauth.users=${TRAEFIK_USER}:${TRAEFIK_PASS}" # global redirect to https - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)" - "traefik.http.routers.http-catchall.entrypoints=web" diff --git a/traefik/env-sample b/traefik/env-sample new file mode 100644 index 0000000..dfdbbe4 --- /dev/null +++ b/traefik/env-sample @@ -0,0 +1,16 @@ +# Domains & Project +PREFIX=p1 +DOMAIN_NAME=traefik.nickyeoman.com + +# Passwords +# https://medium.com/@techupbusiness/add-basic-authentication-in-docker-compose-files-with-traefik-34c781234970 +# echo $(htpasswd -nbB "") | sed -e s/\\$/\\$\\$/g +TRAEFIK_USER=username +TRAEFIK_PASS=M@keASecureOne + +# Software versions +# https://hub.docker.com/_/traefik +TRAEFIK_V=2.2.0 + +# Network +NETWORK_NAME=traefik_web diff --git a/yourls/docker-compose.yml b/yourls/docker-compose.yml new file mode 100644 index 0000000..69f8c43 --- /dev/null +++ b/yourls/docker-compose.yml @@ -0,0 +1,57 @@ +################################################################################ +# yourls +# make sure you use the $PREFIX from .env for project_name +# docker-compose -p project_name up -d +# +# +# Version 1 +################################################################################ +version: '3.1' + +volumes: + yourls: + yourls-db: + +networks: + traefik_web: + external: + name: ${NETWORK_NAME} + +services: + + yourls-db: + # https://hub.docker.com/_/mariadb/ + image: mariadb:${DB_V} + restart: always + volumes: + - yourls-mariadb:/var/lib/mysql + networks: + - ${NETWORK_NAME} + environment: + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_PASSWORD: ${MYSQL_PASSWORD} + MYSQL_DATABASE: yourls + MYSQL_USER: yourls + + yourls: + # reference: https://github.com/matomo-org/docker/blob/master/.examples/docker-compose.yml + image: yourls + restart: always + volumes: + - yourls:/var/www/html + networks: + - ${NETWORK_NAME} + environment: + YOURLS_DB_HOST: ${PREFIX}_yourls-db_1 + YOURLS_DB_USER: yourls + YOURLS_DB_PASS: ${MYSQL_PASSWORD} + YOURLS_DB_NAME: yourls + YOURLS_SITE: https://${DOMAIN_NAME} + YOURLS_USER: ${YOURLS_USER} + YOURLS_PASS: ${YOURLS_PASS} + labels: + - "traefik.enable=true" + - "traefik.http.routers.${PREFIX}_yourls.rule=Host(`${DOMAIN_NAME}`)" + - "traefik.http.routers.${PREFIX}_yourls.entrypoints=websecure" + - "traefik.http.routers.${PREFIX}_yourls.tls=true" + - "traefik.http.services.${PREFIX}_yourls.loadbalancer.server.port=80" diff --git a/yourls/env-sample b/yourls/env-sample new file mode 100644 index 0000000..c561a29 --- /dev/null +++ b/yourls/env-sample @@ -0,0 +1,15 @@ +# Domains & Project +PREFIX=p1 +DOMAIN_NAME=yourls.nickyeoman.com + +# Passwords +MYSQL_ROOT_PASSWORD=ChangeMe2ASecurepass! +MYSQL_PASSWORD=Again2ASecurepass! +YOURLS_USER=username +YOURLS_PASS=Password4urls + +# Software versions +DB_V=10.4.11 + +# Network +NETWORK_NAME=traefik_web