Skip to content

Commit

Permalink
Merge pull request #240 from rubencabrera/compose-and-entrypoint-fixes
Browse files Browse the repository at this point in the history
Compose and entrypoint fixes
  • Loading branch information
rubencabrera authored Jul 4, 2024
2 parents d63f8c9 + 89e2b23 commit 7dc779b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# DOCKER image to run odoo 16 with Odoo Community Backports and OCA addons

# WARNING: No work done yet for 16, this is a dummy release to keep track of
# it and move onto 16. Do not use.
FROM rubencabrera/odoo-base-image:16.0.1
MAINTAINER Rubén Cabrera Martínez <[email protected]>
EXPOSE 8069 8071 8072
Expand All @@ -10,15 +8,12 @@ ENV LANG C.UTF-8
RUN mkdir /opt/odoo; \
mkdir /var/log/odoo; \
mkdir /var/lib/odoo; \
mkdir /opt/repos; \
mkdir -p /opt/repos/oca; \
mkdir -p /opt/repos/other
RUN useradd --home /opt/odoo --shell /bin/bash odoo
RUN chown -R odoo:odoo /opt/odoo; chown -R odoo:odoo /var/lib/odoo; \
chown -R odoo:odoo /var/log/odoo; chown -R odoo:odoo /opt/repos

# Con lo siguiente, cambiamos al usuario odoo y el path donde ejecuta los
# comandos que se indiquen después.
USER odoo
WORKDIR /opt/odoo
RUN git clone --branch 16.0 --depth 1 https://github.com/oca/ocb.git /opt/odoo
Expand Down Expand Up @@ -90,7 +85,7 @@ WORKDIR /opt
USER root
RUN mkdir /opt/config
COPY ./odoo-server.conf /opt/config/odoo-server.conf
ENV OPENERP_SERVER /opt/config/odoo-server.conf
ENV OPENERP_SERVER_CONF /opt/config/odoo-server.conf

RUN chown -R odoo:odoo /opt/config
RUN sed -i '/^#.*Storage/s/^#//' /etc/systemd/journald.conf
Expand Down
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ be much better with something above 4GB.

## Running with docker-compose

Run `docker-compose up` in the root path.

## Environment variables
1. Set the environment variables used in `docker-compose.yml` to
configure how docker compose will behave:
`ODOO_DOCKER_PROJECT_NAME` and `ODOO_DOCKER_REPOS_HOST_PATH`.
1. Review other `FIXME`s in that same file (like creating or setting the path
for your code volume).
1. Set other environment variables in the odoo16 container for the Odoo server
config (see section below, look at `DB_FILTER` especially for local
development).
1. Run `docker-compose up` in the root path.

## Odoo server config using environment variables

Odoo uses a config file that is a bit of a pain with a docker
container. This images allow you to pass those config values in
Expand All @@ -38,41 +46,37 @@ same name in lower case:

| ENV var | Default value |
| --- | --- |
| `ODOO_DB_USER` | `odoo` |
| `LOG_HANDLER` | `"[':INFO']"` |
| `LOG_LEVEL` | `info` |
| `LOG_DB` | `False` |
| `LOGFILE` | `"/var/log/odoo"` |
| `LOGROTATE` | `True` |
| `CSV_INTERNAL_SEP` | `";"` |
| `ADMIN_PASSWD` | `admin` |
| `DB_HOST` | `localhost` |
| `CSV_INTERNAL_SEP` | `";"` |
| `DATA_DIR` | `/var/lib/odoo` |
| `DB_HOST` | `db` |
| `DB_FILTER` | `"^%d"` |
| `DB_MAXCONN` | `64` |
| `DB_NAME` | `False` |
| `DB_PASSWORD` | `odoo` |
| `DB_PORT` | `5432` |
| `DB_USER` | `odoo` |
| `DB_PASSWORD` | `odoo` |
| `DB_TEMPLATE` | `template1` |
| `DB_NAME` | `False` |
| `DB_MAXCONN` | `64` |
| `DB_FILTER` | `"^%d"` |
| `DB_MAXCONN` | `64` |
| `DEBUG_MODE` | `False` |
| `EMAIL_FROM` | `False` |
| `GEVENT_PORT` | `8072` |
| `LIMIT_MEMORY_HARD` | `2684354560` |
| `LIMIT_MEMORY_SOFT` | `2147483648` |
| `LIMIT_REQUEST` | `8192` |
| `LIMIT_TIME_CPU` | `60` |
| `LIMIT_TIME_REAL` | `120` |
| `LIST_DB` | `True` |
| `LONGPOLLING_PORT` | `8072` |
| `LOG_DB` | `False` |
| `LOG_HANDLER` | `"[':INFO']"` |
| `LOG_LEVEL` | `info` |
| `LOGROTATE` | `True` |
| `MAX_CRON_THREADS` | `2` |
| `OSV_MEMORY_AGE_LIMIT` | `1` |
| `OSV_MEMORY_COUNT_LIMIT` | `False` |
| `PG_PATH` | `None` |
| `PIDFILE` | `None` |
| `PROXY_MODE` | `False` |
| `REPORTGZ` | `False` |
| `SECURE_CERT_FILE` | `"server.cert"` |
| `SECURE_pkey_FILE` | `"server.pkey"` |
| `SECURE_PKEY_FILE` | `"server.pkey"` |
| `SERVER_WIDE_MODULES` | `None` |
| `SMTP_PASSWORD` | `False` |
| `SMTP_PORT` | `25` |
Expand All @@ -85,6 +89,7 @@ same name in lower case:
| `TEST_FILE` | `False` |
| `TEST_REPORT_DIRECTORY` | `False` |
| `TIMEZONE` | `False` |
| `TRANSIENT_AGE_LIMIT` | `1` |
| `TRANSLATE_MODULES` | `"['all']"` |
| `UNACCENT` | `True` |
| `WITHOUT_DEMO` | `True` |
Expand Down
14 changes: 9 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,28 @@ services:
db:
condition: service_healthy
restart: true
image: "rubencabrera/odoo-docker:16.0.5"
environment:
- DB_FILTER=.*
image: "rubencabrera/odoo-docker:16.1.0"
ports:
- "8069:8069"
- "8071:8071"
- "8072:8072"
restart: always
volumes:
- code_volume:/opt
- code_volume:/opt/repos
- odoo_data:/var/lib/odoo
volumes:
code_volume:
# This is where the code will live.
# This is where the code will live. For local development, you might want
# to use something owned by your user.
driver: local
driver_opts:
o: bind
type: none
# FIXME: The local paths need to exist for volumes to be mounted
device: ${ODOO_DOCKER_OPT_HOST_PATH:-${HOME}/.odoo_docker_opt}
# FIXME: The local paths need to exist for volumes to be mounted.
# For prod environments, this might be better inside a dir in `/opt`
device: ${ODOO_DOCKER_REPOS_HOST_PATH:-${HOME}/.${COMPOSE_PROJECT_NAME}_repos}
name: ${COMPOSE_PROJECT_NAME}_code
data_storage:
name: ${COMPOSE_PROJECT_NAME}_data_storage
Expand Down
3 changes: 0 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ set -e
: ${XMLRPC_PORT:="8069"}
: ${XMLRPCS:="True"}
: ${XMLRPCS_PORT:="8071"}
# Estas no las estabamos metiendo:
## echo 'logfile = '${LOGFILE:-"/var/log/odoo/odoo-server.log"} >> /opt/config/odoo-server.conf; \
## echo 'pg_path = '${PG_PATH:-None} >> /opt/config/odoo-server.conf; \

function write_conf() {
param="$1"
Expand Down

0 comments on commit 7dc779b

Please sign in to comment.