From 58b328b9ea17803efafbdd599a8932e044814f3c Mon Sep 17 00:00:00 2001 From: kraoc Date: Mon, 27 Nov 2023 14:09:11 +0100 Subject: [PATCH] initial commit --- README.md | 2 +- _vm/.env | 62 +++++++++++++++++++++++++++++++++ _vm/common.yml | 20 +++++++++++ _vm/host.yml | 86 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 40 +++++++++++++++++++++ setup.sh | 7 ++++ 6 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 _vm/.env create mode 100644 _vm/common.yml create mode 100644 _vm/host.yml create mode 100644 docker-compose.yml create mode 100644 setup.sh diff --git a/README.md b/README.md index 0dc3b9e..341de81 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # compose -Exemple de docker-compose avec extends, .env et environment. \ No newline at end of file +Exemple de docker-compose avec extends, .env et environment. diff --git a/_vm/.env b/_vm/.env new file mode 100644 index 0000000..06ca831 --- /dev/null +++ b/_vm/.env @@ -0,0 +1,62 @@ +# master: 2023-11-27 +# edited: 2023-11-27 +# updated: 2023-11-27 + +VM_VERSIONNING="2023-11-27" + + + +# -------------------------------------------------- +# Local network definition +# -------------------------------------------------- + +VM_DOMAIN="home" +VM_IP_ASSIGN="192.168.1" + + + +# -------------------------------------------------- +# VM specific definition +# -------------------------------------------------- + +VM_NAME="compose" +VM_TITLE="compose" +VM_IP="$VM_IP_ASSIGN.33" + + + +# -------------------------------------------------- +# Local containers exposed ports (for all VM) +# -------------------------------------------------- + +VM_PORT_DOZZLE="60000" + + + +# -------------------------------------------------- +# Common +# -------------------------------------------------- + +VM_USER="1000" +VM_GROUP="1000" +VM_MASTER="master" +MASTER_HOST="${VM_MASTER}.${VM_DOMAIN}" +VM_HOST="${VM_NAME}.${VM_DOMAIN}" + + + +# -------------------------------------------------- +# Services specifics +# -------------------------------------------------- + +WATCHTOWER_NOTIFICATION_TITLE_TAG="${VM_TITLE}" +WATCHTOWER_NOTIFICATIONS_HOSTNAME="${VM_NAME}" + + + +# -------------------------------------------------- +# Samba specifics +# -------------------------------------------------- + +SAMBA_USERNAME="user" +SAMBA_PASSWORD="password" diff --git a/_vm/common.yml b/_vm/common.yml new file mode 100644 index 0000000..18d31d5 --- /dev/null +++ b/_vm/common.yml @@ -0,0 +1,20 @@ +version: "3.0" + +# +# updated: 2023-11-27 +# stack: x-common +# + +services: + + x-common: + + extends: + file: ./host.yml + service: x-host + + init: true + + sysctls: + net.core.somaxconn: 1024 + net.ipv4.tcp_syncookies: 0 diff --git a/_vm/host.yml b/_vm/host.yml new file mode 100644 index 0000000..7c3a057 --- /dev/null +++ b/_vm/host.yml @@ -0,0 +1,86 @@ +version: "3.0" + +# +# updated: 2023-11-27 +# stack: host +# + +services: + + x-host: + + #read_only: true + + restart: unless-stopped + stop_grace_period: 5s + stdin_open: true + tty: true + + user: ${VM_USER}:${VM_GROUP} + + privileged: false + + security_opt: + - no-new-privileges=true + + cap_drop: + - ALL + + cap_add: + - KILL + + ipc: "private" + + dns: + - 1.1.1.1 + - 8.8.8.8 + - 1.0.0.1 + - 8.8.4.4 + + extra_hosts: + - "vm.${VM_DOMAIN}:${VM_IP}" + + healthcheck: + interval: 60s + timeout: 10s + retries: 5 + start_period: 60s + + environment: + TZ: "Europe/Paris" + PUID: 1000 + PGID: 1000 + + labels: + com.centurylinklabs.watchtower.enable: true + com.vm.versionning: "${VM_VERSIONNING}" + com.stack.owner: "Olivier Le Bris" + com.stack.owner.email: "tech@zogg.fr" + com.stack.owner.url: "https://zogg.fr" + com.stack.name: "common" + com.stack.service.name: "common" + + ulimits: + nproc: 65535 + nofile: + soft: 20000 + hard: 40000 + + deploy: + resources: + limits: + cpus: "1.0" + memory: 64M + pids: 64 + + tmpfs: + - /tmp:rw,size=64M + - /run:rw,exec,size=16M,mode=01777 + - /var/log:rw,size=64M,mode=01777 + - /var/cache:rw,size=64M,mode=01777 + + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - /opt/docker/ssl:/ssl:ro + - /proc/cgroups:/cgroup:rw diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..97a9a8c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +version: "3.0" + +# +# updated: 2023-11-27 +# stack: compose +# + +networks: + compose: + name: compose + driver: bridge + enable_ipv6: true + +services: + + compose: + extends: + file: ./_vm/common.yml + service: x-common + user: 0:0 + privileged: true + container_name: compose + hostname: compose + image: amir20/dozzle:latest + restart: "no" + ports: + - "${VM_PORT_DOZZLE}:8080" + expose: + - "8080" + networks: + - compose + healthcheck: + test: [ "CMD", "/dozzle", "healthcheck" ] + environment: + DOZZLE_NO_ANALYTICS: true + labels: + com.stack.name: "compose" + com.stack.service.name: "compose" + volumes: + - /var/run/docker.sock:/var/run/docker.sock:rw diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..21f0ee1 --- /dev/null +++ b/setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# 2023-11-27 + +ln -s _vm/.env .env +chown -R 1000:1000 . + +exit 0 \ No newline at end of file