Coder Social home page Coder Social logo

julienhmmt / docker-compose Goto Github PK

View Code? Open in Web Editor NEW
132.0 9.0 74.0 367 KB

Some examples of docker-compose stacks used at home and at work...

Home Page: https://j.hommet.net

VCL 100.00%
traefik traefik-v2 pihole nginx nginx-php-fpm wordpress portainer prometheus grafana nextcloud

docker-compose's Introduction

docker compose stack examples, for Traefik

This is some examples used at home on my homelab. Many stacks are production-ready and daily used. Folders got a Traefik dynamic configuration, with a docker socket proxy. There are many tweaks to provide a ready-to-use environment.

Configurations provided are tested on a private environment (QEMU and VirtualBox). Maybe in few months I'll test it on GCP, Azure or AWS (if there's free month subscription).

🏭 Requirements

  • linux host (tested successfully on Ubuntu 20.04 && 22.04 & 22.04, Debian 10 & 11)
  • docker >= 23.x
  • docker compose (plugin) >= 2.17

What you'll find

Some usefull applications, used on homelab.

All scripts are "as it", and can be updated without consent.

🚀 How to use

Clone this repo where you want with this line :

# git clone https://github.com/Mettmett/docker-compose.git:folder-name
e.q. : git clone https://github.com/Mettmett/docker-compose.git:traefik-ghost-sql

You need to edit the file .env at the source folder to modify the values of some vars.

After that when you're all set, press the red button to initiate 🔥 !

docker compose pull && docker compose up -d && docker compose logs -f

⭐ Author

Made by Julien HOMMET 🇫🇷 for my personal purposes - This is my homelab

🔧 Support & Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

💰 Licence

CC BY-NC-SA

⚓ Misc

docker-compose's People

Contributors

a10kiloham avatar julienhmmt avatar t3cneo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-compose's Issues

Using env variables

Would you consider a pull request to use env variables in the docker compose instead of hard-coded values?

docker-compose:pihole-traefik

Bonjour Mettmett,

merci pour vos nombreux modèles de configurations. Je m'interresse de près à celui permettant à traefik de router le traffic dns et page admin de pihole.

Sur mon navigateur quand je vais sur http://home:8080 - j'ai le dashboard de Traefik.
Neanmoins, quand je vais sur http://home/pihole ou http://home/traefik > rien !

Voici mon docker-compose.yml pour Traefik:

version: '3'
services:
  traefik:
    image: traefik:v2.4
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
      - 8080:8080
      - 1194:1194/udp
      - 1195:1195
      - 53:53/udp
      - 53:53
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data/traefik.yml:/traefik.yml:ro
      - ./data/acme.json:/acme.json
      - ./data/dynamic:/etc/traefik/dynamic:ro
      - /var/log:/var/log
    environment:
      - "TZ=Europe/Paris" #ajout d'une variable de TimeZone

networks:
  proxy:
    external: true

traefik.yml:

api:
  insecure: true

entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"
  openvpn:
    address: ":1194/udp"
  metrics:
    address: ":1195"
  udpdns:
    address: ":53/udp"
 
#grafana
metrics:
  prometheus:
    entryPoint: metrics
    buckets:
      - 0.1
      - 0.3
      - 1.2
      - 5.0
    addEntryPointsLabels: true
    addServicesLabels: true
#grafana
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
  file:
    directory: /etc/traefik/dynamic/
    watch: true

certificatesResolvers:
  http:
    acme:
      email: [email protected]
      storage: acme.json
      httpChallenge:
        entryPoint: http


accessLog:
  filePath: "/var/log/traefik/access.log"
  fields:
    defaultMode: keep
    names:
      StartUTC: drop
    headers:
      defaultMode: keep

mon services.yml :

http:
    services:
        sc-pihole:
           loadBalancer:
               servers:
                   - url: "http://192.168.1.253:80"

udp:
  services:
    sc-pihole-udp:
      loadBalancer:
        servers:
          - address: "udp://192.168.1.253:53"`

routers.yml:

http:
  `routers:
    rt-traefik:
      entryPoints:
        - http
      service: dashboard@internal
      rule: PathPrefix(`/traefik`)

    rt-pihole:
      entryPoints:
        - http
      service: sc-pihole
      rule: PathPrefix(`/pihole`)
udp:
  routers:
    udp-pihole:
      entryPoints:
        - udpdns
      service: sc-pihole-udp

Est ce que vous pourriez m'aider s'il vous plait ?

Getting 404 and errors in traefik.log

I'm trying to get it running on a fresh Ubuntu 20.04 install but something doesn't work here.
The certifcate is pulled as it should but when I try to visit the nextcloud installation I get a 404 page not found error and these mesages in the traefik.log

time="2020-12-15T10:12:44Z" level=warning msg="Failed to inspect container 1a25f503516215d02b01557752b16010b48e221607675f803a2d34103191fc68, error: error during connect: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/1a25f503516215d02b01557752b16010b48e221607675f803a2d34103191fc68/json\": context canceled" providerName=docker time="2020-12-15T10:12:44Z" level=warning msg="Failed to inspect container a4e4325be058ea3f2889c04a7bb9dadd31fc2c20c840544e09efc1294e526e9e, error: error during connect: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/a4e4325be058ea3f2889c04a7bb9dadd31fc2c20c840544e09efc1294e526e9e/json\": context canceled" providerName=docker time="2020-12-15T10:12:44Z" level=error msg="Cannot connect to docker server context canceled" providerName=docker

I attached the docker-compose.yml I use :

`---
version: '3.6'
services:
traefik:
image: traefik:${TRAEFIKVERSION}
restart: unless-stopped
ports:
- 80:80
- 443:443
- 8080:8080 # used to have the traefik dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./conf/traefik.yml:/etc/traefik/traefik.yml:ro
- ./conf/traefikdynamic:/traefikdynamic:ro
- ./logs/traefik.log:/etc/traefik/applog.log
- ./conf/acme.json:/acme.json

nginxnextcloud:
image: nginx:${NGINXVERSION}
restart: unless-stopped
container_name: nginxnextcloud
volumes:
- datanextcloud:/var/www/html
- datanginxnextcloudlogs:/var/log/nginx
- ./conf/nginx-nextcloud:/etc/nginx
labels:
traefik.enable: true
traefik.http.routers.nginxnextcloud-https.entrypoints: "websecure"
traefik.http.routers.nginxnextcloud-https.rule: "Host(cloud.server.domain)"
traefik.http.routers.nginxnextcloud-https.middlewares: "security@file, compression@file"
traefik.http.routers.nginxnextcloud-https.tls: "true"
traefik.http.routers.nginxnextcloud-https.tls.certresolver: "letsencrypt"

nextcloud:
image: nextcloud:${NEXTCLOUDVERSION}
restart: unless-stopped
container_name: nextcloudfpm
volumes:
- /opt/nextcloud/data:/var/www/html
environment:
MYSQL_HOST: sqlnextcloud
MYSQL_USER: ${MYSQLUSER}
MYSQL_PASSWORD: ${MYSQLPASSWORD}
MYSQL_DATABASE: ${MYSQLDB}
REDIS_HOST: redisnextcloud
links:
- mariadb
labels:
traefik.enable: false

mariadb:
image: mariadb:${MARIADBVERSION}
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: unless-stopped
container_name: sqlnextcloud
volumes:
- datadbnextcloud:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: '1'
MYSQL_USER: ${MYSQLUSER}
MYSQL_PASSWORD: ${MYSQLPASSWORD}
MYSQL_DATABASE: ${MYSQLDB}
labels:
traefik.enable: false

redis:
image: redis:${REDISVERSION}
restart: unless-stopped
volumes:
- dataredisnextcloud:/data
labels:
traefik.enable: false

volumes:
datanextcloud:
datadbnextcloud:
datanginxnextcloudlogs:
dataredisnextcloud:`

Router issue

First thanks for sharing this!
Trying with all your defaults I get this error from my Traefik container and my domain responds with a 404. Docker working just fine as I have plenty of other things running. No other errors notable when I run docker-compose...

Cheers

time="2020-04-23T11:00:38Z" level=info msg="Configuration loaded from file: /etc/traefik/traefik.toml"
time="2020-04-23T11:00:41Z" level=error msg="the service \"nginx@docker\" does not exist" routerName=nginxwp-https@docker entryPointName=websecure
time="2020-04-23T11:00:52Z" level=error msg="the service \"nginx@docker\" does not exist" entryPointName=websecure routerName=nginxwp-https@docker
time="2020-04-23T11:01:17Z" level=error msg="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
time="2020-04-23T11:01:17Z" level=error msg="accept tcp [::]:80: use of closed network connection" entryPointName=web
time="2020-04-23T11:01:17Z" level=error msg="close tcp [::]:8080: use of closed network connection" entryPointName=traefik
time="2020-04-23T11:01:17Z" level=error msg="close tcp [::]:80: use of closed network connection" entryPointName=web
time="2020-04-23T11:01:17Z" level=error msg="accept tcp [::]:8080: use of closed network connection" entryPointName=traefik
time="2020-04-23T11:01:17Z" level=error msg="close tcp [::]:443: use of closed network connection" entryPointName=websecure
time="2020-04-23T11:01:17Z" level=error msg="Failed to list containers for docker, error error during connect: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?limit=0\": context canceled" providerName=docker
time="2020-04-23T11:10:05Z" level=info msg="Configuration loaded from file: /etc/traefik/traefik.toml"
time="2020-04-23T11:10:10Z" level=error msg="the service \"nginx@docker\" does not exist" routerName=nginxwp-https@docker entryPointName=websecure

load cannot follow more than 20 redirections

worpress version with ssl with Cloudflare and without it didn't work! also change the wp.conf just for testing but no success! just to make sure I manager to change docker-compose file host too when using cloud flare not loading and without 404 page and ssl cert not working as I did too using Cloudflare with flexible ssl but no success at all

Make Traefik independant

--- English will follow ---

Salut Julien,

Quel merveilleux travail... tu as dans ce dossier énormément de choses j'aimerai monter sur mon serveur dédié (Matomo/Nextcloud/multiple Wordpress/Grafana+Prometheus)
J'avoue que j'ai perdu les pédales au passage à Traefik 2, je suis complètement OUT.
J'ai essayé tant bien que mal de lancer Traefik dans un docker-compose séparé pour ensuite pouvoir lancer les différent services au besoin.. mais je n'y arrive pas.

Pourrais-tu m'aider ?
Mille mercis

---- English version ----

Hi Julian,

What a wonderful job ... you have a lot of things in this folder I would like to mount on my dedicated server (Matomo / Nextcloud / multiple Wordpress / Grafana + Prometheus)
I admit that I'm totally totally OUT since I switched to Traefik 2.
I tried somehow to launch Traefik in a separate docker-compose to then be able to launch the different services as needed .. but I can't.

Could you help me ?
Many thanks

traefik-prometheus-grafana

Bonjour

Merci d'abord pour tout vos exemple pour mieux comprendre le système de docker ;)

Voilà, j'ai pris et lancer la config pour utiliser grafana, mais on dirai qu'il y a un problème avec cadvisor.

D'abord, docker détecte que cadvisor est en healthy et dans les logs de cadvisor sur portainer, on voit qui arrive pas a se connecter " Could not configure a source for OOM detection, disabling OOM events /dev/kmsg"

donc sur la toile j'ai trouver qu'on devait faire un devices: - /dev/kmsg:/dev/kmsg

mais maintenant le message s'affiche sur le log : No log line matching the '' filter

et j'ai toujours le healthy

Y a t-il une erreur dans votre config ?

Merci d'avance.

nextcloud webdav not working

When deploying the nextcloud/nginx/redis/mariadb everything seems to work except that the files are not showing up in the nextcloud web interface. After some investigation it seems that the webdav PROPFIND methods are somehow blocked (I'm getting a 405 error on my browser).
There are nothing in the logs (both nginx and nextcloud) related to this error

docker-compose/traefik-nginx-wordpress-sql-redis/

I know this is in English, but thank you so much for your docker-compose files. So many great projects. I have used your /traefik-nginx-wordpress-sql-redis/ in the past on a smaller project and found it so clean and should be the fastest wordpress stack on in the docker world. I am just having issues initially when I docker exec it (container id) /bin/bash into the redis container I couldn't access the redis-cli. So digging around a bit I read some traefik documentation https://doc.traefik.io/traefik/providers/redis/ trying to put the right the right information in the traefik.yml you nicely provided. After some trial and error I was getting errors. I decided to remove that option and just spin up your docker-compose files and when I logged into the wp-admin to enable the redis cache plugin it wouldn't connect, so I docker exec into the wp container and edited the wp_config.php with

define( 'WP_REDIS_HOST', 'redis' );
define( 'WP_REDIS_PORT', 6379 );

I somehow couldn't get it to connect after restarting and re-loading the redis cache plugin. I will use this stack for a small project just omiting the redis docker container. I am just wondering if you were able to get the full stack working with all components and Redis. I mihght be doing something wrong but realize you have the cleanest, most organized docker compose stack for these containers and would love to be able to get this to work.

Thanks again for your work.
Cheers,
Mike

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.