initial commit

This commit is contained in:
Olivier 2023-11-27 14:09:11 +01:00
parent d477424fbc
commit 58b328b9ea
6 changed files with 216 additions and 1 deletions

View File

@ -1,3 +1,3 @@
# compose # compose
Exemple de docker-compose avec extends, .env et environment. Exemple de docker-compose avec extends, .env et environment.

62
_vm/.env Normal file
View File

@ -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"

20
_vm/common.yml Normal file
View File

@ -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

86
_vm/host.yml Normal file
View File

@ -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

40
docker-compose.yml Normal file
View File

@ -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

7
setup.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# 2023-11-27
ln -s _vm/.env .env
chown -R 1000:1000 .
exit 0