removed old docker related files not working on susan
This commit is contained in:
parent
f529d21967
commit
a5a419e849
7 changed files with 283 additions and 63 deletions
121
Dockerfile
Normal file
121
Dockerfile
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
FROM python:3.9-slim-buster
|
||||
MAINTAINER CLI <https://cli.coop>
|
||||
|
||||
ENV APT_DEPS='build-essential libldap2-dev libpq-dev libsasl2-dev' \
|
||||
LANG=C.UTF-8 \
|
||||
LC_ALL=C.UTF-8 \
|
||||
PGDATABASE=odoo
|
||||
|
||||
RUN set -x; \
|
||||
apt-get update &&\
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
git \
|
||||
gnupg \
|
||||
npm \
|
||||
openssh-client &&\
|
||||
echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' >> /etc/apt/sources.list.d/postgresql.list &&\
|
||||
curl -SL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - &&\
|
||||
curl -o wkhtmltox.deb -SL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb &&\
|
||||
echo '43d0db99ab0e6b5f60b465a49c764c50d6b31337 wkhtmltox.deb' | sha1sum -c - &&\
|
||||
apt-get update &&\
|
||||
apt-get install -y --no-install-recommends ./wkhtmltox.deb &&\
|
||||
apt-get install -y --no-install-recommends postgresql-client &&\
|
||||
apt-get install -y --no-install-recommends ${APT_DEPS} &&\
|
||||
pip3 install -r https://raw.githubusercontent.com/OCA/OCB/14.0/requirements.txt &&\
|
||||
pip3 install phonenumbers simplejson gevent==20.12.1 PyYAML zxcvbn &&\
|
||||
apt-get -y purge ${APT_DEPS} &&\
|
||||
apt-get -y autoremove &&\
|
||||
rm -rf /var/lib/apt/lists/* wkhtmltox.deb
|
||||
|
||||
# Add Git Known Hosts
|
||||
#COPY ./ssh_known_git_hosts /root/.ssh/known_hosts
|
||||
|
||||
# Install Odoo and remove not French translations and .git directory to limit amount of data used by container
|
||||
RUN set -x; \
|
||||
useradd -l --create-home --home-dir /opt/odoo --no-log-init odoo &&\
|
||||
/bin/bash -c "mkdir -p /opt/odoo/{etc,odoo,additional_addons,private_addons,data,private}" &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/OCB.git /opt/odoo/odoo &&\
|
||||
rm -rf /opt/odoo/odoo/.git &&\
|
||||
chown -R odoo:odoo /opt/odoo
|
||||
|
||||
# Install Odoo OCA default dependencies
|
||||
RUN set -x; \
|
||||
mkdir -p /tmp/oca-repos/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/account-financial-reporting.git /tmp/oca-repos/account-financial-reporting &&\
|
||||
mv /tmp/oca-repos/account-financial-reporting/account_tax_balance /opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/account-financial-tools.git /tmp/oca-repos/account-financial-tools &&\
|
||||
mv /tmp/oca-repos/account-financial-tools/account_lock_date_update \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
# Comment out modules not yet migrated on OCA for v14
|
||||
#git clone -b 14.0 --depth 1 https://github.com/OCA/account-invoicing.git /tmp/oca-repos/account-invoicing &&\
|
||||
#mv /tmp/oca-repos/account-invoicing/sale_timesheet_invoice_description \
|
||||
# /opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/bank-statement-import.git /tmp/oca-repos/bank-statement-import &&\
|
||||
mv /tmp/oca-repos/bank-statement-import/account_statement_import \
|
||||
/tmp/oca-repos/bank-statement-import/account_statement_import_ofx \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/partner-contact.git /tmp/oca-repos/partner-contact &&\
|
||||
mv /tmp/oca-repos/partner-contact/partner_disable_gravatar \
|
||||
/tmp/oca-repos/partner-contact/partner_firstname \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/project.git /tmp/oca-repos/project &&\
|
||||
mv /tmp/oca-repos/project/project_category \
|
||||
/tmp/oca-repos/project/project_status \
|
||||
/tmp/oca-repos/project/project_task_default_stage \
|
||||
/tmp/oca-repos/project/project_template \
|
||||
/tmp/oca-repos/project/project_timeline \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/server-auth.git /tmp/oca-repos/server-auth &&\
|
||||
mv /tmp/oca-repos/server-auth/password_security \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/server-brand.git /tmp/oca-repos/server-brand &&\
|
||||
mv /tmp/oca-repos/server-brand/disable_odoo_online \
|
||||
/tmp/oca-repos/server-brand/remove_odoo_enterprise \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/server-tools.git /tmp/oca-repos/server-tools &&\
|
||||
mv /tmp/oca-repos/server-tools/base_search_fuzzy \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/server-ux.git /tmp/oca-repos/server-ux &&\
|
||||
mv /tmp/oca-repos/server-ux/base_technical_features \
|
||||
/tmp/oca-repos/server-ux/date_range \
|
||||
/tmp/oca-repos/server-ux/mass_editing \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/social.git /tmp/oca-repos/social &&\
|
||||
mv /tmp/oca-repos/social/base_search_mail_content \
|
||||
/tmp/oca-repos/social/mail_debrand \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
git clone -b 14.0 --depth 1 https://github.com/OCA/web.git /tmp/oca-repos/web &&\
|
||||
mv /tmp/oca-repos/web/web_environment_ribbon \
|
||||
/tmp/oca-repos/web/web_responsive \
|
||||
/tmp/oca-repos/web/web_timeline \
|
||||
/opt/odoo/additional_addons/ &&\
|
||||
rm -rf /tmp/oca-repos/ &&\
|
||||
find /opt/odoo/additional_addons/*/i18n/ -type f -not -name 'fr.po' -delete &&\
|
||||
chown -R odoo:odoo /opt/odoo
|
||||
|
||||
# Copy entrypoint script and Odoo configuration file
|
||||
COPY ./entrypoint.sh /
|
||||
COPY ./odoo.conf /opt/odoo/etc/odoo.conf
|
||||
RUN chown odoo:odoo /opt/odoo/etc/odoo.conf
|
||||
|
||||
# Mount /opt/odoo/data to allow restoring filestore
|
||||
VOLUME ["/opt/odoo/data/"]
|
||||
|
||||
# Expose Odoo services
|
||||
EXPOSE 8069
|
||||
|
||||
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
|
||||
|
||||
# Set default user when running the container
|
||||
USER odoo
|
||||
|
||||
# Start
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["/opt/odoo/odoo/odoo-bin" "-c /opt/odoo/etc/odoo.conf"]
|
||||
|
||||
# Metadata
|
||||
#LABEL org.label-schema.schema-version="14.0" \
|
||||
# org.label-schema.vendor=LeFilament \
|
||||
# org.label-schema.license=Apache-2.0 \
|
||||
# org.label-schema.vcs-url="https://sources.le-filament.com/lefilament/odoo_docker"
|
||||
64
README.md
64
README.md
|
|
@ -12,68 +12,6 @@ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
|
|||
```
|
||||
|
||||
## Obtenir odoo CBD:
|
||||
|
||||
### Soit via l'image sur le repo
|
||||
|
||||
```sh
|
||||
docker pull lefilament/odoo:14.0
|
||||
```
|
||||
|
||||
### Soit en la recréant depuis la recette :
|
||||
|
||||
```yml
|
||||
echo "version: \"2.1\"
|
||||
services:
|
||||
odoo:
|
||||
image: lefilament/odoo:14.0
|
||||
container_name: odoo14
|
||||
depends_on:
|
||||
- db
|
||||
tty: true
|
||||
volumes:
|
||||
- filestore:/opt/odoo/data:z
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- odoo
|
||||
|
||||
db:
|
||||
image: postgres:13-alpine
|
||||
container_name: odoo14_db
|
||||
environment:
|
||||
POSTGRES_USER: \"odoo\"
|
||||
POSTGRES_PASSWORD: \"odoo\"
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data:z
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver_opts:
|
||||
encrypted: 1
|
||||
|
||||
volumes:
|
||||
filestore:
|
||||
db:
|
||||
|
||||
"> docker-compose.yml
|
||||
```
|
||||
|
||||
Changer le mot de passe odoo. Ce fichier sera autonatiquement utilisé lors du démarrage du container précisé dans le fichier, à condition d'être le répertoire où se trouve le fichier. On peut donc allumer dans l'ordre :
|
||||
|
||||
```sh
|
||||
docker-compose up -d db
|
||||
docker-compose up -d odoo
|
||||
```
|
||||
|
||||
Pour initier la base de données, sans les données de démonstration :
|
||||
|
||||
```sh
|
||||
docker-compose exec odoo python3 /opt/odoo/odoo/odoo-bin -c /opt/odoo/etc/odoo.conf --db_host db --db_port 5432 --db_user odoo --db_password LeVraiMotDePasse --init base --stop-after-init --no-http --without-demo=all
|
||||
```
|
||||
|
||||
On va avoir besoin de git pour ajouter les modules :
|
||||
|
||||
```sh
|
||||
docker-compose exec -u root odoo apt update
|
||||
docker-compose exec -u root odoo apt install git -y
|
||||
sh build.sh
|
||||
```
|
||||
|
|
|
|||
4
build.sh
Normal file
4
build.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
docker build -t odoo-susan .
|
||||
docker-compose exec odoo python3 /opt/odoo/odoo/odoo-bin -c /opt/odoo/etc/odoo.conf --db_host db --db_port 5432 --db_user odoo --db_password leMotDePasse --init base --stop-after-init --no-http --without-demo=all
|
||||
docker-compose --verbose up -d odoo
|
||||
36
docker-compose.yml
Normal file
36
docker-compose.yml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
version: "2.1"
|
||||
services:
|
||||
odoo:
|
||||
image: odoo-susan
|
||||
depends_on:
|
||||
- db
|
||||
tty: true
|
||||
ports:
|
||||
- 8012:8069
|
||||
volumes:
|
||||
- filestore:/opt/odoo/data:z
|
||||
- ./odoo.conf:/etc/odoo
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- odoo
|
||||
|
||||
db:
|
||||
image: postgres:13-alpine
|
||||
environment:
|
||||
POSTGRES_DB: "odoo"
|
||||
POSTGRES_USER: "odoo"
|
||||
POSTGRES_PASSWORD: "9fbacb5390fa08b1cea5c141498134021bead7ada7aa1731e6fdd3eae60af92b"
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data:z
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver_opts:
|
||||
encrypted: 1
|
||||
|
||||
volumes:
|
||||
filestore:
|
||||
db:
|
||||
|
||||
|
||||
51
entrypoint.sh
Executable file
51
entrypoint.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
echo "ARGS are : $@"
|
||||
|
||||
set -e
|
||||
ODOO="/opt/odoo/odoo/odoo-bin"
|
||||
|
||||
if [ -v PASSWORD_FILE ]; then
|
||||
PASSWORD="$(< $PASSWORD_FILE)"
|
||||
fi
|
||||
|
||||
# set the postgres database host, port, user and password according to the environment
|
||||
# and pass them as arguments to the odoo process if not present in the config file
|
||||
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
|
||||
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
|
||||
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
|
||||
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='9fbacb5390fa08b1cea5c141498134021bead7ada7aa1731e6fdd3eae60af92b'}}}
|
||||
|
||||
DB_ARGS=()
|
||||
function check_config() {
|
||||
param="$1"
|
||||
value="$2"
|
||||
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
|
||||
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
|
||||
fi;
|
||||
DB_ARGS+=("--${param}")
|
||||
DB_ARGS+=("${value}")
|
||||
}
|
||||
check_config "db_host" "$HOST"
|
||||
check_config "db_port" "$PORT"
|
||||
check_config "db_user" "$USER"
|
||||
check_config "db_password" "$PASSWORD"
|
||||
|
||||
case "$1" in
|
||||
-- | odoo)
|
||||
shift
|
||||
if [[ "$1" == "scaffold" ]] ; then
|
||||
exec $ODOO "$@"
|
||||
else
|
||||
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||
exec $ODOO "$@" "${DB_ARGS[@]}"
|
||||
fi
|
||||
;;
|
||||
-*)
|
||||
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||
exec $ODOO "$@" "${DB_ARGS[@]}"
|
||||
;;
|
||||
*)
|
||||
exec "$@"
|
||||
esac
|
||||
|
||||
exit 1
|
||||
38
odoo.conf
Normal file
38
odoo.conf
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
[options]
|
||||
addons_path = /opt/odoo/odoo/addons,/opt/odoo/additional_addons,/opt/odoo/private_addons
|
||||
data_dir = /opt/odoo/data
|
||||
; admin_passwd = admin
|
||||
; csv_internal_sep = ,
|
||||
; db_maxconn = 64
|
||||
db_name = odoo
|
||||
; db_template = template1
|
||||
; dbfilter = .*
|
||||
; debug_mode = False
|
||||
; email_from = False
|
||||
; limit_memory_hard = 2684354560
|
||||
; limit_memory_soft = 2147483648
|
||||
; limit_request = 8192
|
||||
; limit_time_cpu = 60
|
||||
; limit_time_real = 120
|
||||
; list_db = True
|
||||
; log_db = False
|
||||
; log_handler = [':INFO']
|
||||
; log_level = info
|
||||
; logfile = None
|
||||
; longpolling_port = 8072
|
||||
; max_cron_threads = 2
|
||||
; osv_memory_age_limit = 1.0
|
||||
; osv_memory_count_limit = False
|
||||
; smtp_password = False
|
||||
; smtp_port = 25
|
||||
; smtp_server = localhost
|
||||
; smtp_ssl = False
|
||||
; smtp_user = False
|
||||
unaccent = True
|
||||
; workers = 0
|
||||
; xmlrpc = True
|
||||
; xmlrpc_interface =
|
||||
; xmlrpc_port = 8069
|
||||
; xmlrpcs = True
|
||||
; xmlrpcs_interface =
|
||||
; xmlrpcs_port = 8071
|
||||
32
wait-for-psql.py
Executable file
32
wait-for-psql.py
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import psycopg2
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
arg_parser = argparse.ArgumentParser()
|
||||
arg_parser.add_argument('--db_host', required=True)
|
||||
arg_parser.add_argument('--db_port', required=True)
|
||||
arg_parser.add_argument('--db_user', required=True)
|
||||
arg_parser.add_argument('--db_password', required=True)
|
||||
arg_parser.add_argument('--timeout', type=int, default=5)
|
||||
|
||||
args = arg_parser.parse_args()
|
||||
|
||||
start_time = time.time()
|
||||
while (time.time() - start_time) < args.timeout:
|
||||
try:
|
||||
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres')
|
||||
error = ''
|
||||
break
|
||||
except psycopg2.OperationalError as e:
|
||||
error = e
|
||||
else:
|
||||
conn.close()
|
||||
time.sleep(1)
|
||||
|
||||
if error:
|
||||
print("Database connection failure: %s" % error, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
Loading…
Reference in a new issue