Add Odod
Bu işleme şunda yer alıyor:
69
Services/odoo/odoo-entrypoint.sh
Normal dosya
69
Services/odoo/odoo-entrypoint.sh
Normal dosya
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Valori di default
|
||||||
|
ADMIN_PASSWD="${ADMIN_PASSWD:-Password123}"
|
||||||
|
DB_HOST="${DB_HOST:-localhost}"
|
||||||
|
DB_PORT="${DB_PORT:-5432}"
|
||||||
|
DB_USER="${DB_USER:-odoo}"
|
||||||
|
DB_PASSWORD="${DB_PASSWORD:-odoo}"
|
||||||
|
DB_NAME="${DB_NAME:-}"
|
||||||
|
LIST_DB="True"
|
||||||
|
|
||||||
|
# Se db_name è impostata, imposta list_db=false
|
||||||
|
if [ -n "$DB_NAME" ]; then
|
||||||
|
LIST_DB="False"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Crea la directory di configurazione in /opt/odoo
|
||||||
|
mkdir -p /opt/odoo
|
||||||
|
|
||||||
|
# Crea il file di configurazione Odoo con i valori delle variabili d'ambiente
|
||||||
|
cat > /opt/odoo/odoo.conf << EOF
|
||||||
|
[options]
|
||||||
|
; Server Configuration
|
||||||
|
admin_passwd = $ADMIN_PASSWD
|
||||||
|
db_host = $DB_HOST
|
||||||
|
db_port = $DB_PORT
|
||||||
|
db_user = $DB_USER
|
||||||
|
db_password = $DB_PASSWORD
|
||||||
|
db_name = $DB_NAME
|
||||||
|
list_db = $LIST_DB
|
||||||
|
|
||||||
|
; File Paths
|
||||||
|
addons_path = /opt/odoo/odoo-server/addons,/opt/odoo/custom_addons
|
||||||
|
data_dir = /opt/odoo/data
|
||||||
|
|
||||||
|
; Logging
|
||||||
|
log_file = /opt/odoo/odoo.log
|
||||||
|
log_level = info
|
||||||
|
|
||||||
|
; Workers (optional, for production)
|
||||||
|
workers = 4
|
||||||
|
gevent_port = 8072
|
||||||
|
|
||||||
|
; Other Settings
|
||||||
|
max_cron_threads = 2
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Attiva il virtual environment
|
||||||
|
source /opt/odoo/venv/bin/activate
|
||||||
|
|
||||||
|
# Vai nella directory di Odoo
|
||||||
|
cd /opt/odoo/odoo-server
|
||||||
|
|
||||||
|
# Se il file .odoo_initialized non esiste, inizializza il database e crea l'utente admin
|
||||||
|
if [ ! -f /opt/odoo/.odoo_initialized ]; then
|
||||||
|
echo "Inizializzazione del database..."
|
||||||
|
|
||||||
|
# Inizializza il database
|
||||||
|
./odoo-bin -c /opt/odoo/odoo.conf -i base --stop-after-init --without-demo
|
||||||
|
|
||||||
|
# Crea il file di flag per indicare che l'inizializzazione è completata
|
||||||
|
touch /opt/odoo/.odoo_initialized
|
||||||
|
|
||||||
|
echo "Database inizializzato."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Avvia Odoo
|
||||||
|
exec ./odoo-bin -c /opt/odoo/odoo.conf
|
||||||
94
Services/odoo/odoo.ContainerFile
Normal dosya
94
Services/odoo/odoo.ContainerFile
Normal dosya
@@ -0,0 +1,94 @@
|
|||||||
|
# syntax=docker/dockerfile:1.9
|
||||||
|
# Build: podman build -t odoo:19-amd64 -f odoo.ContainerFile .
|
||||||
|
# Export: podman save -o /home/badstorm/odoo-19-amd64.tar localhost/odoo:19-amd64
|
||||||
|
# Podman Containerfile for Odoo 19
|
||||||
|
|
||||||
|
# Use Debian Trixie as base
|
||||||
|
FROM debian:13-slim
|
||||||
|
|
||||||
|
# Avoid interactive prompts during package installation
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
git \
|
||||||
|
python3 \
|
||||||
|
python3-dev \
|
||||||
|
python3-venv \
|
||||||
|
libxml2-dev \
|
||||||
|
libxslt1-dev \
|
||||||
|
libjpeg-dev \
|
||||||
|
libpng-dev \
|
||||||
|
libopenjp2-7-dev \
|
||||||
|
libtiff-dev \
|
||||||
|
build-essential \
|
||||||
|
libssl-dev \
|
||||||
|
libffi-dev \
|
||||||
|
libpq-dev \
|
||||||
|
postgresql-client \
|
||||||
|
libldap2-dev \
|
||||||
|
libsasl2-dev \
|
||||||
|
curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install wkhtmltopdf
|
||||||
|
RUN curl -sSL -o /tmp/wkhtmltox.deb "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb" \
|
||||||
|
&& apt-get update && apt-get install -y /tmp/wkhtmltox.deb \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/wkhtmltox.deb
|
||||||
|
|
||||||
|
# Create odoo user
|
||||||
|
RUN useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
|
||||||
|
|
||||||
|
# Create necessary directories
|
||||||
|
RUN mkdir -p /opt/odoo/custom_addons \
|
||||||
|
&& mkdir -p /opt/odoo/data \
|
||||||
|
&& mkdir -p /opt/odoo/data/filestore \
|
||||||
|
&& mkdir -p /opt/odoo/log \
|
||||||
|
&& chown -R odoo:odoo /opt/odoo \
|
||||||
|
&& chown -R odoo:odoo /opt/odoo/log \
|
||||||
|
&& chmod -R 755 /opt/odoo \
|
||||||
|
&& chmod -R 775 /opt/odoo/data \
|
||||||
|
&& chmod -R 775 /opt/odoo/log
|
||||||
|
|
||||||
|
# Clone Odoo repository
|
||||||
|
WORKDIR /opt/odoo
|
||||||
|
RUN git clone https://github.com/odoo/odoo.git --depth 1 --branch 19.0 odoo-server
|
||||||
|
|
||||||
|
# Create virtual environment
|
||||||
|
RUN python3 -m venv venv
|
||||||
|
|
||||||
|
# Install Python dependencies
|
||||||
|
RUN /opt/odoo/venv/bin/pip install --upgrade pip \
|
||||||
|
&& /opt/odoo/venv/bin/pip install -r /opt/odoo/odoo-server/requirements.txt \
|
||||||
|
&& /opt/odoo/venv/bin/pip install phonenumbers
|
||||||
|
|
||||||
|
# Create Odoo config directory in /opt/odoo (writable by odoo user)
|
||||||
|
RUN mkdir -p /opt/odoo \
|
||||||
|
&& touch /opt/odoo/odoo.conf \
|
||||||
|
&& chown odoo:odoo /opt/odoo/odoo.conf \
|
||||||
|
&& chmod 640 /opt/odoo/odoo.conf
|
||||||
|
|
||||||
|
# Environment variables for database configuration
|
||||||
|
ENV DB_HOST=postgres
|
||||||
|
ENV DB_PORT=5432
|
||||||
|
ENV DB_USER=odoo
|
||||||
|
ENV DB_NAME=mydb
|
||||||
|
ENV DB_PASSWORD=odoo
|
||||||
|
ENV ADMIN_PASSWD=my_admin_password
|
||||||
|
|
||||||
|
# Expose Odoo ports
|
||||||
|
EXPOSE 8069 8072
|
||||||
|
|
||||||
|
# Volume for custom addons
|
||||||
|
VOLUME ["/opt/odoo/custom_addons"]
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /opt/odoo/odoo-server
|
||||||
|
|
||||||
|
# Copy entrypoint script and admin creation script
|
||||||
|
COPY odoo-entrypoint.sh /odoo-entrypoint.sh
|
||||||
|
RUN chmod +x /odoo-entrypoint.sh
|
||||||
|
|
||||||
|
# Start Odoo
|
||||||
|
USER odoo
|
||||||
|
ENTRYPOINT ["/odoo-entrypoint.sh"]
|
||||||
27
Services/odoo/odoo.container
Normal dosya
27
Services/odoo/odoo.container
Normal dosya
@@ -0,0 +1,27 @@
|
|||||||
|
[Container]
|
||||||
|
ContainerName=odoo
|
||||||
|
Image=localhost/odoo:19-amd64
|
||||||
|
#AutoUpdate=registry
|
||||||
|
Network=internal.network
|
||||||
|
PublishPort=8069:8069
|
||||||
|
PublishPort=8072:8072
|
||||||
|
|
||||||
|
# Custom addons volume
|
||||||
|
Volume=/srv/containers/odoo/custom_addons:/opt/odoo/custom_addons
|
||||||
|
Volume=/srv/containers/odoo/filestore:/opt/odoo/data/filestore
|
||||||
|
|
||||||
|
# Database connection (adjust host if needed)
|
||||||
|
Environment=ADMIN_PASSWD=my_admin_password
|
||||||
|
Environment=DB_HOST=postgres
|
||||||
|
Environment=DB_PORT=5432
|
||||||
|
Environment=DB_USER=odoo
|
||||||
|
Environment=DB_PASSWORD=odoo
|
||||||
|
Environment=DB_NAME=mydb
|
||||||
|
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=on-failure
|
||||||
|
TimeoutStartSec=15m
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target default.target
|
||||||
12
Services/postgres.README
Normal dosya
12
Services/postgres.README
Normal dosya
@@ -0,0 +1,12 @@
|
|||||||
|
# Create DB
|
||||||
|
|
||||||
|
Create User
|
||||||
|
$ podman exec -it postgres psql -U postgres -c "CREATE USER [nome_progetto] WITH password '[password_db_progetto]';"
|
||||||
|
|
||||||
|
Or with CREATEDB
|
||||||
|
$ podman exec -it postgres psql -U postgres -c "CREATE USER [nome_progetto] WITH password '[password_db_progetto]' CREATEDB;"
|
||||||
|
|
||||||
|
Create DB
|
||||||
|
$ podman exec -it postgres psql -U postgres -c "CREATE DATABASE [nome_progetto];"
|
||||||
|
$ podman exec -it postgres psql -U postgres -c "GRANT ALL privileges ON DATABASE [nome_progetto] TO [nome_progetto];"
|
||||||
|
$ podman exec -it postgres psql -U postgres -d [nome_progetto] -c "GRANT CREATE ON SCHEMA public TO [nome_progetto];"
|
||||||
Yeni konuda referans
Bir kullanıcı engelle