1 Commits

Author SHA1 Message Date
b88af8605c added export button 2026-02-20 16:41:27 +03:30
37 changed files with 579 additions and 990 deletions

View File

@@ -9,26 +9,23 @@ INSECURE=true
## Features ##
# The following variable is a convenience variable to enable or disable features of this compose project.
# Root docker-compose.yml starts Traefik only; always include opencloud/opencloud.yml for OpenCloud.
# Example: baseline OpenCloud with Traefik
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml
# Example: if you want to use traefik and letsencrypt, you can set the variable to
#COMPOSE_FILE=docker-compose.yml:traefik/opencloud.yml
# This enables you to just run `docker compose up -d` and the compose files will be added to the stack.
# As alternative approach you can run `docker compose -f docker-compose.yml -f opencloud/opencloud.yml up -d`
# OpenCloud and Collabora with Traefik and Let's Encrypt
# As alternative approach you can run `docker compose -f docker-compose.yml -f docker-compose.traefik.yml up -d`
# Default: OpenCloud and Collabora with traefik and letsencypt
# This needs DNS entries for the domain names used in the .env file.
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
# If you want to use the external proxy, you can use the following combination.
# DNS entries and certificates need to be managed by the external environment.
# The domain names need to be entered into the .env file.
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml
# Keycloak Shared User Directory
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml:idm/ldap-keycloak.yml:traefik/ldap-keycloak.yml
# OpenCloud and Gitea (shared Postgres)
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:version-control/gitea.yml:database/postgres.yml
# Odoo, Gitea, and OpenCloud (shared Postgres; include odoo-init on first start)
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:odoo/odoo.yml:odoo/odoo-init.yml:version-control/gitea.yml:database/postgres.yml
# Odoo, Gitea, OpenCloud, Postgres, with backup and restore helpers
#COMPOSE_FILE=docker-compose.yml:odoo/odoo.yml:opencloud/opencloud.yml:version-control/gitea.yml:database/postgres.yml:backup/backup.yml:odoo/odoo-init.yml:backup/restore.yml
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml:idm/ldap-keycloak.yml:traefik/ldap-keycloak.yml
# OpenCloud, Planka and Gitea
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:project/planka.yml:version-control/gitea.yml:traefik/opencloud.yml:traefik/planka.yml:database/postgres.yml:traefik/gitea.yml
# Odoo, Gitea, opencloud
#Compose_File=docker-compose.yml:odoo/odoo.yml:opencloud/opencloud.yml:version-control/gitea.yml:traefik/opencloud.yml:traefik/planka.yml:database/postgres.yml:traefik/gitea.yml:traefik/odoo.yml
## Traefik Settings ##
# Note: Traefik is always enabled and can't be disabled.
@@ -54,19 +51,6 @@ TRAEFIK_ACME_MAIL=
TRAEFIK_ACME_CASERVER=
# Enable the Traefik ACME (Automatic Certificate Management Environment) for automatic SSL certificate management.
TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt"
# ACME challenge type. Set to "dns" for environments where inbound HTTP/HTTPS validation is not possible.
# Supported values: http, dns, tls
TRAEFIK_ACME_CHALLENGE=http
# DNS provider used by Traefik/lego when TRAEFIK_ACME_CHALLENGE=dns.
TRAEFIK_ACME_DNS_PROVIDER=cloudflare
# Delay (seconds) before DNS propagation check for DNS challenge.
TRAEFIK_ACME_DNS_DELAYBEFORECHECK=0
# Optional comma-separated DNS resolvers for propagation checks (host:port format).
# Example: TRAEFIK_ACME_DNS_RESOLVERS=1.1.1.1:53,8.8.8.8:53
TRAEFIK_ACME_DNS_RESOLVERS=
# Cloudflare API token for DNS challenge.
# Required when TRAEFIK_ACME_CHALLENGE=dns and TRAEFIK_ACME_DNS_PROVIDER=cloudflare.
CF_DNS_API_TOKEN=
# Enable Traefik to use local certificates.
#TRAEFIK_SERVICES_TLS_CONFIG="tls=true"
# You also need to provide a config file in ./config/traefik/dynamic/certs.yml
@@ -179,13 +163,6 @@ SMTP_TRANSPORT_ENCRYPTION=
# Allow insecure connections to the SMTP server. Defaults to false.
SMTP_INSECURE=
# Public link sharing — password enforcement
# Set to "false" to allow passwordless public links.
# Defaults to "true" in opencloud/opencloud.yml if not set.
OC_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD=false
# Set to "false" to also allow passwordless writable/upload public links.
OC_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD=false
# Additional services to be started on opencloud startup
# The following list of services is not started automatically and must be
# manually defined for startup:

334
.env.local Normal file
View File

@@ -0,0 +1,334 @@
## Basic Settings ##
# Define the docker compose log driver used.
# Defaults to local
LOG_DRIVER=
# If you're on an internet facing server, comment out following line.
# It skips certificate validation for various parts of OpenCloud and is
# needed when self signed certificates are used.
INSECURE=true
## Features ##
# The following variable is a convenience variable to enable or disable features of this compose project.
# Example: if you want to use traefik and letsencrypt, you can set the variable to
#COMPOSE_FILE=docker-compose.yml:traefik/opencloud.yml
# This enables you to just run `docker compose up -d` and the compose files will be added to the stack.
# As alternative approach you can run `docker compose -f docker-compose.yml -f docker-compose.traefik.yml up -d`
# Default: OpenCloud and Collabora with traefik and letsencypt
# This needs DNS entries for the domain names used in the .env file.
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
# If you want to use the external proxy, you can use the following combination.
# DNS entries and certificates need to be managed by the external environment.
# The domain names need to be entered into the .env file.
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml
# Keycloak Shared User Directory
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml:idm/ldap-keycloak.yml:traefik/ldap-keycloak.yml
# OpenCloud, Planka and Gitea
#COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:project/planka.yml:version-control/gitea.yml:traefik/opencloud.yml:traefik/planka.yml:database/postgres.yml:traefik/gitea.yml
# Odoo, Gitea, opencloud
COMPOSE_FILE=docker-compose.yml:odoo/odoo.yml:opencloud/opencloud.yml:version-control/gitea.yml:database/postgres.yml:backup/backup.yml:odoo/odoo-init.yml:backup/restore.yml
## Traefik Settings ##
# Note: Traefik is always enabled and can't be disabled.
# Serve Traefik dashboard.
# Defaults to "false".
TRAEFIK_DASHBOARD=true
# Domain of Traefik, where you can find the dashboard.
# Defaults to "traefik.opencloud.test"
TRAEFIK_DOMAIN=
# Basic authentication for the traefik dashboard.
# Defaults to user "admin" and password "admin" (written as: "admin:$2y$05$KDHu3xq92SPaO3G8Ybkc7edd51pPLJcG1nWk3lmlrIdANQ/B6r5pq").
# To create user:password pair, it's possible to use this command:
# echo $(htpasswd -nB user) | sed -e s/\\$/\\$\\$/g
TRAEFIK_BASIC_AUTH_USERS='rhino:$2y$05$eLdVPpxgk45NTnAkYSO2l.ilaIk8O3gdUToThih1iqn8XFTIMvkKC'
# Email address for obtaining LetsEncrypt certificates.
# Needs only be changed if this is a public facing server.
TRAEFIK_ACME_MAIL=
# Set to the following for testing to check the certificate process:
# "https://acme-staging-v02.api.letsencrypt.org/directory"
# With staging configured, there will be an SSL error in the browser.
# When certificates are displayed and are emitted by # "Fake LE Intermediate X1",
# the process went well and the envvar can be reset to empty to get valid certificates.
TRAEFIK_ACME_CASERVER=
# Enable the Traefik ACME (Automatic Certificate Management Environment) for automatic SSL certificate management.
#TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt"
# Enable Traefik to use local certificates.
TRAEFIK_SERVICES_TLS_CONFIG="tls=true"
# You also need to provide a config file in ./config/traefik/dynamic/certs.yml
# Example:
# cat ./config/traefik/dynamic/certs.yml
# tls:
# certificates:
# - certFile: /certs/opencloud.test.crt
# keyFile: /certs/opencloud.test.key
# stores:
# - default
#
# The certificates need to be copied into ./certs/, the absolute path inside the container is /certs/.
# You can also use TRAEFIK_CERTS_DIR=/path/on/host to set the path to the certificates directory.
# Enable the access log for Traefik by setting the following variable to true.
TRAEFIK_ACCESS_LOG=
# Configure the log level for Traefik.
# Possible values are "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL" and "PANIC". Default is "ERROR".
TRAEFIK_LOG_LEVEL=
## OpenCloud Settings ##
# The opencloud container image.
# For production releases: "opencloudeu/opencloud"
# For rolling releases: "opencloudeu/opencloud-rolling"
# Defaults to production if not set otherwise
OC_DOCKER_IMAGE=opencloudeu/opencloud
# The openCloud container version.
# Defaults to "latest" and points to the latest stable tag.
OC_DOCKER_TAG=
# Domain of openCloud, where you can find the frontend.
# Defaults to "cloud.opencloud.test"
OC_DOMAIN=
# Demo users should not be created on a production instance,
# because their passwords are public. Defaults to "false".
# If demo users is set to "true", the following user accounts are created automatically:
# alan, mary, margaret, dennis and lynn - the password is 'demo' for all.
DEMO_USERS=
# Admin Password for the OpenCloud admin user.
# NOTE: This is only needed when using the built-in LDAP server (idm).
# If you are using an external LDAP server, the admin password is managed by the LDAP server.
# NOTE: This variable needs to be set before the first start of OpenCloud. Changes to this variable after the first start will be IGNORED.
# If not set, opencloud will not work properly. The container will be restarting.
# After the first initialization, the admin password can only be changed via the OpenCloud User Settings UI or by using the OpenCloud CLI.
# Documentation: https://docs.opencloud.eu/docs/admin/resources/common-issues#-change-admin-password-set-in-env
INITIAL_ADMIN_PASSWORD=6789054321
# Define the openCloud loglevel used.
#
LOG_LEVEL="WARN"
# Define the kind of logging.
# The default log can be read by machines.
# Set this to true to make the log human readable.
# LOG_PRETTY=true
#
# Define the openCloud storage location. Set the paths for config and data to a local path.
# Ensure that the configuration and data directories are owned by the user and group with ID 1000:1000.
# This matches the default user inside the container and avoids permission issues when accessing files.
# Note that especially the data directory can grow big.
# Leaving it default stores data in docker internal volumes.
# OC_CONFIG_DIR=./opencloud_data/config
# OC_DATA_DIR=./opencloud_data/data
# OpenCloud Web can load extensions from a local directory.
# The default uses the bind mount to the config/opencloud/apps directory.
# Example: curl -L https://github.com/opencloud-eu/web-extensions/releases/download/unzip-v1.0.2/unzip-1.0.2.zip | tar -xz -C config/opencloud/apps
# NOTE: you need to restart the openCloud container to load the new extensions.
# OC_APPS_DIR=/your/local/opencloud/apps
# Define the ldap-server storage location. Set the paths for config and data to a local path.
# LDAP_CERTS_DIR=
# LDAP_DATA_DIR=
# S3 Storage configuration - optional
# OpenCloud supports S3 storage as primary storage.
# Per default, S3 storage is disabled and the decomposed storage driver is used.
# To enable S3 storage, add `storage/decomposeds3.yml` to the COMPOSE_FILE variable or to
# your startup command (`docker compose -f docker-compose.yml -f storage/decomposeds3.yml up`).
#
# Configure the S3 storage endpoint. Defaults to "http://minio:9000" for testing purposes.
DECOMPOSEDS3_ENDPOINT=
# S3 region. Defaults to "default".
DECOMPOSEDS3_REGION=
# S3 access key. Defaults to "opencloud"
DECOMPOSEDS3_ACCESS_KEY=
# S3 secret. Defaults to "opencloud-secret-key"
DECOMPOSEDS3_SECRET_KEY=
# S3 bucket. Defaults to "opencloud"
DECOMPOSEDS3_BUCKET=
# Define SMTP settings if you would like to send OpenCloud email notifications.
# To actually send notifications, you also need to enable the 'notifications' service
# by adding it to the START_ADDITIONAL_SERVICES variable below.
#
# NOTE: when configuring Inbucket, these settings have no effect, see inbucket.yml for details.
# SMTP host to connect to.
SMTP_HOST=
# Port of the SMTP host to connect to.
SMTP_PORT=
# An eMail address that is used for sending OpenCloud notification eMails
# like "opencloud notifications <noreply@yourdomain.com>".
SMTP_SENDER=
# Username for the SMTP host to connect to.
SMTP_USERNAME=
# Password for the SMTP host to connect to.
SMTP_PASSWORD=
# Authentication method for the SMTP communication.
SMTP_AUTHENTICATION=
# Encryption method for the SMTP communication. Possible values are 'starttls', 'ssltls' and 'none'
SMTP_TRANSPORT_ENCRYPTION=
# Allow insecure connections to the SMTP server. Defaults to false.
SMTP_INSECURE=
# Additional services to be started on opencloud startup
# The following list of services is not started automatically and must be
# manually defined for startup:
# IMPORTANT: Add any services to the startup list comma separated like "notifications,antivirus" etc.
START_ADDITIONAL_SERVICES=""
## Default Enabled Services ##
### Apache Tika Content Analysis Toolkit ###
# Tika (search) is disabled by default due to performance reasons.
# Tika is used to extract metadata and text from various file formats.
# Enable it by adding the following to the COMPOSE_FILE variable:
# search/tika.yml or by using the following command:
# docker compose -f docker-compose.yml -f search/tika.yml up -d
# Set the desired docker image tag or digest.
# Defaults to "apache/tika:latest-full"
TIKA_IMAGE=
### IMPORTANT Note for Online Office Apps ###
# To avoid app interlocking issues, you should select only one app to be active/configured.
# This is due the fact that there is currently no app interlocking for the same file and one
# has to wait for a lock release to open the file with another app.
### Collabora Settings ###
# Domain of Collabora, where you can find the frontend.
# Defaults to "collabora.opencloud.test"
COLLABORA_DOMAIN=
# Domain of the wopiserver which handles Collabora.
# Defaults to "wopiserver.opencloud.test"
WOPISERVER_DOMAIN=
# Admin user for Collabora.
# Defaults to "admin".
# Collabora Admin Panel URL:
# https://{COLLABORA_DOMAIN}/browser/dist/admin/admin.html
COLLABORA_ADMIN_USER=
# Admin password for Collabora.
# Defaults to "admin".
COLLABORA_ADMIN_PASSWORD=
# Set to true to enable SSL handling in Collabora Online, this is only required if you are not using a reverse proxy.
# Default is true if not specified.
COLLABORA_SSL_ENABLE=false
# If you're on an internet-facing server, enable SSL verification for Collabora Online.
# Please comment out the following line:
COLLABORA_SSL_VERIFICATION=false
### Virusscanner Settings ###
# IMPORTANT: If you enable antivirus, you also MUST configure the START_ADDITIONAL_SERVICES
# envvar in the OpenCloud Settings above by adding 'antivirus' to the list.
# The maximum scan size the virus scanner can handle, needs adjustment in the scanner config as well.
# Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB.
# Defaults to "100MB"
#ANTIVIRUS_MAX_SCAN_SIZE=
# Usable modes: partial, skip.
# Defaults to "partial"
#ANTIVIRUS_MAX_SCAN_SIZE_MODE=
# Image version of the ClamAV container.
# Defaults to "latest"
CLAMAV_DOCKER_TAG=
### Inbucket Settings ###
# Inbucket is a mail catcher tool for testing purposes.
# DO NOT use in Production.
# email server (in this case inbucket acts as mail catcher).
# Domain for Inbucket. Defaults to "mail.opencloud.test".
INBUCKET_DOMAIN=
### Compose Configuration ###
# Path separator for supplemental compose files specified in COMPOSE_FILE.
COMPOSE_PATH_SEPARATOR=:
### Ldap Settings ###
# LDAP is always needed for OpenCloud to store user data as there is no relational database.
# The built-in LDAP server should used for testing purposes or small installations only.
# For production installations, it is recommended to use an external LDAP server.
# We are using OpenLDAP as the default LDAP server because it is proven to be stable and reliable.
# This LDAP configuration is known to work with OpenCloud and provides a blueprint for
# configuring an external LDAP server based on other products like Microsoft Active Directory or other LDAP servers.
#
# Password of LDAP bind user "cn=admin,dc=opencloud,dc=eu". Defaults to "admin"
LDAP_BIND_PASSWORD=
# The LDAP server also creates an openCloud admin user dn: uid=admin,ou=users,dc=opencloud,dc=eu
# The initial password for this user is "admin"
# NOTE: This password can only be set once, if you want to change it later, you have to use the OpenCloud User Settings UI.
# If you changed the password and lost it, you need to execute the following LDAP query to reset it:
# enter the ldap-server container with `docker compose exec ldap-server sh`
# and run the following command to change the password:
# ldappasswd -H ldap://127.0.0.1:1389 -D "cn=admin,dc=opencloud,dc=eu" -W "uid=admin,ou=users,dc=opencloud,dc=eu"
# You will be prompted for the LDAP bind password.
# The output should provide you a new password for the admin user.
### Keycloak Settings ###
# Keycloak is an open-source identity and access management solution.
# We are using Keycloak as the default identity provider on production installations.
# It can be used to federate authentication with other identity providers like
# Microsoft Entra ID, ADFS or other SAML/OIDC providers.
# The use of Keycloak as bridge between OpenCloud and other identity providers creates more control over the
# authentication process, the allowed clients and the session management.
# Keycloak also manages the Role Based Access Control (RBAC) for OpenCloud.
# Keycloak can be used in two different modes:
# 1. Autoprovisioning: New users are automatically created in openCloud when they log in for the first time.
# 2. Shared User Directory: Users are created in Keycloak and can be used in OpenCloud immediately
# because the LDAP server is connected to both Keycloak and OpenCloud.
# Only use one of the two modes at a time.
## Autoprovisioning Mode ##
# Use together with idm/external-idp.yml
# If you want to use a keycloak for local testing, you can use testing/external-keycloak.yml and testing/ldap-manager.yml
# Domain of your Identity Provider.
IDP_DOMAIN=
# IdP Issuer URL, which is used to identify the Identity Provider.
# We need the complete URL, including the protocol (http or https) and the realm.
# Example: "https://keycloak.opencloud.test/realms/openCloud"
IDP_ISSUER_URL=
# Url of the account edit page from your Identity Provider.
IDP_ACCOUNT_URL=
## Shared User Directory Mode ##
# Use together with idm/ldap-keycloak.yml and traefik/ldap-keycloak.yml
# Domain for Keycloak. Defaults to "keycloak.opencloud.test".
KEYCLOAK_DOMAIN=
# Admin user login name. Defaults to "kcadmin".
KEYCLOAK_ADMIN=
# Admin user login password. Defaults to "admin".
KEYCLOAK_ADMIN_PASSWORD=
# Keycloak Database username. Defaults to "keycloak".
KC_DB_USERNAME=
# Keycloak Database password. Defaults to "keycloak".
KC_DB_PASSWORD=
### Radicale Setting ###
# Radicale is a small open-source CalDAV (calendars, to-do lists) and CardDAV (contacts) server.
# When enabled OpenCloud is configured as a reverse proxy for Radicale, providing all authenticated
# OpenCloud users access to a Personal Calendar and Addressbook
# Docker image to use for the Radicale Container
#RADICALE_DOCKER_IMAGE=opencloudeu/radicale
# Docker tag to pull for the Radicale Container
#RADICALE_DOCKER_TAG=latest
# Define the storage location for the Radicale data. Set the path to a local path.
# Ensure that the configuration and data directories are owned by the user and group with ID 1000:1000.
# This matches the default user inside the container and avoids permission issues when accessing files.
# Leaving it default stores data in docker internal volumes.
#RADICALE_DATA_DIR=/your/local/radicale/data
### Gitea Setting ###
GITEA_DB=giteadb # Database name for Gitea
GITEA_DB_USER=giteauser
GITEA_DB_PASSWORD=1pmOwO9bqj9WCu
GITEA_HOST=
### odoo Setting ###
ODOO_DB=odoo # Database name for Odoo
ODOO_DB_USER=odoouser
ODOO_DB_PASSWORD=56onjP9wJfWrnv
ODOO_DB_HOST=postgres
### Postgresql Settings ###
POSTGRES_ADMIN_USER=postgres
POSTGRES_ADMIN_PASSWORD=o8OhiiivPW45pp
### Backup Settings ###
BKP_DB_LIST="${ODOO_DB} ${GITEA_DB}"
BKP_RETENTION_COUNT=5
BKP_RETENTION_DAYS=7
TIMEZONE=Asia/Tehran

48
.gitignore vendored
View File

@@ -1,7 +1,6 @@
.idea
# exclude the .env file which will be created from env.example
.env
.env.local
# exclude the apps folder
/config/opencloud/apps/*
@@ -17,39 +16,16 @@
# exclude the certificates config folder
/config/traefik/dynamic/*
!/config/traefik/dynamic/.gitkeep
# Python cache/bytecode
__pycache__/
*.py[cod]
.DS_Store
secrets/
# Backup files and directories
/backups/
*.tar.gz
*.sql.gz
*.sql
Persistent Backup/
# Python cache
__pycache__/
*.py[cod]
*$py.class
*.egg-info/
# Database files
*.db
*.sqlite
*.sqlite3
# Log files
*.log
# Editor settings
.vscode/
*.swp
*.swo
*~
# Windows
Thumbs.db
secrets/caddy_email
secrets/opencloud_jwt_secret
secrets/opencloud_transfer_secret
secrets/openproject_secret_key_base
secrets/traefik
Persistent Backup/2025-11-24_18-10/gitea_data_2025-11-24_18-10.tar.gz
Persistent Backup/2025-11-24_18-10/giteadb_2025-11-24_18-10.sql.gz
Persistent Backup/2025-11-24_18-10/odoo_2025-11-24_18-10.sql.gz
Persistent Backup/2025-11-24_18-10/odoo_config_2025-11-24_18-10.tar.gz
Persistent Backup/2025-11-24_18-10/odoo_db_data_2025-11-24_18-10.tar.gz
Persistent Backup/2025-11-24_18-10/opencloud_config_2025-11-24_18-10.tar.gz
Persistent Backup/2025-11-24_18-10/opencloud_data_2025-11-24_18-10.tar.gz

210
README.md
View File

@@ -1,12 +1,10 @@
# Selfhost Cloud Compose Stack
# OpenCloud Compose
This repository provides modular Docker Compose configurations for a self-hosted stack built around OpenCloud, with Traefik at the root and optional Odoo, Gitea, Postgres, and backup services.
This repository provides Docker Compose configurations for deploying OpenCloud in various environments.
## Overview
The stack uses a modular compose layout. The root `docker-compose.yml` starts **Traefik only**. OpenCloud and other apps are added as overlay files.
OpenCloud options:
OpenCloud Compose offers a modular approach to deploying OpenCloud with several configuration options:
- **Standard deployment** with Traefik reverse proxy and Let's Encrypt certificates or certificates from files
- **External proxy** support for environments with existing reverse proxies (like Nginx, Caddy, etc.)
@@ -16,15 +14,6 @@ OpenCloud options:
- **Monitoring** with metrics endpoints for observability and performance monitoring
- **Radicale** integration for Calendar and Contacts
Additional services in this repo:
- **Odoo 19** (`odoo/odoo.yml` + `odoo/odoo-init.yml`)
- **Gitea** (`version-control/gitea.yml`, SSH on port 2222) — see [version-control/README.md](version-control/README.md)
- **Shared Postgres** (`database/postgres.yml`) for Gitea and Odoo
- **Backups** (`backup/backup.yml`, `backup/restore.yml`, optional Borgmatic) — see [backup/README.md](backup/README.md) and [backup/borgmatic-README.md](backup/borgmatic-README.md)
> **Note**: Traefik is always present via `docker-compose.yml`. OpenCloud lives in `opencloud/opencloud.yml` (with Traefik labels). Overlays that attach services to `opencloud-net` (Collabora, Keycloak, Tika, Radicale, monitoring) typically also include `traefik/opencloud.yml` so Traefik joins that network.
## Quick Start Guide
### Prerequisites
@@ -40,8 +29,8 @@ Additional services in this repo:
1. **Clone the repository**:
```bash
git clone ssh://git@git.faryad.top:2222/rhino/selfhost-cloud-compose-stack.git
cd selfhost-cloud-compose-stack
git clone https://github.com/opencloud-eu/opencloud-compose.git
cd opencloud-compose
```
2. **Create environment file**:
@@ -59,12 +48,12 @@ Additional services in this repo:
You can deploy using explicit `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml up -d
docker compose -f docker-compose.yml -f traefik/opencloud.yml up -d
```
Or by adding the `COMPOSE_FILE` variable in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml
COMPOSE_FILE=docker-compose.yml:traefik/opencloud.yml
```
Then simply run:
@@ -77,8 +66,6 @@ Additional services in this repo:
127.0.0.1 cloud.opencloud.test
127.0.0.1 traefik.opencloud.test
127.0.0.1 keycloak.opencloud.test
127.0.0.1 git.opencloud.test
127.0.0.1 odoo.opencloud.test
```
7. **Access OpenCloud**:
@@ -98,10 +85,10 @@ Additional services in this repo:
2. **Configure deployment options** in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
```
3. **Start the stack**:
3. **Start OpenCloud**:
```bash
docker compose up -d
```
@@ -116,12 +103,12 @@ OpenCloud can be deployed with Keycloak for identity management and LDAP for the
Using `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f idm/ldap-keycloak.yml -f traefik/opencloud.yml -f traefik/ldap-keycloak.yml up -d
docker compose -f docker-compose.yml -f idm/ldap-keycloak.yml -f traefik/opencloud.yml -f traefik/ldap-keycloak.yml up -d
```
Or by setting in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml
COMPOSE_FILE=docker-compose.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml
```
> **For local development only**: Add to `/etc/hosts`:
@@ -142,12 +129,12 @@ Include Collabora for document editing using either method:
Using `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f weboffice/collabora.yml -f traefik/opencloud.yml -f traefik/collabora.yml up -d
docker compose -f docker-compose.yml -f weboffice/collabora.yml -f traefik/opencloud.yml -f traefik/collabora.yml up -d
```
Or by setting in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
```
> **For local development only**: Add to `/etc/hosts`:
@@ -164,12 +151,12 @@ Enable full text search capabilities with Apache Tika using either method:
Using `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f search/tika.yml -f traefik/opencloud.yml up -d
docker compose -f docker-compose.yml -f search/tika.yml -f traefik/opencloud.yml up -d
```
Or by setting in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:search/tika.yml:traefik/opencloud.yml
COMPOSE_FILE=docker-compose.yml:search/tika.yml:traefik/opencloud.yml
```
This setup includes:
@@ -185,12 +172,12 @@ Enable CalDAV (calendars, to-do lists) and CardDAV (contacts) server.
Using `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f radicale/radicale.yml -f traefik/opencloud.yml up -d
docker compose -f docker-compose.yml -f radicale/radicale.yml -f traefik/opencloud.yml up -d
```
Or by setting in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:radicale/radicale.yml:traefik/opencloud.yml
COMPOSE_FILE=docker-compose.yml:radicale/radicale.yml:traefik/opencloud.yml
```
This setup includes:
@@ -203,27 +190,25 @@ Enable monitoring capabilities with metrics endpoints using either method:
> **DNS Requirements**: This setup requires DNS entries for the main OpenCloud domain. Configure a DNS A/AAAA record for your domain (e.g., `cloud.example.com`) or use a wildcard DNS entry (`*.example.com`).
OpenCloud proxy metrics (`monitoring/monitoring.yml`):
Using `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f monitoring/monitoring.yml -f traefik/opencloud.yml up -d
docker compose -f docker-compose.yml -f monitoring/monitoring.yml -f traefik/opencloud.yml up -d
```
Or by setting in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:monitoring/monitoring.yml:traefik/opencloud.yml
```
For Collabora collaboration-service metrics, also include `monitoring/monitoring-collaboration.yml` (requires the Collabora overlay):
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:monitoring/monitoring.yml:monitoring/monitoring-collaboration.yml:traefik/opencloud.yml:traefik/collabora.yml
COMPOSE_FILE=docker-compose.yml:monitoring/monitoring.yml:traefik/opencloud.yml
```
This setup includes:
- Metrics endpoint for the OpenCloud proxy service (listens on port 9205 inside the container)
- Metrics endpoint for the collaboration service (listens on port 9304 inside the container; needs `monitoring/monitoring-collaboration.yml`)
- Metrics endpoints for OpenCloud proxy service (port 9205)
- Metrics endpoints for collaboration service (port 9304)
- Performance monitoring and observability data
- Prometheus-compatible metrics format
> **Note**: These overlays set listen addresses only; they do **not** publish host ports. Scrape metrics from the Docker network (for example `http://opencloud:9205/metrics` or `http://collaboration:9304/metrics`), or add your own port mappings if you need host access.
Access metrics endpoints:
- OpenCloud metrics: `http://localhost:9205/metrics`
- Collaboration metrics: `http://localhost:9304/metrics`
> **Note**: The monitoring configuration uses an external network `opencloud-net`. You need to create this network manually before starting the services:
> ```bash
@@ -238,12 +223,12 @@ If you already have a reverse proxy (Nginx, Caddy, etc.), use either method:
Using `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f weboffice/collabora.yml -f external-proxy/opencloud.yml -f external-proxy/collabora.yml up -d
docker compose -f docker-compose.yml -f weboffice/collabora.yml -f external-proxy/opencloud.yml -f external-proxy/collabora.yml up -d
```
Or by setting in `.env`:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml
COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:external-proxy/opencloud.yml:external-proxy/collabora.yml
```
This exposes the necessary ports:
@@ -255,73 +240,23 @@ This exposes the necessary ports:
If you're using **Nginx Proxy Manager (NPM)**, you **should NOT** activate **"Block Common Exploits"** for the Proxy Host.
Otherwise, the desktop app authentication will return **error 403 Forbidden**.
### With Odoo, Gitea, and Shared Postgres
Odoo and Gitea share Postgres from `database/postgres.yml`. Traefik labels for Odoo are already in `odoo/odoo.yml` (there is no `traefik/odoo.yml`).
Example:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:odoo/odoo.yml:odoo/odoo-init.yml:database/postgres.yml:version-control/gitea.yml
```
Using `-f` flags:
```bash
docker compose -f docker-compose.yml -f opencloud/opencloud.yml -f odoo/odoo.yml -f odoo/odoo-init.yml -f database/postgres.yml -f version-control/gitea.yml up -d
```
> **For local development only**: Add to `/etc/hosts`:
> ```
> 127.0.0.1 odoo.opencloud.test
> 127.0.0.1 git.opencloud.test
> ```
- **Odoo**: include `odoo/odoo-init.yml` on first start so volume ownership is fixed automatically — see [scripts/odoo/README.md](scripts/odoo/README.md)
- **Gitea**: web UI via Traefik; SSH on host port **2222** — see [version-control/README.md](version-control/README.md)
### Backups
Scheduled Postgres dumps and volume archives are defined in `backup/backup.yml`; restores use `backup/restore.yml`. Optional Borgmatic is in `backup/borgmatic.yml`.
See [backup/README.md](backup/README.md) and [backup/borgmatic-README.md](backup/borgmatic-README.md) for configuration and restore workflows. Do not copy outdated volume names from older docs; Odoo uses `odoo-db-data` and `odoo-config` (see below).
## SSL Certificate Support
This stack supports adding SSL certificates for public domains and development environments. This feature enables you to use the "Let's Encrypt ACME challenge" to generate certificates for your public domains as well as using your own certificates.
OpenCloud Compose supports adding SSL certificates for public domains and development environments. This feature enables you to use the "Let's Encrypt ACME challenge" to generate certificates for your public domains as well as using your own certificates.
### Use Let's Encrypt with ACME Challenge
1. **Enable Let's Encrypt**:
- Set `TRAEFIK_ACME_MAIL` to your email address for the ACME challenge
- Set `TRAEFIK_LETSENCRYPT_EMAIL` to your email address for the ACME challenge
- Set `TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt"` to use Let's Encrypt (default value)
```bash
# In your .env file
TRAEFIK_ACME_MAIL=devops@your-domain.tld
TRAEFIK_LETSENCRYPT_EMAIL=devops@your-domain.tld
TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt"
```
2. **Use DNS-01 challenge with Cloudflare (recommended if Let's Encrypt cannot reach your server)**:
- Set `TRAEFIK_ACME_CHALLENGE=dns`
- Set `TRAEFIK_ACME_DNS_PROVIDER=cloudflare`
- Set `CF_DNS_API_TOKEN` to a Cloudflare token with DNS edit permissions for your zone
```bash
# In your .env file
TRAEFIK_ACME_MAIL=devops@your-domain.tld
TRAEFIK_SERVICES_TLS_CONFIG="tls.certresolver=letsencrypt"
TRAEFIK_ACME_CHALLENGE=dns
TRAEFIK_ACME_DNS_PROVIDER=cloudflare
CF_DNS_API_TOKEN=your-cloudflare-token
# Optional: helps in split-DNS environments
# TRAEFIK_ACME_DNS_RESOLVERS=1.1.1.1:53,8.8.8.8:53
```
Then restart Traefik:
```bash
docker compose up -d traefik
```
### Use Certificates from the `certs/` directory
1. **Place your certificates**:
@@ -407,11 +342,8 @@ Key variables:
| `LDAP_BIND_PASSWORD` | LDAP password for the bind user | admin |
| `KC_DB_USERNAME` | Database user for keycloak | keycloak |
| `KC_DB_PASSWORD` | Database password for keycloak | keycloak |
| `TRAEFIK_ACME_MAIL` | Email Address for the Let's Encrypt ACME challenge | example@example.org |
| `TRAEFIK_LETSENCRYPT_EMAIL` | Email Address for the Let's Encrypt ACME challenge | example@example.org |
| `TRAEFIK_SERVICES_TLS_CONFIG` | Tell traefik and the services which TLS config to use | tls.certresolver=letsencrypt |
| `TRAEFIK_ACME_CHALLENGE` | ACME challenge type (http, dns, tls) | http |
| `TRAEFIK_ACME_DNS_PROVIDER` | DNS provider for ACME DNS challenge | cloudflare |
| `CF_DNS_API_TOKEN` | Cloudflare token used for DNS-01 challenge | (no value) |
| `TRAEFIK_CERTS_DIR` | Directory for custom certificates. | ./certs |
See `.env.example` for all available options and their documentation.
@@ -451,54 +383,34 @@ mkdir -p /path/to/opencloud/{config,data}
chown -R 1000:1000 /path/to/opencloud
```
#### Odoo volumes and first-time init
#### Odoo Volume Permissions (First-Time Setup)
Odoo uses:
When deploying Odoo for the first time, the named volumes are created with root ownership by default. To allow Odoo to write to its filestore and other directories, fix the ownership before starting the services:
- named volume `odoo-db-data` → `/var/lib/odoo` (filestore, sessions, attachments)
- named volume `odoo-config` → `/etc/odoo`
- bind mount `./odoo/addons` → `/mnt/extra-addons`
On first deploy, include `odoo/odoo-init.yml`. The one-shot `odoo-init` service chowns the named volumes and initializes the database. Details: [scripts/odoo/README.md](scripts/odoo/README.md).
#### Odoo startup page (Projects instead of Discuss)
By default, Odoo 19 opens **Discuss** after login. The custom addon [`odoo/addons/project_home_action`](odoo/addons/project_home_action) restores the **Home Action** field on user Preferences and sets it to **Projects** for internal users.
`./odoo/addons` is already mounted into the container at `/mnt/extra-addons` via [`odoo/odoo.yml`](odoo/odoo.yml). After deploying a revision that includes this addon:
1. Restart Odoo if the container was already running, so it picks up the new module files:
```bash
docker compose restart odoo
# Detect Odoo UID:GID and fix volume ownership
OG=$(docker run --rm odoo:19 sh -c "printf \"%s:%s\" \"\$(id -u odoo)\" \"\$(id -g odoo)\"")
for v in odoo-filestore odoo-db-data odoo-config odoo-logs odoo-web-data odoo-addons; do
docker run --rm -v "${v}:/data" alpine chown -R "$OG" /data
done
```
2. In Odoo, open **Settings → Apps**.
3. Remove the **Apps** filter (and enable **developer mode** if the Apps menu is limited), then **Update Apps List**.
4. Search for **Project as Home Action** (`project_home_action`) and **Install** it.
5. Log out and log back in. You should land on Projects (`/odoo/project`) instead of Discuss.
On install, existing internal users with an empty Home Action are updated automatically. New internal users get the same default. You can still change Home Action per user under **Settings → Users → Preferences** (or **My Preferences**).
Requires the **Project** app to be installed (`depends: project`).
This ensures Odoo can create attachments, logs, and configuration files without permission errors.
### Compose File Structure
This repository uses a modular approach with multiple compose files:
- `docker-compose.yml` — Traefik reverse proxy (always included)
- `opencloud/` — OpenCloud service
- `odoo/` — Odoo 19 and first-boot init
- `version-control/` — Gitea
- `database/` — Shared Postgres for Gitea and Odoo
- `backup/` — Backup, restore, and optional Borgmatic helpers
- `weboffice/` — Web office integrations (Collabora Online)
- `storage/` — Storage backend configurations (decomposeds3)
- `search/` — Search and content analysis services (Apache Tika)
- `monitoring/` — Monitoring and metrics configurations
- `idm/` — Identity management configurations (Keycloak & LDAP)
- `traefik/` — Extra Traefik network aliases and labels for overlays
- `external-proxy/` — Configuration for external reverse proxies
- `radicale/` — Radicale configuration
- `config/` — Configuration files for OpenCloud, Keycloak, LDAP, Traefik, etc.
- `docker-compose.yml` - Core OpenCloud service
- `weboffice/` - Web office integrations (Collabora Online)
- `storage/` - Storage backend configurations (decomposeds3)
- `search/` - Search and content analysis services (Apache Tika)
- `monitoring/` - Monitoring and metrics configurations
- `idm/` - Identity management configurations (Keycloak & LDAP)
- `traefik/` - Traefik reverse proxy configurations
- `external-proxy/` - Configuration for external reverse proxies
- `radicale/` - Radicale configuration
- `config/` - Configuration files for OpenCloud, Keycloak, and LDAP
## Advanced Usage
@@ -513,34 +425,24 @@ The `COMPOSE_FILE` environment variable is a powerful way to manage complex Dock
Example configurations:
Baseline OpenCloud:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml
```
Production with Collabora:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
```
Production with Keycloak and LDAP:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml
COMPOSE_FILE=docker-compose.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/ldap-keycloak.yml
```
Production with both Collabora and Keycloak/LDAP:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/collabora.yml:traefik/ldap-keycloak.yml
COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:idm/ldap-keycloak.yml:traefik/opencloud.yml:traefik/collabora.yml:traefik/ldap-keycloak.yml
```
Production with monitoring:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:monitoring/monitoring.yml:traefik/opencloud.yml
```
OpenCloud with Odoo, Gitea, and Postgres:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:odoo/odoo.yml:odoo/odoo-init.yml:database/postgres.yml:version-control/gitea.yml
COMPOSE_FILE=docker-compose.yml:monitoring/monitoring.yml:traefik/opencloud.yml
```
### Automation and GitOps
@@ -548,7 +450,7 @@ COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:odoo/odoo.yml:odoo/odoo-
For automated deployments, using the `COMPOSE_FILE` variable in `.env` is recommended:
```
COMPOSE_FILE=docker-compose.yml:opencloud/opencloud.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml
```
This allows tools like Ansible or CI/CD pipelines to deploy the stack without modifying the compose files.
@@ -582,7 +484,7 @@ services:
- **SSL Certificate Errors**: For local development, accept self-signed certificates by visiting each domain directly in your browser.
- **Port Conflicts**: If you have services already using ports 80/443, use the external proxy configuration.
- **Permission Issues**: Ensure data and config directories have proper permissions (owned by user/group 1000). For Odoo named volumes, use `odoo/odoo-init.yml` on first start.
- **Permission Issues**: Ensure data and config directories have proper permissions (owned by user/group 1000).
### Logs

View File

@@ -1,147 +0,0 @@
# Traefik ACME Challenge Switching Guide
This guide explains how to switch SSL certificate issuance in this stack between DNS-01 and HTTP-01 challenge types.
## When to use each challenge
- Use DNS-01 if Let’s Encrypt cannot reach your server from the internet.
- Use HTTP-01 if port 80 on your public domains is reachable by Let’s Encrypt.
## Prerequisites
- The stack is configured with Traefik and ACME enabled.
- You are editing the environment file used by Docker Compose, usually .env.
## Switch to DNS-01 (Cloudflare)
1. Edit your .env and set:
```env
TRAEFIK_SERVICES_TLS_CONFIG=tls.certresolver=letsencrypt
TRAEFIK_ACME_MAIL=devops@example.com
TRAEFIK_ACME_CHALLENGE=dns
TRAEFIK_ACME_DNS_PROVIDER=cloudflare
CF_DNS_API_TOKEN=your-cloudflare-api-token
# Optional for split-DNS or propagation issues:
# TRAEFIK_ACME_DNS_RESOLVERS=1.1.1.1:53,8.8.8.8:53
```
2. Restart Traefik:
```bash
docker compose up -d traefik
```
3. Verify challenge mode in logs:
```bash
docker compose logs -f traefik
```
Look for log output indicating ACME DNS challenge usage.
## Switch to HTTP-01
1. Edit your .env and set:
```env
TRAEFIK_SERVICES_TLS_CONFIG=tls.certresolver=letsencrypt
TRAEFIK_ACME_MAIL=devops@example.com
TRAEFIK_ACME_CHALLENGE=http
TRAEFIK_ACME_DNS_PROVIDER=cloudflare
CF_DNS_API_TOKEN=
```
2. Ensure public inbound access from Let’s Encrypt to port 80 on each domain.
3. Restart Traefik:
```bash
docker compose up -d traefik
```
4. Check Traefik logs for HTTP challenge activity:
```bash
docker compose logs -f traefik
```
## Common issues
- DNS-01 fails with Cloudflare:
- Verify CF_DNS_API_TOKEN is set.
- Ensure the token has DNS edit permissions on the correct zone.
- HTTP-01 fails:
- Ensure port 80 is open and routed to Traefik.
- Check firewall, NAT, and upstream proxy settings.
## Quick rollback
If issuance fails, switch back to the previous working challenge type in .env and restart Traefik:
```bash
docker compose up -d traefik
```
## Alternative method: use your own certificate files (no ACME)
Use this method if you already have a certificate and private key and do not want Traefik to request certificates from Let's Encrypt.
1. Place your certificate and key files in the mounted cert directory:
```bash
cp your-cert-fullchain.pem certs/custom.crt
cp your-private-key.pem certs/custom.key
chmod 644 certs/custom.crt
chmod 600 certs/custom.key
```
Important: `certs/custom.crt` should contain the leaf certificate plus intermediate chain in PEM format.
2. Configure Traefik dynamic TLS certs in `config/traefik/dynamic/certs.yml`:
```yaml
tls:
certificates:
- certFile: /certs/custom.crt
keyFile: /certs/custom.key
stores:
- default
```
3. Switch services to static TLS mode in `.env`:
```env
TRAEFIK_SERVICES_TLS_CONFIG=tls=true
```
4. Restart Traefik:
```bash
docker compose up -d traefik
```
5. Verify the served certificate:
```bash
echo | openssl s_client -connect your-server-ip:443 -servername your-domain.tld 2>/dev/null | openssl x509 -noout -subject -issuer -dates
```
### Wildcard option for multiple subdomains
For domains like `cloud.example.com`, `git.example.com`, and `odoo.example.com`, you can use one wildcard certificate for `*.example.com`.
Example dynamic config:
```yaml
tls:
certificates:
- certFile: /certs/wildcard.example.com.crt
keyFile: /certs/wildcard.example.com.key
stores:
- default
```
Notes:
- Wildcards cover one label only (`*.example.com`), not the apex (`example.com`) unless it is included separately.
- Keep `TRAEFIK_SERVICES_TLS_CONFIG=tls=true` while using custom certificates.

View File

@@ -26,7 +26,6 @@ services:
BACKUP_RETENTION_COUNT: ${BKP_RETENTION_COUNT}
BACKUP_RETENTION_DAYS: ${BKP_RETENTION_DAYS}
TIMEZONE: ${TIMEZONE}
APK_MIRROR: ${APK_MIRROR}
volumes:
- ./backups:/backups
- type: volume
@@ -51,4 +50,4 @@ services:
read_only: true
- ./scripts/backup/manage-backups.sh:/manage-backups.sh
- ./scripts/backup/backup-manager.cron:/etc/crontabs/root
entrypoint: ["/bin/sh", "-c", "# install bsdtar for xattr-aware archives\nif [ -n \"$$APK_MIRROR\" ]; then sed -i \"s|https://dl-cdn.alpinelinux.org|$$APK_MIRROR|g\" /etc/apk/repositories; fi && apk add --no-cache libarchive-tools attr >/dev/null \n# map host /backups ownership to container backup user\nHOST_UID=$$(stat -c '%u' /backups 2>/dev/null || echo 1000) && HOST_GID=$$(stat -c '%g' /backups 2>/dev/null || echo 1000) && addgroup -g \"$$HOST_GID\" backup 2>/dev/null || true && adduser -D -u \"$$HOST_UID\" -G backup backup 2>/dev/null || true && mkdir -p /var/log /backups && chown -R \"$$HOST_UID\":\"$$HOST_GID\" /var/log /backups 2>/dev/null || true && chmod +x /manage-backups.sh && chown root:root /etc/crontabs/root 2>/dev/null || true && crond -f"]
entrypoint: ["/bin/sh", "-c", "# install bsdtar for xattr-aware archives\napk add --no-cache libarchive-tools attr >/dev/null \n# map host /backups ownership to container backup user\nHOST_UID=$$(stat -c '%u' /backups 2>/dev/null || echo 1000) && HOST_GID=$$(stat -c '%g' /backups 2>/dev/null || echo 1000) && addgroup -g \"$$HOST_GID\" backup 2>/dev/null || true && adduser -D -u \"$$HOST_UID\" -G backup backup 2>/dev/null || true && mkdir -p /var/log /backups && chown -R \"$$HOST_UID\":\"$$HOST_GID\" /var/log /backups 2>/dev/null || true && chmod +x /manage-backups.sh && chown root:root /etc/crontabs/root 2>/dev/null || true && crond -f"]

View File

@@ -34,31 +34,10 @@ add_arg "--accessLog.fields.headers.names.X-Request-Id=keep"
# Add Let's Encrypt configuration if enabled
if [ "${TRAEFIK_SERVICES_TLS_CONFIG}" = "tls.certresolver=letsencrypt" ]; then
echo "Configuring Traefik with Let's Encrypt..."
ACME_CHALLENGE="${TRAEFIK_ACME_CHALLENGE:-http}"
ACME_DNS_PROVIDER="${TRAEFIK_ACME_DNS_PROVIDER:-cloudflare}"
add_arg "--certificatesResolvers.letsencrypt.acme.email=${TRAEFIK_ACME_MAIL:-example@example.org}"
add_arg "--certificatesResolvers.letsencrypt.acme.storage=/certs/acme.json"
add_arg "--certificatesResolvers.letsencrypt.acme.caserver=${TRAEFIK_ACME_CASERVER:-https://acme-v02.api.letsencrypt.org/directory}"
if [ "$ACME_CHALLENGE" = "dns" ]; then
echo "Using ACME DNS challenge via provider: ${ACME_DNS_PROVIDER}"
if [ "$ACME_DNS_PROVIDER" = "cloudflare" ] && [ -z "${CF_DNS_API_TOKEN}" ]; then
echo "ERROR: CF_DNS_API_TOKEN must be set when using Cloudflare DNS challenge."
exit 1
fi
add_arg "--certificatesResolvers.letsencrypt.acme.dnsChallenge=true"
add_arg "--certificatesResolvers.letsencrypt.acme.dnsChallenge.provider=${ACME_DNS_PROVIDER}"
add_arg "--certificatesResolvers.letsencrypt.acme.dnsChallenge.delayBeforeCheck=${TRAEFIK_ACME_DNS_DELAYBEFORECHECK:-0}"
if [ -n "${TRAEFIK_ACME_DNS_RESOLVERS}" ]; then
add_arg "--certificatesResolvers.letsencrypt.acme.dnsChallenge.resolvers=${TRAEFIK_ACME_DNS_RESOLVERS}"
fi
elif [ "$ACME_CHALLENGE" = "tls" ]; then
echo "Using ACME TLS challenge"
add_arg "--certificatesResolvers.letsencrypt.acme.tlsChallenge=true"
else
echo "Using ACME HTTP challenge"
add_arg "--certificatesResolvers.letsencrypt.acme.httpChallenge.entryPoint=http"
fi
add_arg "--certificatesResolvers.letsencrypt.acme.caserver=${TRAEFIK_ACME_CASERVER:-https://acme-v02.api.letsencrypt.org/directory}"
fi
# Add local certificate configuration if enabled

View File

@@ -9,11 +9,6 @@ services:
- "TRAEFIK_SERVICES_TLS_CONFIG=${TRAEFIK_SERVICES_TLS_CONFIG:-tls.certresolver=letsencrypt}"
- "TRAEFIK_ACME_MAIL=${TRAEFIK_ACME_MAIL:-example@example.org}"
- "TRAEFIK_ACME_CASERVER=${TRAEFIK_ACME_CASERVER:-https://acme-v02.api.letsencrypt.org/directory}"
- "TRAEFIK_ACME_CHALLENGE=${TRAEFIK_ACME_CHALLENGE:-http}"
- "TRAEFIK_ACME_DNS_PROVIDER=${TRAEFIK_ACME_DNS_PROVIDER:-cloudflare}"
- "TRAEFIK_ACME_DNS_DELAYBEFORECHECK=${TRAEFIK_ACME_DNS_DELAYBEFORECHECK:-0}"
- "TRAEFIK_ACME_DNS_RESOLVERS=${TRAEFIK_ACME_DNS_RESOLVERS:-}"
- "CF_DNS_API_TOKEN=${CF_DNS_API_TOKEN:-}"
- "TRAEFIK_LOG_LEVEL=${TRAEFIK_LOG_LEVEL:-ERROR}"
- "TRAEFIK_ACCESS_LOG=${TRAEFIK_ACCESS_LOG:-false}"
ports:

View File

@@ -1 +0,0 @@
from . import models

View File

@@ -1,17 +0,0 @@
{
"name": "MRP Lot Mix",
"version": "1.0.0",
"summary": "Mix multiple source lots into a new lot for the same product",
"description": "Adds a Manufacturing operation to consume multiple lots/serials of a product and produce a new lot/serial for the same product.",
"category": "Manufacturing",
"author": "Automated",
"license": "LGPL-3",
"depends": ["mrp", "stock"],
"data": [
"security/ir.model.access.csv",
"data/ir_sequence.xml",
"views/mrp_lot_mix_views.xml",
],
"installable": True,
"application": True,
}

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="seq_mrp_lot_mix" model="ir.sequence">
<field name="name">Lot Mix Operation</field>
<field name="code">mrp.lot.mix</field>
<field name="prefix">MIX/%(year)s/</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
</record>
</odoo>

View File

@@ -1 +0,0 @@
from . import mrp_lot_mix

View File

@@ -1,360 +0,0 @@
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
class MrpLotMix(models.Model):
_name = "mrp.lot.mix"
_description = "Lot Mix Operation"
_order = "id desc"
name = fields.Char(default="New", readonly=True, copy=False)
date = fields.Datetime(default=fields.Datetime.now, required=True)
state = fields.Selection(
[("draft", "Draft"), ("done", "Done"), ("cancel", "Cancelled")],
default="draft",
required=True,
)
company_id = fields.Many2one(
"res.company", default=lambda self: self.env.company, required=True
)
product_id = fields.Many2one("product.product", required=True)
uom_id = fields.Many2one("uom.uom", related="product_id.uom_id", store=True)
source_location_id = fields.Many2one(
"stock.location",
required=True,
domain="[('usage', '=', 'internal')]",
)
destination_location_id = fields.Many2one(
"stock.location",
required=True,
domain="[('usage', '=', 'internal')]",
)
source_line_ids = fields.One2many(
"mrp.lot.mix.line", "mix_id", string="Components", copy=True
)
allowed_lot_ids = fields.Many2many(
"stock.lot",
compute="_compute_allowed_lot_ids",
string="Available Component Lots",
)
destination_lot_id = fields.Many2one(
"stock.lot",
required=True,
domain="[('product_id', '=', product_id), '|', ('company_id', '=', False), ('company_id', '=', company_id)]",
)
total_qty = fields.Float(compute="_compute_total_qty", store=True)
production_id = fields.Many2one("mrp.production", readonly=True, copy=False)
note = fields.Text()
@api.depends("source_line_ids.quantity")
def _compute_total_qty(self):
for rec in self:
rec.total_qty = sum(rec.source_line_ids.mapped("quantity"))
@api.depends("product_id", "source_location_id", "company_id")
def _compute_allowed_lot_ids(self):
quant_obj = self.env["stock.quant"]
for rec in self:
rec.allowed_lot_ids = False
if not rec.product_id or not rec.source_location_id:
continue
quants = quant_obj.search(
[
("product_id", "=", rec.product_id.id),
("location_id", "child_of", rec.source_location_id.id),
("quantity", ">", 0),
("lot_id", "!=", False),
]
)
lots = quants.mapped("lot_id")
if rec.company_id:
lots = lots.filtered(
lambda lot: not lot.company_id or lot.company_id == rec.company_id
)
rec.allowed_lot_ids = lots
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get("name", "New") == "New":
vals["name"] = (
self.env["ir.sequence"].next_by_code("mrp.lot.mix") or "New"
)
return super().create(vals_list)
@api.onchange("product_id")
def _onchange_product_id(self):
if not self.product_id:
return
if self.product_id.tracking == "none":
raise UserError(
_("Selected product is not lot/serial tracked. Enable tracking first.")
)
for line in self.source_line_ids:
line.lot_id = False
@api.constrains("source_line_ids")
def _check_source_lot_count(self):
for rec in self:
if rec.state == "draft" and rec.source_line_ids:
lot_ids = rec.source_line_ids.filtered("lot_id").mapped("lot_id").ids
unique_lots = set(lot_ids)
if len(unique_lots) < 2:
raise ValidationError(
_("Add at least 2 different source lots/serial numbers.")
)
@api.constrains("destination_lot_id", "source_line_ids")
def _check_destination_not_in_sources(self):
for rec in self:
if not rec.destination_lot_id:
continue
if rec.destination_lot_id in rec.source_line_ids.mapped("lot_id"):
raise ValidationError(
_("Destination lot/serial must be different from source lots.")
)
def action_cancel(self):
for rec in self:
if rec.state == "done":
raise UserError(_("Done operation cannot be cancelled."))
rec.state = "cancel"
def action_set_draft(self):
for rec in self:
if rec.state == "done":
raise UserError(_("Done operation cannot be reset to draft."))
rec.state = "draft"
def action_confirm_mix(self):
for rec in self:
rec._run_mix()
return True
def _get_mrp_picking_type(self):
self.ensure_one()
picking_type = self.env["stock.picking.type"].search(
[
("code", "=", "mrp_operation"),
"|",
("company_id", "=", self.company_id.id),
("company_id", "=", False),
],
limit=1,
)
if not picking_type:
raise UserError(
_("No Manufacturing Operation Type found for this company.")
)
return picking_type
def _run_mix(self):
self.ensure_one()
if self.state != "draft":
raise UserError(_("Only draft operations can be confirmed."))
if not self.source_line_ids:
raise UserError(_("Please add source lots/serials and quantities."))
if self.total_qty <= 0:
raise UserError(_("Total quantity must be greater than zero."))
if self.product_id.tracking == "none":
raise UserError(
_("Selected product is not lot/serial tracked. Enable tracking first.")
)
if self.product_id.tracking == "serial" and self.total_qty != 1:
raise UserError(
_(
"For serial-tracked products, output quantity must be exactly 1 and use one destination serial number."
)
)
if self.product_id.tracking == "serial":
invalid_serial_lines = self.source_line_ids.filtered(
lambda l: l.quantity != 1
)
if invalid_serial_lines:
raise UserError(
_(
"For serial-tracked products, each component serial line quantity must be exactly 1."
)
)
picking_type = self._get_mrp_picking_type()
production = self.env["mrp.production"].create(
{
"origin": self.name,
"company_id": self.company_id.id,
"product_id": self.product_id.id,
"product_uom_id": self.uom_id.id,
"product_qty": self.total_qty,
"location_src_id": self.source_location_id.id,
"location_dest_id": self.destination_location_id.id,
"picking_type_id": picking_type.id,
}
)
production.action_confirm()
# Keep the generated finished move to preserve default MRP locations and routes.
finished_move = production.move_finished_ids.filtered(
lambda m: m.product_id == self.product_id
)[:1]
if not finished_move:
raise UserError(
_("Could not find generated finished move for this production order.")
)
finished_move.product_uom_qty = self.total_qty
production_location = finished_move.location_id
finished_move.move_line_ids.unlink()
# Remove automatically generated raw moves, then inject one raw move per source lot line.
production.move_raw_ids.unlink()
stock_move_obj = self.env["stock.move"]
stock_move_line_obj = self.env["stock.move.line"]
for line in self.source_line_ids:
raw_move = stock_move_obj.create(
{
"reference": self.name,
"description_picking": _("Consume for lot mix %s") % self.name,
"company_id": self.company_id.id,
"product_id": self.product_id.id,
"product_uom": self.uom_id.id,
"product_uom_qty": line.quantity,
"location_id": self.source_location_id.id,
"location_dest_id": production_location.id,
"raw_material_production_id": production.id,
}
)
raw_move = raw_move._action_confirm()[:1]
if not raw_move:
raise UserError(
_("Could not confirm a raw material move for lot mix %s.")
% self.name
)
raw_move.move_line_ids.unlink()
stock_move_line_obj.create(
{
"company_id": self.company_id.id,
"move_id": raw_move.id,
"product_id": self.product_id.id,
"product_uom_id": self.uom_id.id,
"quantity": line.quantity,
"lot_id": line.lot_id.id,
"location_id": self.source_location_id.id,
"location_dest_id": production_location.id,
}
)
stock_move_line_obj.create(
{
"company_id": self.company_id.id,
"move_id": finished_move.id,
"product_id": self.product_id.id,
"product_uom_id": self.uom_id.id,
"quantity": self.total_qty,
"lot_id": self.destination_lot_id.id,
"location_id": production_location.id,
"location_dest_id": self.destination_location_id.id,
}
)
production_write_vals = {}
if "lot_producing_id" in production._fields:
production_write_vals["lot_producing_id"] = self.destination_lot_id.id
if "qty_producing" in production._fields:
production_write_vals["qty_producing"] = self.total_qty
if production_write_vals:
production.write(production_write_vals)
production.button_mark_done()
self.write(
{
"state": "done",
"production_id": production.id,
}
)
class MrpLotMixLine(models.Model):
_name = "mrp.lot.mix.line"
_description = "Lot Mix Component Line"
mix_id = fields.Many2one("mrp.lot.mix", required=True, ondelete="cascade")
company_id = fields.Many2one(related="mix_id.company_id", store=True)
product_id = fields.Many2one(related="mix_id.product_id", store=True)
lot_id = fields.Many2one(
"stock.lot",
string="Component Lot/Serial",
required=True,
domain="[('product_id', '=', product_id), '|', ('company_id', '=', False), ('company_id', '=', company_id)]",
)
quantity = fields.Float(string="Component Quantity", required=True, default=1.0)
available_qty = fields.Float(
string="Available Quantity", compute="_compute_available_qty"
)
def _get_component_lot_domain(self):
self.ensure_one()
if not self.product_id or not self.mix_id.source_location_id:
return [("id", "=", False)]
quants = self.env["stock.quant"].search(
[
("product_id", "=", self.product_id.id),
("location_id", "child_of", self.mix_id.source_location_id.id),
("quantity", ">", 0),
("lot_id", "!=", False),
]
)
lots = quants.mapped("lot_id")
if self.company_id:
lots = lots.filtered(
lambda lot: not lot.company_id or lot.company_id == self.company_id
)
return [("id", "in", lots.ids)]
@api.onchange("mix_id", "product_id", "mix_id.source_location_id")
def _onchange_component_lot_domain(self):
domain = self._get_component_lot_domain()
if self.lot_id and not self.lot_id.search_count(
domain + [("id", "=", self.lot_id.id)]
):
self.lot_id = False
return {"domain": {"lot_id": domain}}
@api.depends("lot_id", "mix_id.source_location_id")
def _compute_available_qty(self):
quant_obj = self.env["stock.quant"]
for line in self:
if not line.lot_id or not line.mix_id.source_location_id:
line.available_qty = 0.0
continue
domain = [
("product_id", "=", line.product_id.id),
("lot_id", "=", line.lot_id.id),
("location_id", "child_of", line.mix_id.source_location_id.id),
]
quants = quant_obj.search(domain)
line.available_qty = sum(quants.mapped("quantity"))
@api.constrains("quantity", "available_qty")
def _check_quantity(self):
for line in self:
if line.quantity <= 0:
raise ValidationError(_("Line quantity must be greater than zero."))
if line.quantity > line.available_qty:
raise ValidationError(
_(
"Quantity for lot %(lot)s exceeds available stock in source location."
)
% {"lot": line.lot_id.display_name}
)

View File

@@ -1,3 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_mrp_lot_mix_user,mrp.lot.mix user,model_mrp_lot_mix,mrp.group_mrp_user,1,1,1,1
access_mrp_lot_mix_line_user,mrp.lot.mix.line user,model_mrp_lot_mix_line,mrp.group_mrp_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mrp_lot_mix_user mrp.lot.mix user model_mrp_lot_mix mrp.group_mrp_user 1 1 1 1
3 access_mrp_lot_mix_line_user mrp.lot.mix.line user model_mrp_lot_mix_line mrp.group_mrp_user 1 1 1 1

View File

@@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_mrp_lot_mix_tree" model="ir.ui.view">
<field name="name">mrp.lot.mix.tree</field>
<field name="model">mrp.lot.mix</field>
<field name="arch" type="xml">
<list>
<field name="name"/>
<field name="date"/>
<field name="product_id"/>
<field name="total_qty"/>
<field name="destination_lot_id"/>
<field name="state"/>
</list>
</field>
</record>
<record id="view_mrp_lot_mix_form" model="ir.ui.view">
<field name="name">mrp.lot.mix.form</field>
<field name="model">mrp.lot.mix</field>
<field name="arch" type="xml">
<form string="Lot Mix">
<header>
<button name="action_confirm_mix" type="object" string="Confirm Mix" class="btn-primary" invisible="state != 'draft'"/>
<button name="action_cancel" type="object" string="Cancel" invisible="state == 'done' or state == 'cancel'"/>
<button name="action_set_draft" type="object" string="Reset to Draft" invisible="state != 'cancel'"/>
<field name="state" widget="statusbar" statusbar_visible="draft,done,cancel"/>
</header>
<sheet>
<group>
<group>
<field name="name" readonly="1"/>
<field name="date"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="product_id" readonly="state != 'draft'"/>
<field name="uom_id" readonly="1"/>
</group>
<group>
<field name="source_location_id" readonly="state != 'draft'"/>
<field name="destination_location_id" readonly="state != 'draft'"/>
<field name="destination_lot_id" readonly="state != 'draft'"/>
<field name="total_qty" readonly="1"/>
<field name="production_id" readonly="1"/>
</group>
</group>
<notebook>
<page string="Components">
<field name="source_line_ids" readonly="state != 'draft'">
<list editable="bottom">
<field name="lot_id"/>
<field name="quantity"/>
<field name="available_qty" readonly="1"/>
</list>
</field>
</page>
<page string="Notes">
<field name="note" placeholder="Reason, blending details, quality notes..."/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="action_mrp_lot_mix" model="ir.actions.act_window">
<field name="name">Lot Mix Operations</field>
<field name="res_model">mrp.lot.mix</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p>
Create a lot-mix operation to consume multiple source lots/serials and produce a new lot/serial of the same product.
</p>
</field>
</record>
<menuitem id="menu_mrp_lot_mix_root"
name="Lot Mix"
parent="mrp.menu_mrp_root"
sequence="70"
groups="mrp.group_mrp_user"/>
<menuitem id="menu_mrp_lot_mix"
name="Mix Orders"
parent="mrp.menu_mrp_manufacturing"
action="action_mrp_lot_mix"
sequence="10"
groups="mrp.group_mrp_user"/>
</odoo>

View File

@@ -0,0 +1,2 @@
from . import controllers
from . import models

View File

@@ -0,0 +1,14 @@
{
"name": "MRP Order XLSX Export",
"version": "19.0.1.0.0",
"summary": "Export Manufacturing Orders to XLSX",
"category": "Manufacturing",
"license": "LGPL-3",
"depends": ["mrp"],
"data": [
"views/mrp_production_views.xml",
],
"installable": True,
"application": False,
"auto_install": False,
}

View File

@@ -0,0 +1 @@
from . import main

View File

@@ -0,0 +1,109 @@
import io
from odoo import fields, http
from odoo.http import request
class MrpOrderXlsxExportController(http.Controller):
@http.route(
"/mrp/production/<int:production_id>/export_xlsx",
type="http",
auth="user",
methods=["GET"],
)
def export_mrp_order_xlsx(self, production_id, **kwargs):
try:
import xlsxwriter
except ImportError:
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
return request.make_response(
"xlsxwriter library is not available in this Odoo environment.",
headers=[("Content-Type", "text/plain; charset=utf-8")],
status=500,
)
production = request.env["mrp.production"].browse(production_id).exists()
if not production:
return request.not_found()
production.check_access_rights("read")
production.check_access_rule("read")
output = io.BytesIO()
workbook = xlsxwriter.Workbook(output, {"in_memory": True})
worksheet = workbook.add_worksheet("MO")
header_fmt = workbook.add_format({"bold": True})
date_fmt = workbook.add_format({"num_format": "yyyy-mm-dd"})
row = 0
worksheet.write(row, 0, "Manufacturing Order", header_fmt)
worksheet.write(row, 1, production.name or "")
row += 1
worksheet.write(row, 0, "Product", header_fmt)
worksheet.write(row, 1, production.product_id.display_name or "")
row += 1
worksheet.write(row, 0, "Quantity", header_fmt)
worksheet.write(row, 1, production.product_qty or 0.0)
row += 1
worksheet.write(row, 0, "UoM", header_fmt)
worksheet.write(row, 1, production.product_uom_id.name or "")
row += 1
worksheet.write(row, 0, "Planned Date", header_fmt)
if production.date_start:
dt_start = fields.Datetime.from_string(production.date_start)
worksheet.write_datetime(row, 1, dt_start, date_fmt)
else:
worksheet.write(row, 1, "")
row += 1
worksheet.write(row, 0, "Responsible", header_fmt)
worksheet.write(row, 1, production.user_id.name or "")
row += 2
table_headers = [
"Component",
"Required Qty",
"Consumed Qty",
"UoM",
"Source Location",
]
for col, title in enumerate(table_headers):
worksheet.write(row, col, title, header_fmt)
row += 1
for move in production.move_raw_ids.sorted(key=lambda item: item.id):
consumed_qty = getattr(move, "quantity", None)
if consumed_qty is None:
consumed_qty = getattr(move, "quantity_done", 0.0)
worksheet.write(row, 0, move.product_id.display_name or "")
worksheet.write(row, 1, move.product_uom_qty or 0.0)
worksheet.write(row, 2, consumed_qty or 0.0)
worksheet.write(row, 3, move.product_uom.name or "")
worksheet.write(row, 4, move.location_id.display_name or "")
row += 1
worksheet.set_column(0, 0, 36)
worksheet.set_column(1, 4, 18)
workbook.close()
output.seek(0)
filename = f"{(production.name or 'MO').replace('/', '-')}.xlsx"
headers = [
(
"Content-Disposition",
http.content_disposition(filename),
),
(
"Content-Type",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
),
]
return request.make_response(output.read(), headers=headers)

View File

@@ -0,0 +1 @@
from . import mrp_production

View File

@@ -0,0 +1,13 @@
from odoo import models
class MrpProduction(models.Model):
_inherit = "mrp.production"
def action_export_xlsx(self):
self.ensure_one()
return {
"type": "ir.actions.act_url",
"url": f"/mrp/production/{self.id}/export_xlsx",
"target": "self",
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="mrp_production_form_xlsx_export" model="ir.ui.view">
<field name="name">mrp.production.form.xlsx.export</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button
name="action_export_xlsx"
string="Export XLSX"
type="object"
class="btn-secondary"
/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,2 +0,0 @@
from . import models
from .hooks import post_init_hook

View File

@@ -1,19 +0,0 @@
{
"name": "Project as Home Action",
"version": "1.0.0",
"summary": "Open Projects after login instead of Discuss",
"description": (
"Restores the Home Action field on user Preferences (removed in Odoo 19) "
"and sets it to Projects for internal users on install and for new users."
),
"category": "Project",
"author": "Automated",
"license": "LGPL-3",
"depends": ["base", "project", "web"],
"data": [
"views/res_users_views.xml",
],
"post_init_hook": "post_init_hook",
"installable": True,
"application": False,
}

View File

@@ -1,13 +0,0 @@
def post_init_hook(env):
"""Set Home Action to Projects for internal users that have none."""
action = env.ref("project.open_view_project_all", raise_if_not_found=False)
if not action:
return
users = env["res.users"].search(
[
("share", "=", False),
("action_id", "=", False),
]
)
if users:
users.write({"action_id": action.id})

View File

@@ -1 +0,0 @@
from . import res_users

View File

@@ -1,20 +0,0 @@
from odoo import api, models
class ResUsers(models.Model):
_inherit = "res.users"
@api.model
def _project_home_action(self):
return self.env.ref("project.open_view_project_all", raise_if_not_found=False)
@api.model_create_multi
def create(self, vals_list):
users = super().create(vals_list)
action = self._project_home_action()
if not action:
return users
to_update = users.filtered(lambda user: not user.share and not user.action_id)
if to_update:
to_update.write({"action_id": action.id})
return users

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Admin user form: Preferences → Home Action -->
<record id="view_users_form_home_action" model="ir.ui.view">
<field name="name">res.users.form.home.action</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='preferences']//group[@name='other_preferences']" position="inside">
<group string="Menus Customization" invisible="share">
<field name="action_id" options="{'no_create': True}"/>
</group>
</xpath>
</field>
</record>
<!-- My Preferences dialog -->
<record id="view_users_form_simple_modif_home_action" model="ir.ui.view">
<field name="name">res.users.preferences.form.home.action</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='preferences_page']//group[@name='other_preferences']" position="inside">
<group string="Menus Customization">
<field name="action_id" options="{'no_create': True}" readonly="0"/>
</group>
</xpath>
</field>
</record>
</odoo>

View File

@@ -150,11 +150,8 @@ cleanup_old_backups() {
done
fi
}
# Prepare dated backup directory using a stable run timestamp.
# This prevents later steps from missing files if the minute changes while
# long archive operations are running.
RUN_STAMP="$(date_formatted)"
DATED_DIR="$BACKUP_BASE/$RUN_STAMP"
# Prepare dated backup directory
DATED_DIR="$BACKUP_BASE/$(date_formatted)"
mkdir -p "$DATED_DIR"
wait_for_database_backups || exit 1
@@ -191,22 +188,7 @@ log "Moving files from database dump to dated directory..."
#log "Files to move:"
ls -1 "$BACKUP_BASE/databases"/* 2>/dev/null || true
log "Moving database dumps to dated directory..."
dump_moved=0
for dump_file in "$BACKUP_BASE/databases"/*_"$RUN_STAMP"*.sql.gz; do
[ -e "$dump_file" ] || break
if mv "$dump_file" "$DATED_DIR"/; then
dump_moved=$((dump_moved + 1))
else
err "Failed to move database dump $dump_file"
fi
done
if [ "$dump_moved" -eq 0 ]; then
log "No database dumps matched run timestamp $RUN_STAMP"
else
log "Moved $dump_moved database dump(s) to $DATED_DIR"
fi
mv "$BACKUP_BASE/databases"/*_$(date_formatted)*.sql.gz "$DATED_DIR"/ 2>/dev/null || true
cleanup_old_backups