Compare commits

..

3 Commits

Author SHA1 Message Date
3a57faf55c add stirling pdf deployment 2026-07-21 15:28:16 +00:00
c18e167506 add tracearr 2026-07-20 14:40:33 +00:00
616d4d10a7 add tracearr 2026-07-20 14:39:30 +00:00
7 changed files with 361 additions and 10 deletions

View File

@@ -14,3 +14,11 @@ docker-test ansible_host=10.100.5.90 ansible_user=ansible ansible_python_interpr
[tracearr_servers]
tracearr ansible_host=10.100.5.102 ansible_user=ansible ansible_python_interpreter=/usr/bin/python3
# END ANSIBLE MANAGED tracearr
# BEGIN ANSIBLE MANAGED stirling-pdf
[stirling_pdf_servers]
stirling-pdf ansible_host=10.100.5.105 ansible_user=ansible ansible_python_interpreter=/usr/bin/python3
# END ANSIBLE MANAGED stirling-pdf
# BEGIN ANSIBLE MANAGED passwordpusher
[passwordpusher_servers]
passwordpusher ansible_host=10.100.5.104 ansible_user=ansible ansible_python_interpreter=/usr/bin/python3
# END ANSIBLE MANAGED passwordpusher

View File

@@ -1,5 +1,5 @@
---
# Playbook: create-docker-lxc.yml
# Playbook: create-docker.yml
#
# But:
# - Creer un conteneur LXC Proxmox pret pour Docker
@@ -21,18 +21,18 @@
# -e lxc_disk=20 \
# -e lxc_inventory_group=tracearr_servers
- name: Creer un LXC pret pour Docker
- name: Creer un LXC pret
hosts: "{{ target_node }}"
become: false
gather_facts: false
vars:
# Identite du conteneur LXC
lxc_ctid: 900
lxc_hostname: docker-test
lxc_ctid: 105
lxc_hostname: passwordpusher
# Configuration reseau du conteneur
lxc_ip: 10.100.5.90/24
lxc_ip: 10.100.5.104/24
lxc_gateway: 10.100.5.1
lxc_bridge: vmbr0
@@ -46,10 +46,10 @@
lxc_template: debian-13-standard_13.1-2_amd64.tar.zst
# Ressources du conteneur
lxc_cores: 1
lxc_memory: 512
lxc_swap: 512
lxc_disk: 8
lxc_cores: 2
lxc_memory: 2048
lxc_swap: 1024
lxc_disk: 15
# IP du serveur Ansible
# Cette IP sera utilisee dans authorized_keys pour limiter la cle SSH
@@ -60,7 +60,7 @@
# Groupe Ansible ajoute dans inventory/hosts.ini
# Exemple:
# lxc_hostname=tracearr -> tracearr_servers
# lxc_hostname=tracearr -> passwordpusher_servers
lxc_inventory_group: "{{ lxc_hostname | replace('-', '_') }}_servers"
# Parametres Ansible du futur conteneur

View File

@@ -0,0 +1,94 @@
---
# Playbook: deploy-stirling-pdf.yml
#
# But:
# - Copier le docker-compose.yml Stirling PDF sur le LXC
# - Creer les dossiers de donnees
# - Demarrer la stack Docker Compose
# - Verifier que le port 8080 repond
#
# Le docker-compose.yml reste dans Git.
# Les donnees de Stirling PDF restent sur le LXC dans /opt/stacks/stirling-pdf.
- name: Deployer Stirling PDF
hosts: stirling_pdf_servers
become: true
gather_facts: false
vars:
stack_name: stirling-pdf
stack_path: /opt/stacks/stirling-pdf
compose_source: "{{ playbook_dir }}/../services/stirling-pdf/docker-compose.yml"
tasks:
- name: Verifier que Docker est installe
command: docker --version
changed_when: false
- name: Verifier que Docker Compose est installe
command: docker compose version
changed_when: false
- name: Creer le dossier de la stack
file:
path: "{{ stack_path }}"
state: directory
owner: root
group: root
mode: "0750"
- name: Creer le dossier de donnees
file:
path: "{{ stack_path }}/stirling-data"
state: directory
owner: root
group: root
mode: "0755"
- name: Creer les sous dossiers de donnees
file:
path: "{{ stack_path }}/stirling-data/{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
loop:
- tessdata
- configs
- logs
- pipeline
- name: Copier le fichier Docker Compose
copy:
src: "{{ compose_source }}"
dest: "{{ stack_path }}/docker-compose.yml"
owner: root
group: root
mode: "0644"
- name: Telecharger les images Docker
command: docker compose pull
args:
chdir: "{{ stack_path }}"
- name: Demarrer la stack Stirling PDF
command: docker compose up -d
args:
chdir: "{{ stack_path }}"
- name: Attendre le port Stirling PDF
wait_for:
host: 127.0.0.1
port: 8080
timeout: 180
- name: Afficher les conteneurs de la stack
command: docker compose ps
args:
chdir: "{{ stack_path }}"
register: compose_ps
changed_when: false
- name: Afficher le statut Docker Compose
debug:
var: compose_ps.stdout_lines

View File

@@ -0,0 +1,106 @@
---
# Playbook: deploy-tracearr.yml
#
# But:
# - Copier le docker-compose.yml Tracearr sur le LXC
# - Generer les secrets si absents
# - Demarrer la stack Tracearr
# - Verifier que le port 3000 repond
#
# Les secrets sont crees directement sur le LXC.
# Ils ne sont pas stockes dans Git.
- name: Deploy Tracearr stack
hosts: tracearr_servers
become: true
gather_facts: false
vars:
stack_name: tracearr
stack_path: /opt/stacks/tracearr
tasks:
- name: Create stack directory
file:
path: "{{ stack_path }}"
state: directory
owner: root
group: root
mode: "0750"
- name: Create secrets directory
file:
path: "{{ stack_path }}/secrets"
state: directory
owner: root
group: root
mode: "0700"
- name: Copy Docker Compose file
copy:
src: "{{ playbook_dir }}/../services/tracearr/docker-compose.yml"
dest: "{{ stack_path }}/docker-compose.yml"
owner: root
group: root
mode: "0644"
- name: Generate Tracearr secrets if missing
shell: |
set -e
umask 077
if [ ! -s "{{ stack_path }}/secrets/db_password" ]; then
openssl rand -hex 32 > "{{ stack_path }}/secrets/db_password"
fi
if [ ! -s "{{ stack_path }}/secrets/jwt_secret" ]; then
openssl rand -hex 32 > "{{ stack_path }}/secrets/jwt_secret"
fi
if [ ! -s "{{ stack_path }}/secrets/cookie_secret" ]; then
openssl rand -hex 32 > "{{ stack_path }}/secrets/cookie_secret"
fi
if [ ! -s "{{ stack_path }}/secrets/better_auth_secret" ]; then
openssl rand -hex 32 > "{{ stack_path }}/secrets/better_auth_secret"
fi
if [ ! -s "{{ stack_path }}/secrets/database_url" ]; then
DB_PASSWORD="$(cat "{{ stack_path }}/secrets/db_password")"
printf "postgres://tracearr:%s@timescale:5432/tracearr" "$DB_PASSWORD" > "{{ stack_path }}/secrets/database_url"
fi
chown -R root:root "{{ stack_path }}/secrets"
chmod 700 "{{ stack_path }}/secrets"
chmod 644 "{{ stack_path }}/secrets/"*
args:
executable: /bin/bash
no_log: true
changed_when: true
- name: Pull Tracearr stack images
command: docker compose pull
args:
chdir: "{{ stack_path }}"
- name: Start Tracearr stack
command: docker compose up -d
args:
chdir: "{{ stack_path }}"
- name: Wait for Tracearr port
wait_for:
host: 127.0.0.1
port: 3000
timeout: 180
- name: Show Tracearr containers
command: docker compose ps
args:
chdir: "{{ stack_path }}"
register: compose_ps
changed_when: false
- name: Show compose status
debug:
var: compose_ps.stdout_lines

View File

@@ -0,0 +1,15 @@
services:
stirling-pdf:
image: stirlingtools/stirling-pdf:latest
container_name: stirling-pdf
ports:
- '8080:8080'
volumes:
- ./stirling-data/tessdata:/usr/share/tessdata # OCR language files
- ./stirling-data/configs:/configs # Settings & database
- ./stirling-data/logs:/logs # Application logs
- ./stirling-data/pipeline:/pipeline # Automation configs
environment:
- SECURITY_ENABLELOGIN=true
- SYSTEM_DEFAULTLOCALE=fr-FR
restart: unless-stopped

View File

@@ -0,0 +1,128 @@
---
# Stack: tracearr
#
# But:
# - Deployer Tracearr avec TimescaleDB et Redis
# - Eviter les mots de passe en clair dans Git
# - Stocker les secrets dans /opt/stacks/tracearr/secrets
#
# Notes:
# - Le fichier .env de production n est pas utilise
# - Les secrets sont lus depuis des fichiers Docker secrets
services:
tracearr:
image: ghcr.io/connorgallopo/tracearr:latest
container_name: tracearr
restart: unless-stopped
depends_on:
timescale:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "3000:3000"
environment:
NODE_ENV: production
PORT: "3000"
HOST: 0.0.0.0
TZ: Europe/Paris
DATABASE_URL_FILE: /run/secrets/database_url
REDIS_URL: redis://redis:6379
JWT_SECRET_FILE: /run/secrets/jwt_secret
COOKIE_SECRET_FILE: /run/secrets/cookie_secret
BETTER_AUTH_SECRET_FILE: /run/secrets/better_auth_secret
CORS_ORIGIN: https://tracearr.thomasmlg.fr
LOG_LEVEL: info
secrets:
- database_url
- jwt_secret
- cookie_secret
- better_auth_secret
volumes:
- tracearr_backups:/data/backup
networks:
- tracearr_network
timescale:
image: timescale/timescaledb-ha:pg18.1-ts2.25.0
container_name: tracearr-db
restart: unless-stopped
shm_size: 512mb
ulimits:
nofile:
soft: 65536
hard: 65536
command: >
postgres
-c timescaledb.license=timescale
-c timescaledb.max_tuples_decompressed_per_dml_transaction=0
-c max_locks_per_transaction=4096
-c timescaledb.telemetry_level=off
environment:
POSTGRES_USER: tracearr
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
POSTGRES_DB: tracearr
secrets:
- db_password
volumes:
- timescale_data:/home/postgres/pgdata/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tracearr"]
interval: 10s
timeout: 5s
retries: 5
networks:
- tracearr_network
redis:
image: redis:8-alpine
container_name: tracearr-redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- tracearr_network
secrets:
db_password:
file: ./secrets/db_password
database_url:
file: ./secrets/database_url
jwt_secret:
file: ./secrets/jwt_secret
cookie_secret:
file: ./secrets/cookie_secret
better_auth_secret:
file: ./secrets/better_auth_secret
networks:
tracearr_network:
driver: bridge
volumes:
tracearr_backups:
timescale_data:
redis_data: