10 changed files with 223 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||||
|
FROM edge-registry.itix.fr/demo-edge-retail/generic:latest |
||||
|
|
||||
|
ARG ADMIN_USERNAME=demo \ |
||||
|
ADMIN_PASSWORD=redhat |
||||
|
|
||||
|
RUN <<EOF |
||||
|
set -Eeuo pipefail |
||||
|
|
||||
|
dnf config-manager --enable ansible-automation-platform-2.5-for-rhel-9-$(arch)-rpms |
||||
|
dnf install -y mkpasswd podman skopeo flightctl-agent |
||||
|
|
||||
|
if [ -n "$ADMIN_USERNAME" ]; then |
||||
|
useradd -m -G wheel -p "$(echo -n "$ADMIN_PASSWORD" | mkpasswd -m bcrypt --stdin)" "$ADMIN_USERNAME" |
||||
|
fi |
||||
|
EOF |
||||
|
|
||||
|
ADD --chown=root:root root / |
||||
|
|
||||
|
RUN <<EOF |
||||
|
set -Eeuo pipefail |
||||
|
systemctl enable flightctl-agent.service |
||||
|
systemctl mask bootc-fetch-apply-updates.timer |
||||
|
EOF |
||||
@ -0,0 +1 @@ |
|||||
|
TARGET_IMAGE="edge-registry.itix.fr/demo-edge-retail/scenario1:latest" |
||||
@ -0,0 +1,6 @@ |
|||||
|
DATABASE=itix |
||||
|
ADMIN_PASSWORD=S3cr3t! |
||||
|
RIBBON_COLOR=rgba(0,0,255,.6) |
||||
|
RIBBON_NAME=TEST<br/>({db_name}) |
||||
|
#RIBBON_COLOR=rgba(255,0,0,.6) |
||||
|
#RIBBON_NAME=PROD<br/>({db_name}) |
||||
@ -0,0 +1,5 @@ |
|||||
|
POSTGRES_USER=odoo |
||||
|
POSTGRES_PASSWORD=odoo |
||||
|
POSTGRES_DB=postgres |
||||
|
POSTGRES_HOST_AUTH_METHOD=scram-sha-256 |
||||
|
POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 |
||||
@ -0,0 +1,43 @@ |
|||||
|
[Unit] |
||||
|
Description=Odoo |
||||
|
Documentation=https://www.odoo.com/documentation/ |
||||
|
|
||||
|
# Require initialization to complete first |
||||
|
Requires=odoo-init.service odoo-db.service |
||||
|
After=odoo-init.service odoo-db.service |
||||
|
|
||||
|
# Only start if initialization has completed |
||||
|
ConditionPathExists=/var/lib/odoo/initialized |
||||
|
|
||||
|
[Container] |
||||
|
ContainerName=odoo-app |
||||
|
Image=docker.io/library/odoo:17 |
||||
|
|
||||
|
# Network configuration |
||||
|
Network=host |
||||
|
AddCapability=CAP_NET_BIND_SERVICE |
||||
|
|
||||
|
# Volume mounts |
||||
|
Volume=/etc/odoo:/etc/odoo:ro |
||||
|
Volume=/var/lib/odoo/data:/var/lib/odoo:z |
||||
|
Volume=/var/lib/odoo/addons:/mnt/extra-addons:z |
||||
|
Volume=/var/log/odoo:/var/log/odoo:z |
||||
|
|
||||
|
# Health check |
||||
|
HealthCmd=curl -fs -o /dev/null -w "%{http_code}\n" http://127.0.0.1/web/login |
||||
|
HealthInterval=30s |
||||
|
HealthTimeout=10s |
||||
|
HealthStartPeriod=60s |
||||
|
HealthRetries=3 |
||||
|
|
||||
|
[Service] |
||||
|
Restart=always |
||||
|
RestartSec=10 |
||||
|
TimeoutStartSec=600 |
||||
|
TimeoutStopSec=30 |
||||
|
|
||||
|
# Wait for PostgreSQL to be ready |
||||
|
ExecStartPre=/bin/sh -c 'exec 2>/dev/null; for try in $(seq 0 12); do if ! /bin/true 5<> /dev/tcp/127.0.0.1/5432; then echo "Waiting for PostgreSQL to be available..."; sleep 5; else exit 0; fi; done; exit 1' |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=odoo.target |
||||
@ -0,0 +1,37 @@ |
|||||
|
[Unit] |
||||
|
Description=PostgreSQL Database Server |
||||
|
Documentation=https://www.postgresql.org/ |
||||
|
After=network.target |
||||
|
|
||||
|
[Container] |
||||
|
ContainerName=odoo-db |
||||
|
Image=docker.io/library/postgres:17-alpine |
||||
|
|
||||
|
# Network configuration |
||||
|
Network=host |
||||
|
|
||||
|
# Security context (equivalent to K8s securityContext) |
||||
|
#NoNewPrivileges=true |
||||
|
#DropCapability=ALL |
||||
|
|
||||
|
# Environment variables from config |
||||
|
EnvironmentFile=/etc/containers/systemd/configs/odoo-db.env |
||||
|
|
||||
|
# Volume mounts |
||||
|
Volume=/var/lib/postgresql/data:/var/lib/postgresql/data:Z |
||||
|
|
||||
|
# Health check |
||||
|
HealthCmd=pg_isready -U odoo |
||||
|
HealthInterval=30s |
||||
|
HealthTimeout=10s |
||||
|
HealthStartPeriod=60s |
||||
|
HealthRetries=3 |
||||
|
|
||||
|
[Service] |
||||
|
Restart=always |
||||
|
RestartSec=10 |
||||
|
TimeoutStartSec=120 |
||||
|
TimeoutStopSec=30 |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=odoo.target |
||||
@ -0,0 +1,48 @@ |
|||||
|
[Unit] |
||||
|
Description=Odoo initialization service |
||||
|
Documentation=https://www.odoo.com/documentation/ |
||||
|
|
||||
|
Requires=odoo-db.service |
||||
|
After=odoo-db.service |
||||
|
Before=odoo-app.service |
||||
|
|
||||
|
# Prevent running if already initialized |
||||
|
ConditionPathExists=!/var/lib/odoo/initialized |
||||
|
|
||||
|
[Container] |
||||
|
ContainerName=odoo-init |
||||
|
Image=docker.io/library/odoo:17 |
||||
|
|
||||
|
# Network configuration |
||||
|
Network=host |
||||
|
AddCapability=CAP_NET_BIND_SERVICE |
||||
|
|
||||
|
# Environment variables from secrets and config |
||||
|
EnvironmentFile=/etc/containers/systemd/configs/odoo-config.env |
||||
|
|
||||
|
# Volume mounts |
||||
|
Volume=/etc/odoo:/etc/odoo:ro |
||||
|
Volume=/var/lib/odoo/data:/var/lib/odoo:z |
||||
|
Volume=/var/lib/odoo/addons:/mnt/extra-addons:z |
||||
|
Volume=/var/log/odoo:/var/log/odoo:z |
||||
|
|
||||
|
# Initialization script |
||||
|
Entrypoint=/bin/bash |
||||
|
Exec=/etc/odoo/init.sh |
||||
|
|
||||
|
[Service] |
||||
|
Type=oneshot |
||||
|
Restart=no |
||||
|
RemainAfterExit=yes |
||||
|
|
||||
|
# Flag this service as initialized |
||||
|
ExecStartPost=/bin/touch /var/lib/odoo/initialized |
||||
|
|
||||
|
# Skaffold filesystem + fix permissions |
||||
|
ExecStartPre=/bin/sh -c 'for d in /var/lib/odoo/data /var/lib/odoo/addons /var/log/odoo; do mkdir -p "$d" ; chmod 700 "$d" ; chown 101:101 "$d" ; done' |
||||
|
|
||||
|
# Wait for PostgreSQL to be ready |
||||
|
ExecStartPre=/bin/sh -c 'exec 2>/dev/null; for try in $(seq 0 12); do if ! /bin/true 5<> /dev/tcp/127.0.0.1/5432; then echo "Waiting for PostgreSQL to be available..."; sleep 5; else exit 0; fi; done; exit 1' |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=odoo.target |
||||
@ -0,0 +1,36 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
## |
||||
|
## This script initializes the Odoo application environment. |
||||
|
## |
||||
|
|
||||
|
set -Eeuo pipefail |
||||
|
|
||||
|
echo "Downloading OCA addons..." |
||||
|
curl -sSfL https://github.com/OCA/web/archive/refs/heads/17.0.tar.gz | tar -xz -C /mnt/extra-addons --strip-components=1 |
||||
|
|
||||
|
echo "Initializing database '$DATABASE'..." |
||||
|
odoo -c /etc/odoo/odoo.conf --logfile=/dev/stdout --no-http --stop-after-init -d $DATABASE --init base |
||||
|
|
||||
|
if [ -n "${RIBBON_NAME}${RIBBON_COLOR}" ]; then |
||||
|
echo "Installing Web Environment Ribbon module..." |
||||
|
odoo -c /etc/odoo/odoo.conf --logfile=/dev/stdout --no-http --stop-after-init -d $DATABASE --init web_environment_ribbon |
||||
|
fi |
||||
|
|
||||
|
echo "Installing Point of Sale module..." |
||||
|
odoo -c /etc/odoo/odoo.conf --logfile=/dev/stdout --no-http --stop-after-init -d $DATABASE --init point_of_sale |
||||
|
|
||||
|
echo "Setting admin password and ribbon color..." |
||||
|
odoo shell -c /etc/odoo/odoo.conf -d $DATABASE <<EOF |
||||
|
import os |
||||
|
if os.getenv("ADMIN_PASSWORD") is not None: |
||||
|
env['res.users'].search([('login', '=', 'admin')]).password = os.environ["ADMIN_PASSWORD"] |
||||
|
if os.getenv("RIBBON_COLOR") is not None: |
||||
|
env['ir.config_parameter'].sudo().set_param('ribbon.background.color', os.environ["RIBBON_COLOR"]) |
||||
|
if os.getenv("RIBBON_NAME") is not None: |
||||
|
env['ir.config_parameter'].sudo().set_param('ribbon.name', os.environ["RIBBON_NAME"]) |
||||
|
env.cr.commit() |
||||
|
exit() |
||||
|
EOF |
||||
|
|
||||
|
echo "Odoo initialization completed." |
||||
@ -0,0 +1,12 @@ |
|||||
|
[options] |
||||
|
addons_path = /mnt/extra-addons |
||||
|
data_dir = /var/lib/odoo |
||||
|
admin_passwd = $pbkdf2-sha512$600000$G6OU8j7HuBdCyBnDeE/pnQ$rtoycI6N7hJW37qeLLesYPWyfk8HsXD9HnsMtzkkU.pciBgd4bc0kV4Z2mI5cctjRIZf/RTOYAX5BvSjbwMxsA |
||||
|
db_host = localhost |
||||
|
db_port = 5432 |
||||
|
db_user = odoo |
||||
|
db_password = odoo |
||||
|
logfile = /var/log/odoo/odoo.log |
||||
|
log_level = info |
||||
|
http_port = 80 |
||||
|
http_interface = 0.0.0.0 |
||||
@ -0,0 +1,12 @@ |
|||||
|
[Unit] |
||||
|
Description=Odoo Service Target |
||||
|
Documentation=man:systemd.target(5) |
||||
|
# This target represents the complete MyApp service stack |
||||
|
# It groups both the init and main services together |
||||
|
Wants=odoo-db.service odoo-init.service odoo-app.service |
||||
|
After=odoo-db.service odoo-init.service odoo-app.service |
||||
|
# Allow isolation - can stop/start this target independently |
||||
|
AllowIsolate=yes |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=multi-user.target |
||||
Loading…
Reference in new issue