Compare commits

...
7 Commits
Author SHA1 Message Date
Vezpi d05bc5626d remove(nextcloud): obsolete X-XSS-Protection 2026-10-29 22:40:49 +01:00
Vezpi 387d05fa07 add(nextcloud): env to cron 2026-10-29 22:40:10 +01:00
Vezpi 5938795cc3 update(nextcloud): v32 2026-10-29 21:53:07 +01:00
Vezpi c62a1b8b29 fix(env): remove reference to old env files 2026-10-26 09:23:41 +01:00
Hermes Agent 1c5108b597 add(docker): migrate reviewed stack configurations locally 2026-10-24 08:18:37 +00:00
Vezpi dfadd55977 feat: deploy k8s vms with Terraform and Ansible(#8)
Reviewed-on: #8
2026-09-18 15:37:00 +02:00
Vezpi 6470af9bfd add: patch Proxmox nag 2026-09-15 21:35:53 +00:00
42 changed files with 2257 additions and 0 deletions

No files matched your search

+97
View File
@@ -0,0 +1,97 @@
# Ansible – Kubernetes nodes
Prepares the Kubernetes VM nodes provisioned by the
[`kubernetes_vms` Terraform project](../../terraform/projects/kubernetes_vms/).
## What it does
The `k8s_node` playbook configures each node for `kubeadm`/`kubelet`:
1. **System** – disables swap (runtime + fstab), loads `overlay` and `br_netfilter`,
persists kernel modules, applies the Kubernetes `sysctl` settings.
2. **Packages** – installs prerequisites, adds the official Kubernetes apt repo/key,
installs and holds `kubeadm` and `kubelet`.
3. **containerd** – installs it, generates the default config, enables the
`SystemdCgroup` driver, starts and enables the service.
4. **Firewall** – configures UFW per role: SSH + common Kubernetes ports from the admin
subnet, control-plane ports (`2379:2380`, `10257`, `10259`) on masters, worker ports
(`10256`, `30000:32767`) on workers, default deny incoming.
Group membership (who is a `master` / `worker`) is resolved from the Terraform inventory,
so the role-specific firewall rules apply automatically.
> Cluster bootstrap (`kubeadm init` / `kubeadm join`) is **not** part of this playbook
> and is done manually per the migration roadmap.
## Inventory
The inventory is generated from Terraform state via the `cloud.terraform` inventory
plugin:
```yaml
# inventories/tf_k8s_vms.yml
---
plugin: cloud.terraform.terraform_provider
project_path:
- /tmp/semaphore/project_1/repository_1_template_7/terraform/projects/kubernetes_vms
```
> The `project_path` is a Semaphore runtime checkout path. If you run locally, point it
> at your own `terraform/projects/kubernetes_vms` directory. The same `ansible` provider
> that writes the inventory is used by Terraform, so hosts/groups are always in sync with
> the applied VMs.
## Requirements
Install the collections referenced by `collections/requirements.yml`:
```bash
ansible-galaxy collection install -r collections/requirements.yml
```
- `cloud.terraform` – Terraform inventory plugin
- `community.general` – `ufw` module
## Usage
```bash
# Connectivity check
ansible-playbook -i inventories/tf_k8s_vms.yml ping.yml
# Prepare all Kubernetes nodes
ansible-playbook -i inventories/tf_k8s_vms.yml k8s_node.yml
```
Both playbooks target `all`; the inventory plugin runs from the Terraform project path.
## Role variables
Defined in `roles/k8s_node/defaults/main.yml` (override as needed):
| Variable | Default | Description |
| ------------------------------- | ---------------------------- | -------------------------------------- |
| `k8s_version` | `1.37` | Kubernetes minor version |
| `k8s_repo` | `pkgs.k8s.io` core v<ver> | Kubernetes apt repository |
| `k8s_repo_key` | matching `Release.key` URL | Repository signing key |
| `k8s_packages` | `kubelet`, `kubeadm` | Packages installed and held |
| `k8s_prerequisite_packages` | `apt-transport-https`, `ca-certificates`, `curl`, `gnupg` | Build deps for the repo |
| `k8s_firewall_admin_subnet` | `192.168.66.0/24` | Subnet allowed through UFW |
| `k8s_firewall_ssh_port` | `22` | SSH port |
| `k8s_firewall_common_ports` | `6443`, `10250` | Ports open on all nodes |
| `k8s_firewall_master_ports` | `2379:2380`, `10257`, `10259` | Ports open on masters |
| `k8s_firewall_worker_ports` | `10256`, `30000:32767` | Ports open on workers |
## File reference
| Path | Purpose |
| ---------------------------------------- | ------------------------------------ |
| `k8s_node.yml` | Main playbook (role `k8s_node`) |
| `ping.yml` | Connectivity smoke-test playbook |
| `inventories/tf_k8s_vms.yml` | Terraform-backed inventory |
| `collections/requirements.yml` | Required Ansible collections |
| `roles/k8s_node/tasks/main.yml` | Task dispatcher |
| `roles/k8s_node/tasks/system.yml` | Swap, kernel modules, sysctl |
| `roles/k8s_node/tasks/packages.yml` | Kubernetes repo + kubeadm/kubelet |
| `roles/k8s_node/tasks/containerd.yml` | containerd install/config |
| `roles/k8s_node/tasks/firewall.yml` | Per-role UFW rules |
| `roles/k8s_node/defaults/main.yml` | Role defaults |
@@ -0,0 +1,4 @@
---
collections:
- name: cloud.terraform
- name: community.general
@@ -0,0 +1,4 @@
---
plugin: cloud.terraform.terraform_provider
project_path:
- /tmp/semaphore/project_1/repository_1_template_7/terraform/projects/kubernetes_vms
+6
View File
@@ -0,0 +1,6 @@
---
- name: Prepare Kubernetes nodes
hosts: all
roles:
- role: k8s_node
+5
View File
@@ -0,0 +1,5 @@
---
- name: Prepare Kubernetes nodes
hosts: all
tasks:
- ansible.builtin.ping:
@@ -0,0 +1,32 @@
---
k8s_version: "1.37"
k8s_repo: "https://pkgs.k8s.io/core:/stable:/v{{ k8s_version }}/deb"
k8s_repo_key: "https://pkgs.k8s.io/core:/stable:/v{{ k8s_version }}/deb/Release.key"
k8s_packages:
- kubelet
- kubeadm
k8s_prerequisite_packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg
k8s_firewall_admin_subnet: "192.168.88.0/24"
k8s_firewall_ssh_port: "22"
k8s_firewall_common_ports:
- "6443"
- "10250"
k8s_firewall_master_ports:
- "2379:2380"
- "10257"
- "10259"
k8s_firewall_worker_ports:
- "10256"
- "30000:32767"
k8s_firewall_cilium_udp_ports:
- "8472"
k8s_firewall_cilium_tcp_ports:
- "4240"
@@ -0,0 +1,34 @@
---
- name: Install containerd
ansible.builtin.apt:
name: containerd
state: present
update_cache: true
become: yes
- name: Create containerd configuration directory
ansible.builtin.file:
path: /etc/containerd
state: directory
mode: "0755"
become: yes
- name: Generate default containerd configuration
ansible.builtin.shell:
cmd: containerd config default > /etc/containerd/config.toml
creates: /etc/containerd/config.toml
become: yes
- name: Enable systemd cgroup driver in containerd
ansible.builtin.replace:
path: /etc/containerd/config.toml
regexp: '^(\s*)SystemdCgroup(\s*=\s*)false'
replace: '\1SystemdCgroup\2true'
become: yes
- name: Enable and start containerd
ansible.builtin.systemd:
name: containerd
state: restarted
enabled: true
become: yes
@@ -0,0 +1,62 @@
---
- name: Allow SSH from admin subnet
community.general.ufw:
rule: allow
port: "{{ k8s_firewall_ssh_port }}"
proto: tcp
from_ip: "{{ k8s_firewall_admin_subnet }}"
become: yes
- name: Allow common Kubernetes ports from admin subnet
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
from_ip: "{{ k8s_firewall_admin_subnet }}"
become: yes
loop: "{{ k8s_firewall_common_ports }}"
- name: Allow etcd and control plane ports on control-plane nodes
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
from_ip: "{{ k8s_firewall_admin_subnet }}"
become: yes
loop: "{{ k8s_firewall_master_ports }}"
when: inventory_hostname in groups['master']
- name: Allow kube-proxy and NodePort ports on worker nodes
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
from_ip: "{{ k8s_firewall_admin_subnet }}"
become: yes
loop: "{{ k8s_firewall_worker_ports }}"
when: inventory_hostname in groups['worker']
- name: Allow Cilium VXLAN and health check UDP ports from admin subnet
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: udp
from_ip: "{{ k8s_firewall_admin_subnet }}"
become: yes
loop: "{{ k8s_firewall_cilium_udp_ports }}"
- name: Allow Cilium health check TCP ports from admin subnet
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
from_ip: "{{ k8s_firewall_admin_subnet }}"
become: yes
loop: "{{ k8s_firewall_cilium_tcp_ports }}"
- name: Enable ufw and deny incoming by default
community.general.ufw:
state: enabled
policy: deny
direction: incoming
become: yes
@@ -0,0 +1,5 @@
---
- ansible.builtin.import_tasks: system.yml
- ansible.builtin.import_tasks: packages.yml
- ansible.builtin.import_tasks: containerd.yml
- ansible.builtin.import_tasks: firewall.yml
@@ -0,0 +1,36 @@
---
- name: Install prerequisite packages
ansible.builtin.apt:
name: "{{ k8s_prerequisite_packages }}"
state: present
update_cache: true
become: yes
- name: Add Kubernetes apt key
ansible.builtin.apt_key:
url: "{{ k8s_repo_key }}"
keyring: /etc/apt/keyrings/kubernetes-apt-keyring.gpg
state: present
become: yes
- name: Add Kubernetes apt repository
ansible.builtin.apt_repository:
repo: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] {{ k8s_repo }} /"
state: present
filename: kubernetes
become: yes
- name: Install kubelet and kubeadm
ansible.builtin.apt:
name: "{{ k8s_packages }}"
state: present
update_cache: true
become: yes
- name: Hold kubelet and kubeadm packages
ansible.builtin.command:
cmd: apt-mark hold {{ item }}
loop: "{{ k8s_packages }}"
register: _kube_hold
become: yes
changed_when: "'already set on hold' not in _kube_hold.stdout"
@@ -0,0 +1,51 @@
---
- name: Disable swap
ansible.builtin.shell:
cmd: swapoff -a
become: yes
changed_when: false
- name: Comment out swap entries in fstab
ansible.builtin.replace:
path: /etc/fstab
regexp: '^(\s*[^#\s][^\s]*\s+swap\s+.*)$'
replace: '# \1'
become: yes
- name: Load overlay kernel module
ansible.builtin.shell:
cmd: modprobe overlay
become: yes
changed_when: false
failed_when: false
- name: Load br_netfilter kernel module
ansible.builtin.shell:
cmd: modprobe br_netfilter
become: yes
changed_when: false
- name: Persist kernel modules
ansible.builtin.copy:
dest: /etc/modules-load.d/k8s.conf
content: |
overlay
br_netfilter
mode: "0644"
become: yes
- name: Configure kernel network settings
ansible.builtin.copy:
dest: /etc/sysctl.d/k8s.conf
content: |
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
mode: "0644"
become: yes
- name: Apply kernel network settings
ansible.builtin.command:
cmd: sysctl --system
become: yes
changed_when: false
+17
View File
@@ -104,6 +104,23 @@
autoremove: true
autoclean: true
- name: Check whether Proxmox subscription nag is already patched
ansible.builtin.shell:
cmd: >
grep -Fq
'return (typeof orig_cmd === "function" && (orig_cmd(), true));'
/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
register: proxmox_nag_patch
changed_when: false
failed_when: false
- name: Patch Proxmox subscription nag
ansible.builtin.lineinfile:
path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
insertafter: 'checked_command: function (orig_cmd) {'
line: ' return (typeof orig_cmd === "function" && (orig_cmd(), true));'
when: proxmox_nag_patch.rc != 0
- name: Disable Ceph rebalancing
ansible.builtin.command: ceph osd set noout
+11
View File
@@ -0,0 +1,11 @@
# Local Compose inputs and generated private material must not be published.
.env
.env.*
# Named Compose env inputs (for example, homeassistant/*.env).
*.env
!.env.example
!.env.sample
!.env.template
acme.json
*.key
*.pem
+84
View File
@@ -0,0 +1,84 @@
services:
blog_production:
image: vezpi-blog:latest
container_name: blog_production
environment:
- TZ=Europe/Paris
- URL=${URL_PROD}
- BRANCH=main
volumes:
- blog_production_hugo_resources:/hugo-resources
networks:
- web
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost/ > /dev/null || exit 1"]
interval: 5s
timeout: 3s
retries: 30
start_period: 5s
labels:
- traefik.enable=true
- traefik.http.routers.blog.rule=Host(`${URL_PROD}`)
- traefik.http.routers.blog.entrypoints=https
- traefik.http.routers.blog.tls.certresolver=letsencrypt
- traefik.http.services.blog.loadbalancer.server.port=80
restart: always
blog_staging:
image: vezpi-blog:latest
container_name: blog_staging
environment:
- TZ=Europe/Paris
- URL=${URL_STAGING}
- BRANCH=preview
volumes:
- blog_staging_hugo_resources:/hugo-resources
networks:
- web
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost/ > /dev/null || exit 1"]
interval: 5s
timeout: 3s
retries: 30
start_period: 5s
labels:
- traefik.enable=true
- traefik.http.routers.blog-staging.rule=Host(`${URL_STAGING}`)
- traefik.http.routers.blog-staging.entrypoints=https
- traefik.http.routers.blog-staging.tls.certresolver=letsencrypt
- traefik.http.services.blog-staging.loadbalancer.server.port=80
restart: always
blog_dev:
image: vezpi-blog:dev
container_name: blog_dev
environment:
- TZ=Europe/Paris
- URL=${URL_DEV}
- BRANCH=${BLOG_TEST_BRANCH:-preview}
volumes:
- blog_dev_hugo_resources:/hugo-resources
networks:
- web
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost/ > /dev/null || exit 1"]
interval: 5s
timeout: 3s
retries: 30
start_period: 5s
labels:
- traefik.enable=true
- traefik.http.routers.blog-dev.rule=Host(`${URL_DEV}`)
- traefik.http.routers.blog-dev.entrypoints=https
- traefik.http.routers.blog-dev.tls.certresolver=letsencrypt
- traefik.http.services.blog-dev.loadbalancer.server.port=80
restart: always
volumes:
blog_production_hugo_resources:
blog_staging_hugo_resources:
blog_dev_hugo_resources:
networks:
web:
external: true
+21
View File
@@ -0,0 +1,21 @@
services:
NAME:
image: IMAGE
container_name: NAME
volumes:
- /appli/data/NAME/:/
environment:
- TZ=Europe/Paris
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.NAME.rule=Host(`${URL}`)
- traefik.http.routers.NAME.entrypoints=https
- traefik.http.routers.NAME.tls.certresolver=letsencrypt
- traefik.http.services.NAME.loadbalancer.server.port=PORT
restart: always
networks:
web:
external: true
+25
View File
@@ -0,0 +1,25 @@
services:
duplicati:
image: duplicati/duplicati
container_name: duplicati
volumes:
- /appli/data/duplicati/data:/data
- /backups:/backups
- /restore:/restore
- /:/source:ro
hostname: ${URL}
environment:
- TZ=Europe/Paris
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.duplicati.rule=Host(`${URL}`)
- traefik.http.routers.duplicati.entrypoints=https
- traefik.http.routers.duplicati.tls.certresolver=letsencrypt
- traefik.http.services.duplicati.loadbalancer.server.port=8200
restart: always
networks:
web:
external: true
+78
View File
@@ -0,0 +1,78 @@
services:
server:
image: gitea/gitea:1.27
container_name: gitea_server
restart: always
volumes:
- /appli/data/gitea/data:/data
environment:
- USER_UID=1000
- USER_GID=1000
- TZ=Europe/Paris
- DB_TYPE=postgres
- DB_HOST=db:5432
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWD=${DB_PASSWD}
- GITEA__service__DISABLE_REGISTRATION=true
networks:
- web
- backend
labels:
- traefik.enable=true
- traefik.http.routers.gitea.rule=Host(`${URL}`)
- traefik.http.routers.gitea.entrypoints=https
- traefik.http.routers.gitea.tls.certresolver=letsencrypt
- traefik.http.services.gitea.loadbalancer.server.port=3000
depends_on:
- db
db:
image: postgres:12-alpine
container_name: gitea_db
volumes:
- /appli/data/gitea/db:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWD}
- POSTGRES_DB=${DB_NAME}
networks:
- backend
restart: always
# webhook:
# image: almir/webhook
# container_name: gitea_webhook
# command: -verbose -hooks=/etc/webhook/hooks.yaml -hotreload
# volumes:
# - /appli/data/gitea/webhook/hooks:/etc/webhook
# - /appli/data/gitea/webhook/scripts:/scripts
# environment:
# - TZ=Europe/Paris
# networks:
# - backend
# restart: always
runner:
image: gitea/act_runner:latest
container_name: gitea_runner
restart: always
environment:
- GITEA_INSTANCE_URL=https://${URL}
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN}
- GITEA_RUNNER_NAME=${GITEA_RUNNER_NAME}
- GITEA_RUNNER_LABELS=${GITEA_RUNNER_LABELS}
- CONFIG_FILE=/data/config.yml
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /appli/data/gitea/runner:/data
- /appli:/appli
networks:
- backend
depends_on:
- server
networks:
backend:
web:
external: true
+197
View File
@@ -0,0 +1,197 @@
services:
homeassistant:
image: homeassistant/home-assistant:2026.9
container_name: homeassistant_core
hostname: homeassistant_core
volumes:
- /appli/data/homeassistant/core/:/config
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=Europe/Paris
networks:
- lan
- web
- backend
depends_on:
- postgres
- influxdb
labels:
- traefik.enable=true
- traefik.http.routers.homeassistant.rule=Host(`${URL_HASS}`)
- traefik.http.routers.homeassistant.entrypoints=https
- traefik.http.routers.homeassistant.tls.certresolver=letsencrypt
- traefik.http.services.homeassistant.loadbalancer.server.port=8123
restart: unless-stopped
postgres:
image: postgres:15-alpine
container_name: homeassistant_postgres
volumes:
- /appli/data/homeassistant/postgres:/var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=Europe/Paris
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
networks:
- backend
restart: unless-stopped
influxdb:
image: influxdb:2-alpine
container_name: homeassistant_influxdb
volumes:
- /appli/data/homeassistant/influxdb/data:/var/lib/influxdb2
- /appli/data/homeassistant/influxdb/config/:/etc/influxdb2
environment:
- TZ=Europe/Paris
ulimits:
nofile:
soft: 65536
hard: 65536
labels:
- traefik.enable=true
- traefik.http.routers.homeassistant-influxdb.rule=Host(`${URL_INFLUXDB}`)
- traefik.http.routers.homeassistant-influxdb.entrypoints=https
- traefik.http.routers.homeassistant-influxdb.tls.certresolver=letsencrypt
- traefik.http.routers.homeassistant-influxdb.middlewares=local-only@file
- traefik.http.services.homeassistant-influxdb.loadbalancer.server.port=8086
networks:
- backend
- web
restart: unless-stopped
# grafana:
# image: grafana/grafana
# container_name: homeassistant_grafana
# depends_on:
# - influxdb
mosquitto:
image: eclipse-mosquitto
container_name: homeassistant_mqtt
volumes:
- /appli/data/homeassistant/mosquitto/config:/mosquitto/config
- /appli/data/homeassistant/mosquitto/data:/mosquitto/data
- /appli/data/homeassistant/mosquitto/log:/mosquitto/log
environment:
- TZ=Europe/Paris
networks:
- backend
restart: unless-stopped
zigbee2mqtt:
image: koenkk/zigbee2mqtt
container_name: homeassistant_zigbee
volumes:
- /appli/data/homeassistant/zigbee2mqtt:/app/data
- /run/udev:/run/udev:ro
environment:
- TZ=Europe/Paris
#devices:
#- /dev/ttyUSB0:/dev/ttyACM0
networks:
- lan
- backend
- web
depends_on:
- mosquitto
labels:
- traefik.enable=true
- traefik.http.routers.homeassistant-zigbee2mqtt.rule=Host(`${URL_Z2M}`)
- traefik.http.routers.homeassistant-zigbee2mqtt.entrypoints=https
- traefik.http.routers.homeassistant-zigbee2mqtt.tls.certresolver=letsencrypt
- traefik.http.routers.homeassistant-zigbee2mqtt.middlewares=local-only@file
- traefik.http.services.homeassistant-zigbee2mqtt.loadbalancer.server.port=8080
restart: always
editor:
image: causticlab/hass-configurator-docker
container_name: homeassistant_editor
volumes:
- /appli/data/homeassistant/editor:/config
- /appli/data/homeassistant/core:/homeassistant_root
- /appli/docker/homeassistant/docker-compose.yml:/homeassistant_root/docker-compose.yml
networks:
- backend
- web
labels:
- traefik.enable=true
- traefik.http.routers.homeassistant-editor.rule=Host(`${URL_EDITOR}`)
- traefik.http.routers.homeassistant-editor.entrypoints=https
- traefik.http.routers.homeassistant-editor.tls.certresolver=letsencrypt
- traefik.http.routers.homeassistant-editor.middlewares=local-only@file
- traefik.http.services.homeassistant-editor.loadbalancer.server.port=3218
restart: unless-stopped
# mdns:
# image: monstrenyatko/mdns-repeater
# container_name: homeassistant_mdns
# command: mdns-repeater-app -f -d enp51s0 br-9388867fe123
#restart: unless-stopped
#network_mode: host
nodered:
image: nodered/node-red
container_name: homeassistant_nodered
volumes:
- /appli/data/homeassistant/nodered/data:/data
environment:
- TZ=Europe/Paris
depends_on:
- homeassistant
- mosquitto
networks:
- backend
- web
labels:
- traefik.enable=true
- traefik.http.routers.homeassistant-nodered.rule=Host(`${URL_NODERED}`)
- traefik.http.routers.homeassistant-nodered.entrypoints=https
- traefik.http.routers.homeassistant-nodered.tls.certresolver=letsencrypt
- traefik.http.routers.homeassistant-nodered.middlewares=local-only@file
- traefik.http.services.homeassistant-nodered.loadbalancer.server.port=1880
restart: unless-stopped
whisper:
image: rhasspy/wyoming-whisper
container_name: homeassistant_whisper
command: --model base-int8 --language fr
environment:
- TZ=Europe/Paris
volumes:
- /appli/data/homeassistant/whisper/data:/data
networks:
- backend
restart: unless-stopped
piper:
image: rhasspy/wyoming-piper
container_name: homeassistant_piper
command: --voice fr_FR-mls-medium
environment:
- TZ=Europe/Paris
volumes:
- /appli/data/homeassistant/piper/data:/data
networks:
- backend
restart: unless-stopped
# ollama:
# image: ollama/ollama
# container_name: homeassistant_ollama
# environment:
# - TZ=Europe/Paris
# volumes:
# - /appli/data/homeassistant/ollama/data:/root/.ollama
# networks:
# - backend
# restart: unless-stopped
networks:
backend:
lan:
external: true
web:
external: true
+93
View File
@@ -0,0 +1,93 @@
#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#
name: immich
services:
server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
extends:
file: hwaccel.transcoding.yml
service: vaapi # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
networks:
- backend
- web
env_file:
- .env
depends_on:
- redis
- database
labels:
- traefik.enable=true
- traefik.http.routers.immich.rule=Host(`${URL}`)
- traefik.http.routers.immich.entrypoints=https
- traefik.http.routers.immich.tls.certresolver=letsencrypt
- traefik.http.services.immich.loadbalancer.server.port=2283
restart: always
healthcheck:
disable: false
machine-learning:
container_name: immich-machine-learning
# For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
# Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
#extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
# file: hwaccel.ml.yml
# service: openvino # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
volumes:
- model-cache:/cache
networks:
- backend
env_file:
- .env
restart: always
healthcheck:
disable: false
redis:
container_name: immich_redis
image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5
env_file:
- .env
networks:
- backend
healthcheck:
test: redis-cli ping || exit 1
restart: always
database:
container_name: immich_database
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
volumes:
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
env_file:
- .env
networks:
- backend
shm_size: 128mb
restart: always
volumes:
model-cache:
networks:
backend:
web:
external: true
+43
View File
@@ -0,0 +1,43 @@
# Configurations for hardware-accelerated machine learning
# If using Unraid or another platform that doesn't allow multiple Compose files,
# you can inline the config for a backend by copying its contents
# into the immich-machine-learning service in the docker-compose.yml file.
# See https://immich.app/docs/features/ml-hardware-acceleration for info on usage.
services:
armnn:
devices:
- /dev/mali0:/dev/mali0
volumes:
- /lib/firmware/mali_csffw.bin:/lib/firmware/mali_csffw.bin:ro # Mali firmware for your chipset (not always required depending on the driver)
- /usr/lib/libmali.so:/usr/lib/libmali.so:ro # Mali driver for your chipset (always required)
cpu: {}
cuda:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities:
- gpu
openvino:
device_cgroup_rules:
- 'c 189:* rmw'
devices:
- /dev/dri:/dev/dri
volumes:
- /dev/bus/usb:/dev/bus/usb
openvino-wsl:
devices:
- /dev/dri:/dev/dri
- /dev/dxg:/dev/dxg
volumes:
- /dev/bus/usb:/dev/bus/usb
- /usr/lib/wsl:/usr/lib/wsl
+54
View File
@@ -0,0 +1,54 @@
# Configurations for hardware-accelerated transcoding
# If using Unraid or another platform that doesn't allow multiple Compose files,
# you can inline the config for a backend by copying its contents
# into the immich-microservices service in the docker-compose.yml file.
# See https://immich.app/docs/features/hardware-transcoding for more info on using hardware transcoding.
services:
cpu: {}
nvenc:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities:
- gpu
- compute
- video
quicksync:
devices:
- /dev/dri:/dev/dri
rkmpp:
security_opt: # enables full access to /sys and /proc, still far better than privileged: true
- systempaths=unconfined
- apparmor=unconfined
group_add:
- video
devices:
- /dev/rga:/dev/rga
- /dev/dri:/dev/dri
- /dev/dma_heap:/dev/dma_heap
- /dev/mpp_service:/dev/mpp_service
#- /dev/mali0:/dev/mali0 # only required to enable OpenCL-accelerated HDR -> SDR tonemapping
volumes:
#- /etc/OpenCL:/etc/OpenCL:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping
#- /usr/lib/aarch64-linux-gnu/libmali.so.1:/usr/lib/aarch64-linux-gnu/libmali.so.1:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping
vaapi:
devices:
- /dev/dri:/dev/dri
vaapi-wsl: # use this for VAAPI if you're running Immich in WSL2
devices:
- /dev/dri:/dev/dri
volumes:
- /usr/lib/wsl:/usr/lib/wsl
environment:
- LIBVA_DRIVER_NAME=d3d12
+27
View File
@@ -0,0 +1,27 @@
services:
jellyfin:
image: linuxserver/jellyfin
container_name: jellyfin
volumes:
- /appli/data/jellyfin/:/config
- /data/videos/Series:/data/tvshows
- /data/videos/Films:/data/movies
devices:
- /dev/dri:/dev/dri
environment:
- TZ=Europe/Paris
- PUID=3120
- PGID=3120
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.jellyfin.rule=Host(`${URL}`)
- traefik.http.routers.jellyfin.entrypoints=https
- traefik.http.routers.jellyfin.tls.certresolver=letsencrypt
- traefik.http.services.jellyfin.loadbalancer.server.port=8096
restart: unless-stopped
networks:
web:
external: true
+95
View File
@@ -0,0 +1,95 @@
services:
db:
image: mariadb:lts
container_name: nextcloud_db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- /appli/data/nextcloud/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MARIADB_AUTO_UPGRADE=1
networks:
- backend
restart: always
redis:
image: redis:alpine
container_name: nextcloud_redis
networks:
- backend
restart: always
core:
image: nextcloud:32-fpm-alpine
container_name: nextcloud_core
volumes:
- /appli/data/nextcloud/data:/var/www/html
- /data/cloud/Documents:/mnt/data/Documents
- /data/cloud/Ebook:/mnt/data/Ebook
- /data/photo:/mnt/data/photo
- /data/video:/mnt/data/video
- /data/download:/mnt/data/download
environment:
- MYSQL_HOST=db
- REDIS_HOST=redis
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
depends_on:
- db
- redis
networks:
- backend
restart: always
web:
build: ./web
container_name: nextcloud_web
volumes:
- /appli/data/nextcloud/data:/var/www/html:ro
depends_on:
- core
networks:
- web
- backend
labels:
- traefik.enable=true
- traefik.http.routers.nextcloud.rule=Host(`${URL}`)
- traefik.http.routers.nextcloud.entrypoints=https
- traefik.http.routers.nextcloud.tls.certresolver=letsencrypt
- traefik.http.services.nextcloud.loadbalancer.server.port=80
- traefik.http.middlewares.nextcloud.redirectregex.regex=/.well-known/(card|cal)dav
- traefik.http.middlewares.nextcloud.redirectregex.replacement=/remote.php/dav/
restart: always
cron:
image: nextcloud:32-fpm-alpine
container_name: nextcloud_cron
volumes:
- /appli/data/nextcloud/data:/var/www/html
- /data/cloud/Documents:/mnt/data/Documents
- /data/cloud/Ebook:/mnt/data/Ebook
- /data/photo:/mnt/data/photo
- /data/video:/mnt/data/video
- /data/download:/mnt/data/download
environment:
- MYSQL_HOST=db
- REDIS_HOST=redis
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
entrypoint: /cron.sh
depends_on:
- db
- redis
networks:
- backend
restart: always
networks:
backend:
web:
external: true
+3
View File
@@ -0,0 +1,3 @@
FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
+170
View File
@@ -0,0 +1,170 @@
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
upstream php-handler {
server core:9000;
}
server {
listen 80;
# HSTS settings
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Pagespeed is not supported by Nextcloud, so if your server is built
# with the `ngx_pagespeed` module, uncomment this line to disable it.
#pagespeed off;
# HTTP response headers borrowed from Nextcloud `.htaccess`
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# Path to the root of your installation
root /var/www/html;
# Specify how to handle directories -- specifying `/index.php$request_uri`
# here as the fallback means that Nginx always exhibits the desired behaviour
# when a client requests a path that corresponds to a directory that exists
# on the server. In particular, if that directory contains an index.php file,
# that file is correctly served; if it doesn't, then the request is passed to
# the front-end controller. This consistent behaviour means that we don't need
# to specify custom rules for certain paths (e.g. images and other assets,
# `/updater`, `/ocm-provider`, `/ocs-provider`), and thus
# `try_files $uri $uri/ /index.php$request_uri`
# always provides the desired behaviour.
index index.php index.html /index.php$request_uri;
# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Make a regex exception for `/.well-known` so that clients can still
# access it despite the existence of the regex rule
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
# for `/.well-known`.
location ^~ /.well-known {
# The rules in this block are an adaptation of the rules
# in `.htaccess` that concern `/.well-known`.
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
# Let Nextcloud's API for `/.well-known` URIs handle all other
# requests by passing them to the front-end controller.
return 301 /index.php$request_uri;
}
# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
# then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`
# to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
# Required for legacy support
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
#fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|svg|gif)$ {
try_files $uri /index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
# Rule borrowed from `.htaccess`
location /remote {
return 301 /remote.php$request_uri;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
}
+37
View File
@@ -0,0 +1,37 @@
services:
ntfy:
image: binwiederhier/ntfy:v2.23
container_name: ntfy
command:
- serve
volumes:
- /appli/data/ntfy/data:/var/cache/ntfy
environment:
- TZ=Europe/Paris
- NTFY_BASE_URL=https://${URL}
- NTFY_CACHE_FILE=/var/cache/ntfy/cache.db
- NTFY_AUTH_FILE=/var/cache/ntfy/auth.db
- NTFY_ATTACHMENT_CACHE_DIR=/var/cache/ntfy/attachments
- NTFY_AUTH_DEFAULT_ACCESS=deny-all
- NTFY_BEHIND_PROXY=true
- NTFY_ENABLE_LOGIN=true
user: 1000:1000
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.ntfy.rule=Host(`${URL}`)
- traefik.http.routers.ntfy.entrypoints=https
- traefik.http.routers.ntfy.tls.certresolver=letsencrypt
- traefik.http.services.ntfy.loadbalancer.server.port=80
healthcheck:
test: ["CMD-SHELL", "wget -q --tries=1 http://ntfy:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"]
interval: 60s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
networks:
web:
external: true
+62
View File
@@ -0,0 +1,62 @@
services:
phpipam-web:
image: phpipam/phpipam-www:latest
container_name: phpipam_web
environment:
- TZ=Europe/Paris
- IPAM_DATABASE_HOST=phpipam-mariadb
- IPAM_DATABASE_PASS=${IPAM_DATABASE_PASS}
- IPAM_DATABASE_WEBHOST=%
- IPAM_TRUST_X_FORWARDED=true
volumes:
- /appli/data/phpipam/logo:/phpipam/css/images/logo
- /appli/data/phpipam/ca:/usr/local/share/ca-certificates:ro
depends_on:
- phpipam-mariadb
networks:
- web
- backend
labels:
- traefik.enable=true
- traefik.http.routers.phpipam.rule=Host(`${URL}`)
- traefik.http.routers.phpipam.entrypoints=https
- traefik.http.routers.phpipam.tls.certresolver=letsencrypt
- traefik.http.services.phpipam.loadbalancer.server.port=80
restart: unless-stopped
phpipam-cron:
image: phpipam/phpipam-cron:latest
container_name: phpipam_cron
environment:
- TZ=Europe/Paris
- IPAM_DATABASE_HOST=phpipam-mariadb
- IPAM_DATABASE_PASS=${IPAM_DATABASE_PASS}
- SCAN_INTERVAL=1h
restart: unless-stopped
volumes:
- /appli/data/phpipam/ca:/usr/local/share/ca-certificates:ro
networks:
- lan
- backend
depends_on:
- phpipam-mariadb
phpipam-mariadb:
image: mariadb:latest
container_name: phpipam_db
environment:
- TZ=Europe/Paris
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
volumes:
- /appli/data/phpipam/db:/var/lib/mysql
networks:
- backend
restart: unless-stopped
networks:
backend:
lan:
external: true
web:
external: true
+20
View File
@@ -0,0 +1,20 @@
services:
portainer:
image: portainer/portainer-ce:2.40.0-alpine
container_name: portainer
volumes:
- /appli/data/portainer/data:/data
- /var/run/docker.sock:/var/run/docker.sock
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.portainer.rule=Host(`${URL}`)
- traefik.http.routers.portainer.entrypoints=https
- traefik.http.routers.portainer.tls.certresolver=letsencrypt
- traefik.http.services.portainer.loadbalancer.server.port=9000
restart: always
networks:
web:
external: true
+131
View File
@@ -0,0 +1,131 @@
services:
sonarr:
image: linuxserver/sonarr
container_name: sonarr
environment:
- PUID=3120
- PGID=3120
- TZ=Europe/Paris
volumes:
- /appli/data/seedbox/sonarr:/config
- /data/videos/Series:/tv
- /data/downloads:/downloads
networks:
- web
- backend
labels:
- traefik.enable=true
- traefik.http.routers.sonarr.rule=Host(`${URL_SONARR}`)
- traefik.http.routers.sonarr.entrypoints=https
- traefik.http.routers.sonarr.tls.certresolver=letsencrypt
- traefik.http.services.sonarr.loadbalancer.server.port=8989
restart: unless-stopped
radarr:
image: linuxserver/radarr
container_name: radarr
environment:
- PUID=3120
- PGID=3120
- TZ=Europe/Paris
volumes:
- /appli/data/seedbox/radarr:/config
- /data/videos/Films:/movies
- /data/downloads:/downloads
networks:
- backend
- web
labels:
- traefik.enable=true
- traefik.http.routers.radarr.rule=Host(`${URL_RADARR}`)
- traefik.http.routers.radarr.entrypoints=https
- traefik.http.routers.radarr.tls.certresolver=letsencrypt
- traefik.http.services.radarr.loadbalancer.server.port=7878
restart: always
prowlarr:
image: lscr.io/linuxserver/prowlarr:latest
container_name: prowlarr
environment:
- PUID=3120
- PGID=3120
- TZ=Europe/Paris
volumes:
- /appli/data/seedbox/prowlarr:/config
networks:
- backend
- web
labels:
- traefik.enable=true
- traefik.http.routers.prowlarr.rule=Host(`${URL_PROWLARR}`)
- traefik.http.routers.prowlarr.entrypoints=https
- traefik.http.routers.prowlarr.tls.certresolver=letsencrypt
- traefik.http.services.prowlarr.loadbalancer.server.port=9696
restart: unless-stopped
transmission:
image: linuxserver/transmission
container_name: transmission
environment:
- PUID=3120
- PGID=3120
- TZ=Europe/Paris
#- TRANSMISSION_WEB_HOME=/combustion-release/ #optional
- USER=${USER_TRANSMISSION} #optional
- PASS=${PASS_TRANSMISSION} #optional
volumes:
- /appli/data/seedbox/transmission:/config
- /data/downloads:/downloads
networks:
- backend
- web
ports:
- 51413:51413
- 51413:51413/udp
labels:
- traefik.enable=true
- traefik.http.routers.transmission.rule=Host(`${URL_TRANSMISSION}`)
- traefik.http.routers.transmission.entrypoints=https
- traefik.http.routers.transmission.tls.certresolver=letsencrypt
- traefik.http.services.transmission.loadbalancer.server.port=9091
restart: always
flaresolverr:
#image: ghcr.io/flaresolverr/flaresolverr:pr-1282
image: flaresolverr/flaresolverr
container_name: flaresolverr
environment:
- LOG_LEVEL=${LOG_LEVEL:-debug}
- LOG_HTML=${LOG_HTML:-false}
- CAPTCHA_SOLVER=${CAPTCHA_SOLVER:-none}
- TZ=Europe/Paris
restart: unless-stopped
networks:
- backend
bazarr:
image: linuxserver/bazarr
container_name: bazarr
environment:
- PUID=3120
- PGID=3120
- TZ=Europe/Paris
volumes:
- /appli/data/seedbox/bazarr:/config
- /data/videos/Series:/tv
networks:
- backend
- web
labels:
- traefik.enable=true
- traefik.http.routers.bazarr.rule=Host(`${URL_BAZARR}`)
- traefik.http.routers.bazarr.entrypoints=https
- traefik.http.routers.bazarr.tls.certresolver=letsencrypt
- traefik.http.services.bazarr.loadbalancer.server.port=6767
restart: unless-stopped
networks:
backend:
web:
external: true
+52
View File
@@ -0,0 +1,52 @@
services:
semaphore:
image: semaphoreui/semaphore:v2.18.8
container_name: semaphore_ui
environment:
- TZ=Europe/Paris
- SEMAPHORE_DB_USER=${POSTGRES_USER}
- SEMAPHORE_DB_PASS=${POSTGRES_PASSWORD}
- SEMAPHORE_DB_HOST=postgres
- SEMAPHORE_DB_PORT=5432
- SEMAPHORE_DB_DIALECT=postgres
- SEMAPHORE_DB=${POSTGRES_DB}
- SEMAPHORE_PLAYBOOK_PATH=/tmp/semaphore/
- SEMAPHORE_ADMIN_PASSWORD=${SEMAPHORE_ADMIN_PASSWORD}
- SEMAPHORE_ADMIN_NAME=${SEMAPHORE_ADMIN_NAME}
- SEMAPHORE_ADMIN_EMAIL=${SEMAPHORE_ADMIN_EMAIL}
- SEMAPHORE_ADMIN=${SEMAPHORE_ADMIN}
- SEMAPHORE_ACCESS_KEY_ENCRYPTION=${SEMAPHORE_ACCESS_KEY_ENCRYPTION}
- SEMAPHORE_LDAP_ACTIVATED='no'
volumes:
- /appli/docker/semaphore/requirements.txt:/etc/semaphore/requirements.txt
depends_on:
- postgres
networks:
- backend
- web
labels:
- traefik.enable=true
- traefik.http.routers.semaphore.rule=Host(`${URL}`)
- traefik.http.routers.semaphore.entrypoints=https
- traefik.http.routers.semaphore.tls.certresolver=letsencrypt
- traefik.http.services.semaphore.loadbalancer.server.port=3000
restart: unless-stopped
postgres:
image: postgres:14
hostname: postgres
container_name: semaphore_postgres
volumes:
- /appli/data/semaphore/db:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
networks:
- backend
restart: unless-stopped
networks:
backend:
web:
external: true
+1
View File
@@ -0,0 +1 @@
proxmoxer>=2.3
+22
View File
@@ -0,0 +1,22 @@
services:
stirling-pdf:
image: stirlingtools/stirling-pdf:latest
container_name: stirling-pdf
restart: unless-stopped
volumes:
- /appli/data/stirling-pdf:/configs
environment:
- TZ=Europe/Paris
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.stirling.rule=Host(`${URL}`)
- traefik.http.routers.stirling.entrypoints=https
- traefik.http.routers.stirling.tls=true
- traefik.http.routers.stirling.tls.certresolver=letsencrypt
- traefik.http.services.stirling.loadbalancer.server.port=8080
networks:
web:
external: true
+40
View File
@@ -0,0 +1,40 @@
services:
app:
image: traefik:3
container_name: traefik
environment:
- TZ=Europe/Paris
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /appli/data/traefik/files:/files
- /appli/data/traefik/certs/ca:/ca
- /appli/data/traefik/config/traefik.yml:/etc/traefik/traefik.yml
- /appli/data/traefik/config/users:/users
- /appli/data/traefik/acme.json:/acme.json
networks:
- web
labels:
- traefik.enable=true
# Dashboard
- traefik.http.routers.dashboard.rule=Host(`${URL}`)
- traefik.http.routers.dashboard.service=api@internal
- traefik.http.routers.dashboard.entrypoints=https
- traefik.http.routers.dashboard.tls=true
- traefik.http.routers.dashboard.tls.certresolver=letsencrypt
- traefik.http.routers.dashboard.middlewares=local-only@file
# Redirect HTTP to HTTPS
- traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
- traefik.http.routers.http-catchall.entrypoints=http
- traefik.http.routers.http-catchall.middlewares=redirect-to-https
- traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
# Dummy
- traefik.http.services.dummy-svc.loadbalancer.server.port=9999
restart: always
networks:
web:
external: true
+52
View File
@@ -0,0 +1,52 @@
services:
umami:
image: ghcr.io/umami-software/umami:3
container_name: umami_server
environment:
- TZ=Europe/Paris
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@umami_db:5432/${POSTGRES_DB}
- DATABASE_TYPE=postgresql
- APP_SECRET=${APP_SECRET}
- IGNORE_IP=${IGNORE_IP}
networks:
- backend
- web
labels:
- traefik.enable=true
- traefik.http.routers.umami.rule=Host(`${URL}`)
- traefik.http.routers.umami.entrypoints=https
- traefik.http.routers.umami.tls.certresolver=letsencrypt
- traefik.http.services.umami.loadbalancer.server.port=3000
restart: on-failure
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"]
interval: 5s
timeout: 5s
retries: 5
depends_on:
db:
condition: service_healthy
init: true
db:
image: postgres:15-alpine
container_name: umami_db
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- /appli/data/umami/:/var/lib/postgresql/data
networks:
- backend
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
networks:
backend:
web:
external: true
+68
View File
@@ -0,0 +1,68 @@
services:
network_application:
image: lscr.io/linuxserver/unifi-network-application:10.6.101-ls143
container_name: unifi_network_application
depends_on:
- db
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Paris
- MONGO_USER=${MONGO_USER}
- MONGO_PASS=${MONGO_PASS}
- MONGO_HOST=unifi_db
- MONGO_PORT=27017
- MONGO_DBNAME=${MONGO_DBNAME}
- MONGO_AUTHSOURCE=${MONGO_AUTHSOURCE}
#- MEM_LIMIT=1024 #optional
#- MEM_STARTUP=1024 #optional
#- MONGO_TLS= #optional
volumes:
- /appli/data/unifi/config:/config
ports:
#- 443:443
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 1900:1900/udp #optional
- 8843:8843 #optional
- 8880:8880 #optional
- 6789:6789 #optional
- 5514:5514/udp #optional
networks:
- unifi
- web
- backend
labels:
- traefik.enable=true
- traefik.http.routers.unifi.rule=Host(`${URL}`)
- traefik.http.routers.unifi.entrypoints=https
- traefik.http.routers.unifi.tls.certresolver=letsencrypt
- traefik.http.services.unifi.loadbalancer.server.port=8443
- traefik.http.services.unifi.loadbalancer.server.scheme=https
- traefik.http.services.unifi.loadbalancer.serversTransport=insecure@file
restart: unless-stopped
db:
image: docker.io/mongo:8.0
container_name: unifi_db
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
- MONGO_USER=${MONGO_USER}
- MONGO_PASS=${MONGO_PASS}
- MONGO_DBNAME=${MONGO_DBNAME}
- MONGO_AUTHSOURCE=${MONGO_AUTHSOURCE}
volumes:
- /appli/data/unifi/data:/data/db
- /appli/docker/unifi/init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh:ro
networks:
- backend
restart: unless-stopped
networks:
backend:
unifi:
external: true
web:
external: true
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
if which mongosh > /dev/null 2>&1; then
mongo_init_bin='mongosh'
else
mongo_init_bin='mongo'
fi
"${mongo_init_bin}" <<EOF
use ${MONGO_AUTHSOURCE}
db.auth("${MONGO_INITDB_ROOT_USERNAME}", "${MONGO_INITDB_ROOT_PASSWORD}")
db.createUser({
user: "${MONGO_USER}",
pwd: "${MONGO_PASS}",
roles: [
{ db: "${MONGO_DBNAME}", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_stat", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_audit", role: "dbOwner" }
]
})
EOF
+28
View File
@@ -0,0 +1,28 @@
services:
vaultwarden:
image: vaultwarden/server:1.37.1-alpine
container_name: vaultwarden
volumes:
- /appli/data/vaultwarden/data/:/data
environment:
- TZ=Europe/Paris
- DOMAIN=https://${URL}
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=465
- SMTP_SECURITY=force_tls
- SMTP_FROM=${SMTP_USERNAME}
- SMTP_USERNAME=${SMTP_USERNAME}
- SMTP_PASSWORD=${SMTP_PASSWORD}
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.vaultwarden.rule=Host(`${URL}`)
- traefik.http.routers.vaultwarden.entrypoints=https
- traefik.http.routers.vaultwarden.tls.certresolver=letsencrypt
- traefik.http.services.vaultwarden.loadbalancer.server.port=80
restart: always
networks:
web:
external: true
+23
View File
@@ -0,0 +1,23 @@
version: '3'
services:
vscode:
image: codercom/code-server
container_name: vscode
volumes:
- /appli/data/vscode/project:/home/coder/project
environment:
- TZ=Europe/Paris
networks:
- web
labels:
- traefik.enable=true
- traefik.http.routers.vscode.rule=Host(`${URL}`)
- traefik.http.routers.vscode.entrypoints=https
- traefik.http.routers.vscode.tls.certresolver=letsencrypt
- traefik.http.services.vscode.loadbalancer.server.port=8080
restart: always
networks:
web:
external: true
@@ -0,0 +1,93 @@
# Terraform – Kubernetes VMs
Provisions the Kubernetes node VMs on Proxmox for the homelab Kubernetes cluster.
## Overview
This Terraform project clones the `ubuntu-noble-cloud` template into virtual machines
on the proxmox nodes, following a capacity-aware placement algorithm:
1. **Control plane (master)** VMs are spread one per node, on the nodes with the most
free memory that still fit the role's `ram`.
2. **Pack roles (worker)** are water-filled over the remaining capacity, most-available
node first, without a per-node limit.
Each VM is tagged with the environment (`vm_env`) and registered in a Terraform-backed
Ansible inventory (via the `ansible` provider), so the `k8s_node` playbook can target
them by role group.
## Placement details
- Online Proxmox nodes are ordered by available memory (most available first, node name
as tie-break).
- The control-plane role must fit entirely on distinct nodes with `free_mib >= ram`.
- Workers are packed into residual capacity (`free_mib - ram_per_cp_vm_on_node`),
again most-available first.
- Naming: `kub-<env>-m<NN>` for masters and `kub-<env>-w<NN>` for workers, e.g.
`kub-prod-m01`, `kub-prod-w01`.
Deployment is blocked by `check` blocks when the fleet cannot be placed:
- no online node is available,
- not enough nodes have the free memory required for the control-plane role,
- residual capacity cannot fit all worker VMs.
## Prerequisites
- Proxmox with:
- a cloneable template named `ubuntu-noble-cloud` (from the `pve_vm` module),
- a `ceph-workload` datastore,
- VLAN bridge `vlan<id>` (default `vlan66`),
- an API token and an SSH user/password with rights to create VMs on the nodes.
- Terraform with the `bpg/proxmox` and `ansible/ansible` providers (init downloads them).
## Input variables
| Variable | Type | Required | Default | Description |
| ---------------------------- | -------- | -------- | ---------------------------- | -------------------------------------------------- |
| `proxmox_endpoint` | string | yes | – | Proxmox API URL |
| `proxmox_api_token` | string | yes | – | Proxmox API token (secret) |
| `proxmox_ssh_username` | string | yes | – | Proxmox SSH user for placement (secret) |
| `proxmox_ssh_password` | string | yes | – | Proxmox SSH password (secret) |
| `vm_env` | string | no | `"prod"` | Environment, part of the VM name and tags |
| `master_count` | number | no | `null` → `vm_attr` default | Number of master VMs |
| `master_cpu` | number | no | `null` → `vm_attr` default | vCPU cores for masters |
| `master_ram` | number | no | `null` → `vm_attr` default | Master RAM in **GiB** (converted to MiB internally)|
| `master_vlan` | number | no | `null` → `vm_attr` default | VLAN for masters |
| `worker_count` | number | no | `null` → `vm_attr` default | Number of worker VMs |
| `worker_cpu` | number | no | `null` → `vm_attr` default | vCPU cores for workers |
| `worker_ram` | number | no | `null` → `vm_attr` default | Worker RAM in **GiB** |
| `worker_vlan` | number | no | `null` → `vm_attr` default | VLAN for workers |
| `vm_attr` | map(… ) | no | see below | Full per-role VM defaults |
The `vm_attr` map holds the fallback attributes used when the corresponding
`master_*`/`worker_*` override is `null`:
```hcl
vm_attr = {
master = { ram = 2048, cpu = 2, vlan = 66, count = 3 }
worker = { ram = 4096, cpu = 2, vlan = 66, count = 3 }
}
```
> `ram` values inside `vm_attr` are MiB; the `master_ram` / `worker_ram` overrides are
> set in GiB and converted internally (`× 1024`). The placement math always works in MiB.
## Usage
```bash
terraform init
terraform plan
terraform apply
```
The `vm_ip` output maps VM name to assigned IP and feeds the Ansible inventory
(`inventories/`) of the `k8s_node` playbook.
## File reference
| File | Purpose |
| ------------ | --------------------------------------------------------- |
| `main.tf` | Placement algorithm, `pve_vm` module wiring, checks |
| `variables.tf` | Clusters, Proxmox credentials, per-role defaults/overrides |
| `provider.tf` | `proxmox` and `ansible` provider configuration |
+198
View File
@@ -0,0 +1,198 @@
module "pve_vm" {
source = "../../modules/pve_vm"
for_each = local.vm_list
node_name = each.value.node_name
vm_name = each.key
vm_cpu = each.value.vm_cpu
vm_ram = each.value.vm_ram
vm_vlan = each.value.vm_vlan
vm_tags = ["${var.vm_env}"]
}
locals {
node_stats = [
for i, name in data.proxmox_virtual_environment_nodes.pve_nodes.names : {
name = name
free_mib = floor(data.proxmox_virtual_environment_nodes.pve_nodes.memory_available[i] / 1024 / 1024)
}
if data.proxmox_virtual_environment_nodes.pve_nodes.online[i]
]
max_free_mib = length(local.node_stats) > 0 ? max([for node in local.node_stats : node.free_mib]...) : 0
# Online nodes ordered by available memory, most available first (name as tie-break)
node_order = [
for key in sort([
for node in local.node_stats : "${format("%012d", local.max_free_mib - node.free_mib)}|${node.name}"
]) : split("|", key)[1]
]
node_free = { for node in local.node_stats : node.name => node.free_mib }
# Per-role simple overrides merged over vm_attr defaults (null keeps the default)
role_overrides = {
for role, cfg in var.vm_attr : role => lookup({
"master" = { count = var.master_count, ram = var.master_ram != null ? var.master_ram * 1024 : null, cpu = var.master_cpu, vlan = var.master_vlan }
"worker" = { count = var.worker_count, ram = var.worker_ram != null ? var.worker_ram * 1024 : null, cpu = var.worker_cpu, vlan = var.worker_vlan }
}, role, {})
}
# Internal placement rule: the control-plane role (master) sits one per node, pack roles are unlimited
cp_role_name = "master"
role_max_per_node = { for role, cfg in var.vm_attr : role => role == local.cp_role_name ? 1 : 0 }
effective_vm_attr = {
for role, cfg in var.vm_attr : role => merge(cfg, {
for attr, value in local.role_overrides[role] : attr => value if value != null
}, { max_per_node = local.role_max_per_node[role] })
}
# Control plane (max_per_node = 1): one VM per node, only on nodes with enough free memory
cp_role = [for role, cfg in local.effective_vm_attr : role if cfg.max_per_node == 1][0]
cp_attr = local.effective_vm_attr[local.cp_role]
cp_feasible = [
for node in local.node_order : node
if local.node_free[node] >= local.cp_attr.ram
]
cp_nodes = length(local.cp_feasible) >= local.cp_attr.count ? [
for i in range(local.cp_attr.count) : local.cp_feasible[i]
] : []
cp_hosts = toset(local.cp_nodes)
# Residual capacity per node after control-plane VMs are reserved
residual_mib = {
for node in local.node_order :
node => local.node_free[node] - (contains(local.cp_hosts, node) ? local.cp_attr.ram : 0)
}
max_residual_mib = length(local.node_order) > 0 ? max([for node in local.node_order : local.residual_mib[node]]...) : 0
# Remaining roles (max_per_node != 1): pack nodes with residual capacity, most available first
pack_roles = [for role, cfg in local.effective_vm_attr : role if cfg.max_per_node != 1]
pack_slots = {
for role in local.pack_roles : role => {
for node in local.node_order :
node => min(
floor(local.residual_mib[node] / local.effective_vm_attr[role].ram),
local.effective_vm_attr[role].max_per_node == 0
? floor(local.residual_mib[node] / local.effective_vm_attr[role].ram)
: local.effective_vm_attr[role].max_per_node
)
}
}
pack_precedence = {
for role in local.pack_roles : role => [
for key in sort([
for node in local.node_order :
"${format("%012d", local.max_residual_mib - local.residual_mib[node])}|${node}"
if local.pack_slots[role][node] >= 1
]) : split("|", key)[1]
]
}
pack_slots_list = {
for role in local.pack_roles : role =>
[for node in local.pack_precedence[role] : local.pack_slots[role][node]]
}
# Water-fill: each node takes VMs until it runs out of capacity or demand is met
pack_placed = {
for role in local.pack_roles : role => [
for i in range(length(local.pack_precedence[role])) :
min(local.pack_slots_list[role][i], max(0, local.effective_vm_attr[role].count - try(sum([for j in range(i) : local.pack_slots_list[role][j]]), 0)))
]
}
pack_prefix = {
for role in local.pack_roles : role => [
for i in range(length(local.pack_placed[role])) :
try(sum([for j in range(i) : local.pack_placed[role][j]]), 0)
]
}
cp_placements = [
for i in range(length(local.cp_nodes)) : {
vm_name = "kub-${var.vm_env}-${substr(local.cp_role, 0, 1)}${format("%01d", i + 1)}"
vm_role = local.cp_role
vm_node = local.cp_nodes[i]
}
]
pack_placements = flatten([
for role in local.pack_roles : [
for p in range(length(local.pack_precedence[role])) : [
for k in range(local.pack_placed[role][p]) : {
vm_name = "kub-${var.vm_env}-${substr(role, 0, 1)}${format("%01d", local.pack_prefix[role][p] + k + 1)}"
vm_role = role
vm_node = local.pack_precedence[role][p]
}
]
]
])
vm_list = {
for vm in concat(local.cp_placements, local.pack_placements) :
vm.vm_name => {
node_name = vm.vm_node
vm_cpu = local.effective_vm_attr[vm.vm_role].cpu
vm_ram = local.effective_vm_attr[vm.vm_role].ram
vm_vlan = local.effective_vm_attr[vm.vm_role].vlan
vm_role = vm.vm_role
}
}
roles = toset([for vm in local.vm_list : vm.vm_role])
}
data "proxmox_virtual_environment_nodes" "pve_nodes" {}
check "proxmox_nodes" {
assert {
condition = length(local.node_order) > 0
error_message = "No online Proxmox node available for deployment."
}
}
check "control_plane_capacity" {
assert {
condition = length(local.cp_nodes) == local.cp_attr.count
error_message = "Cannot place ${local.cp_attr.count} ${local.cp_role} VM(s): only ${length(local.cp_feasible)} online node(s) have at least ${local.cp_attr.ram} MiB free memory."
}
}
check "pack_capacity" {
assert {
condition = length(local.pack_roles) == 0 ? true : alltrue([
for role in local.pack_roles :
try(sum(local.pack_placed[role]), 0) == local.effective_vm_attr[role].count
])
error_message = "Cannot place all pack VMs: ${join(", ", [
for role in local.pack_roles :
"${role} needs ${local.effective_vm_attr[role].count} VM(s) (${local.effective_vm_attr[role].ram} MiB each), residual free capacity fits only ${try(sum(local.pack_placed[role]), 0)} VM(s)."
if try(sum(local.pack_placed[role]), 0) != local.effective_vm_attr[role].count
])}"
}
}
output "vm_ip" {
value = { for k, v in module.pve_vm : k => v.vm_ip }
}
resource "ansible_group" "vm_groups" {
for_each = local.roles
name = each.key
}
resource "ansible_host" "vm_hosts" {
for_each = module.pve_vm
name = each.key
variables = {
ansible_host = each.value.vm_ip
}
groups = [local.vm_list[each.key].vm_role]
}
@@ -0,0 +1,21 @@
terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
}
ansible = {
source = "ansible/ansible"
}
}
}
provider "proxmox" {
endpoint = var.proxmox_endpoint
api_token = var.proxmox_api_token
insecure = false
ssh {
agent = false
username = var.proxmox_ssh_username
password = var.proxmox_ssh_password
}
}
@@ -0,0 +1,135 @@
variable "proxmox_endpoint" {
description = "Proxmox URL endpoint"
type = string
}
variable "proxmox_api_token" {
description = "Proxmox API token"
type = string
sensitive = true
}
variable "proxmox_ssh_username" {
description = "Proxmox SSH username"
type = string
sensitive = true
}
variable "proxmox_ssh_password" {
description = "Proxmox SSH password"
type = string
sensitive = true
}
variable "vm_attr" {
description = "VM attributes per role. The control-plane role (master) is placed one per node; other roles are packed without a per-node limit."
type = map(object({
ram = number
cpu = number
vlan = number
count = number
}))
default = {
"master" = { ram = 2048, cpu = 2, vlan = 66, count = 3 }
"worker" = { ram = 4096, cpu = 2, vlan = 66, count = 3 }
}
validation {
condition = alltrue([for v in values(var.vm_attr) : v.count >= 1])
error_message = "Each role must deploy at least 1 VM."
}
}
variable "master_count" {
description = "Master role VM count override. null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.master_count == null || var.master_count >= 1
error_message = "master_count must be null or at least 1."
}
}
variable "master_cpu" {
description = "Master role CPU override. null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.master_cpu == null || var.master_cpu >= 1
error_message = "master_cpu must be null or at least 1."
}
}
variable "master_ram" {
description = "Master role RAM override in GiB (converted to MiB internally). null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.master_ram == null || var.master_ram >= 1
error_message = "master_ram must be null or at least 1 GiB."
}
}
variable "master_vlan" {
description = "Master role VLAN override. null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.master_vlan == null || var.master_vlan >= 1
error_message = "master_vlan must be null or at least 1."
}
}
variable "worker_count" {
description = "Worker role VM count override. null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.worker_count == null || var.worker_count >= 1
error_message = "worker_count must be null or at least 1."
}
}
variable "worker_cpu" {
description = "Worker role CPU override. null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.worker_cpu == null || var.worker_cpu >= 1
error_message = "worker_cpu must be null or at least 1."
}
}
variable "worker_ram" {
description = "Worker role RAM override in GiB (converted to MiB internally). null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.worker_ram == null || var.worker_ram >= 1
error_message = "worker_ram must be null or at least 1 GiB."
}
}
variable "worker_vlan" {
description = "Worker role VLAN override. null keeps the vm_attr default."
type = number
default = null
validation {
condition = var.worker_vlan == null || var.worker_vlan >= 1
error_message = "worker_vlan must be null or at least 1."
}
}
variable "vm_env" {
description = "VM environment"
type = string
default = "prod"
}