跳到正文
Skillpedia
部署与云(DevOps)48k · #5336

odoo-docker-deployment

它能做什么

这个工具可以帮你把 Odoo 部署到容器(Docker)中运行。它会生成所需的文件,让 Odoo 和数据库能够安全、高效地协同工作。

适用场景

  • ✓在你的电脑上搭建 Odoo 测试环境时。
  • ✓把 Odoo 部署到互联网上的服务器时。
  • ✓Odoo 无法启动或无法连接数据库时,用来排查问题。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-docker-deployment/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-docker-deployment/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“在服务器上为正式环境设置 Odoo。”

每周 5 个新技能,1 分钟读完。

工作原理

你描述你的需求,工具会生成 Docker 配置文件。之后,你只需使用简单的命令来启动、停止或查看 Odoo 的日志。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Odoo Docker Deployment

Overview

This skill provides a complete, production-ready Docker setup for Odoo, including PostgreSQL, persistent file storage, environment variable configuration, and an optional Nginx reverse proxy with SSL. It covers both development and production configurations.

When to Use This Skill

  • Spinning up a local Odoo development environment with Docker.
  • Deploying Odoo to a VPS or cloud server (AWS, DigitalOcean, etc.).
  • Troubleshooting Odoo container startup failures or database connection errors.
  • Adding a reverse proxy with SSL to an existing Odoo Docker setup.

How It Works

  1. Activate: Mention @odoo-docker-deployment and describe your deployment scenario.
  2. Generate: Receive a complete docker-compose.yml and odoo.conf ready to run.
  3. Debug: Describe your container error and get a diagnosis with a fix.

Examples

Example 1: Production docker-compose.yml

# Note: The top-level 'version' key is deprecated in Docker Compose v2+
# and can be safely omitted. Remove it to avoid warnings.

services:
  db:
    image: postgres:15
    restart: always
    environment:
      POSTGRES_DB: odoo
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    networks:
      - odoo-net

  odoo:
    image: odoo:17.0
    restart: always
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "8069:8069"
      - "8072:8072"   # Longpolling for live chat / bus
    environment:
      HOST: db
      USER: odoo
      PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./addons:/mnt/extra-addons   # Custom modules
      - ./odoo.conf:/etc/odoo/odoo.conf
    networks:
      - odoo-net

volumes:
  postgres-data:
  odoo-web-data:

networks:
  odoo-net:

Example 2: odoo.conf

[options]
admin_passwd = ${ODOO_MASTER_PASSWORD}    ; set via env or .env file
db_host = db
db_port = 5432
db_user = odoo
db_password = ${POSTGRES_PASSWORD}        ; set via env or .env file

; addons_path inside the official Odoo Docker image (Debian-based)
addons_path = /mnt/extra-addons,/usr/lib/python3/dist-packages/odoo/addons

logfile = /var/log/odoo/odoo.log
log_level = warn

; Worker tuning for a 4-core / 8GB server:
workers = 9                ; (CPU cores × 2) + 1
max_cron_threads = 2
limit_memory_soft = 1610612736   ; 1.5 GB — soft kill threshold
limit_memory_hard = 2147483648   ; 2.0 GB — hard kill threshold
limit_time_cpu = 600
limit_time_real = 1200
limit_request = 8192

Example 3: Common Commands

# Start all services in background
docker compose up -d

# Stream Odoo logs in real time
docker compose logs -f odoo

# Restart Odoo only (not DB — avoids data risk)
docker compose restart odoo

# Stop all services
docker compose down

# Backup the database to a local SQL dump
docker compose exec db pg_dump -U odoo odoo > backup_$(date +%Y%m%d).sql

# Update a custom module without restarting the server
docker compose exec odoo odoo -d odoo --update my_module --stop-after-init

Best Practices

  • ✅ Do: Store all secrets in a .env file and reference them with ${VAR} — never hardcode passwords in docker-compose.yml.
  • ✅ Do: Use depends_on: condition: service_healthy with a PostgreSQL healthcheck to prevent Odoo starting before the DB is ready.
  • ✅ Do: Put Nginx in front of Odoo for SSL termination (Let's Encrypt / Certbot) — never expose Odoo directly on port 80/443.
  • ✅ Do: Set workers = (CPU cores × 2) + 1 in odoo.conf — workers = 0 uses single-threaded mode and blocks all users.
  • ❌ Don't: Expose port 5432 (PostgreSQL) to the public internet — keep it on the internal Docker network only.
  • ❌ Don't: Use the latest or 17 Docker image tags in production — always pin to a specific patch-level tag (e.g., odoo:17.0).
  • ❌ Don't: Mount odoo.conf and rely on it for secrets in CI/CD — use Docker secrets or environment variables instead.

Limitations

  • This skill covers self-hosted Docker deployments — Odoo.sh (cloud-managed hosting) has a completely different deployment model.
  • Horizontal scaling (multiple Odoo containers behind a load balancer) requires shared filestore (NFS or S3-compatible storage) not covered here.

…

常见问题

什么是 Docker?

Docker 是一款让你在独立“盒子”(称为容器)中运行其他程序(比如 Odoo)的软件。这样可以简化安装过程,并避免程序之间产生冲突。

什么是 `docker-compose.yml`?

这是一个描述多个容器(在这里是 Odoo 和数据库)如何协同工作的文件。它定义了这些容器的配置、网络和存储卷。

为什么要使用 Nginx?

Nginx 充当 Odoo 前面的“守门人”,负责管理访问、增加安全性(比如用于 HTTPS 的 SSL 证书),并分配流量。

详情

作者的原始描述

Production-ready Docker and docker-compose setup for Odoo with PostgreSQL, persistent volumes, environment-based configuration, and Nginx reverse proxy.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5336
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能