Browse Source

[FIX]: working dockerfile and docker-compose

pull/128/head
Augustin Borsu 5 years ago
committed by Rémy Taymans
parent
commit
e061b657c6
  1. 2
      .dockerignore
  2. 3
      .gitignore
  3. 87
      Dockerfile
  4. 1
      README.md
  5. 15
      docker-compose.yml
  6. 1
      initial-data-load/00_initial.sql
  7. 6
      initial-data-load/01_readme.md
  8. 4
      initial-data-load/03_disable_crons.sql
  9. 54
      install-odoo-docker.md
  10. 24
      odoo.conf

2
.dockerignore

@ -0,0 +1,2 @@
*

3
.gitignore

@ -4,6 +4,7 @@ _build/
# dotfiles # dotfiles
.* .*
!.gitignore !.gitignore
!.dockerignore
!.mailmap !.mailmap
# compiled python files # compiled python files
*.py[co] *.py[co]
@ -32,3 +33,5 @@ install/win32/meta.py
/man/ /man/
/share/ /share/
/src/ /src/
initial-data-load/*.sql.gz

87
Dockerfile

@ -1,35 +1,72 @@
FROM odoo:9.0
FROM ubuntu:18.04
USER root
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
RUN apt-get update && apt-get install -y git wget gcc python-dev libssl-dev libffi-dev make
ENV DEBIAN_FRONTEND=noninteractive
# Install the basics
RUN ln -fs /usr/share/zoneinfo/Europe/Brussels /etc/localtime && \
apt-get update && apt-get install -y curl git postgresql python3-psycopg2 python3-pip && \
dpkg-reconfigure --frontend noninteractive tzdata
##### 10) Installer wkhtml to pdf 0.12.1 !! (pas une autre) (sur une machine 64 bit avec un ubuntu 64bit 14.04)
# RUN apt-get install -y fontconfig libfontconfig1 libxrender1 fontconfig-config libjpeg-turbo8-dev && \
# wget --quiet https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb && \
# dpkg -i wkhtmltox_0.12.5-1.trusty_amd64.deb && \
# ln -s /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage && \
# ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
# Install wkhtmltopdf 0.12.5
RUN curl -L https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb \
--output wkhtmltox_0.12.5-1.bionic_amd64.deb && \
(dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb || apt-get -f install -y) && \
ln -s /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage && \
ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf && \
rm -f wkhtmltox_0.12.5-1.bionic_amd64.deb
RUN mkdir -p /app/extra-addons && chown odoo /app/extra-addons
# Node (ubuntu 14 version of node is Old as f*)
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
apt-get install -y nodejs && \
npm install -g less less-plugin-clean-css
RUN useradd -ms /bin/bash odoo
USER odoo USER odoo
RUN git clone https://github.com/beescoop/Obeesdoo.git /app/extra-addons/obeesdoo -b 9.0 --depth 1 && \
git clone https://github.com/coopiteasy/vertical-cooperative.git /app/extra-addons/vertical-cooperative -b 9.0 --depth 1 && \
git clone https://github.com/coopiteasy/addons.git /app/extra-addons/houssine-addons -b 9.0 --depth 1 && \
git clone https://github.com/coopiteasy/procurement-addons /app/extra-addons/procurement-addons -b 9.0 --depth 1 && \
git clone https://www.github.com/OCA/l10n-belgium /app/extra-addons/l10n-belgium -b 9.0 --depth 1 && \
git clone https://www.github.com/OCA/mis-builder /app/extra-addons/mis-builder -b 9.0 --depth 1 && \
git clone https://www.github.com/OCA/web /app/extra-addons/web -b 9.0 --depth 1 && \
git clone https://github.com/OCA/server-tools /app/extra-addons/server-tools -b 9.0 --depth 1 && \
git clone https://github.com/OCA/reporting-engine /app/extra-addons/reporting-engine -b 9.0 --depth 1
RUN mkdir -p /home/odoo/extra-addons
WORKDIR /home/odoo
RUN git clone https://github.com/coopiteasy/OCB.git /home/odoo/odoo -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/addons.git /home/odoo/addons -b 12.0 --depth 1 && \
git clone https://github.com/beescoop/Obeesdoo.git /home/odoo/obeesdoo -b 12.0 --depth 1 && \
# git clone https://github.com/coopiteasy/procurement-addons.git /home/odoo/procurement-addons -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/vertical-cooperative.git /home/odoo/vertical-cooperative -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/account-financial-reporting.git /home/odoo/account-financial-reporting -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/account-financial-tools.git /home/odoo/account-financial-tools -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/bank-payment.git /home/odoo/bank-payment -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/l10n-belgium.git /home/odoo/l10n-belgium -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/mis-builder.git /home/odoo/mis-builder -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/pos.git /home/odoo/pos -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/reporting-engine.git /home/odoo/reporting-engine -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/server-tools.git /home/odoo/server-tools -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/web.git /home/odoo/web -b 12.0 --depth 1 && \
git clone https://github.com/coopiteasy/website.git /home/odoo/website -b 12.0 --depth 1 && \
echo "That's all folks!"
USER root USER root
RUN pip install --upgrade setuptools enum
RUN pip install -r /app/extra-addons/reporting-engine/requirements.txt
RUN pip install -r /app/extra-addons/server-tools/requirements.txt
RUN pip install -r /app/extra-addons/obeesdoo/requirements.txt
# RUN pip4 install --upgrade pip
# adding dependencies here so that we don't have to rebuild the previous steps if it changes.
# python3 c header files
# pillow dependencies
# more pillow dependencies
# python3-lxml
# python3-ldap
RUN apt-get install -y python3-dev \
libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev \
libwebp-dev tcl8.6-dev tk8.6-dev \
libxml2-dev libxslt1-dev \
libsasl2-dev libldap2-dev libssl-dev
USER odoo USER odoo
# Installing in user space because system-libraries cannot be uninstalled and conflict.
# Simpler than creating a virtualenv
RUN sed -i '/psycopg2/d' /home/odoo/odoo/requirements.txt && \
sed -i '/python3-ldap/d' /home/odoo/odoo/requirements.txt && \
sed -i '/xlwt/d' /home/odoo/odoo/requirements.txt && \
sed -i '/xlrd/d' /home/odoo/odoo/requirements.txt && \
pip3 install --user -r /home/odoo/odoo/requirements.txt \
-r /home/odoo/reporting-engine/requirements.txt \
-r /home/odoo/server-tools/requirements.txt
# COPY example_odoo.conf /etc/odoo/openerp-server.conf
WORKDIR /home/odoo/odoo
CMD python3 odoo.py

1
README.md

@ -6,6 +6,7 @@ Specific module for the Beescoop
- cf. [install-odoo-linux-server.md](install-odoo-linux-server.md) (review) - cf. [install-odoo-linux-server.md](install-odoo-linux-server.md) (review)
- cf. [install-odoo-linux.md](install-odoo.md) (review) - cf. [install-odoo-linux.md](install-odoo.md) (review)
- cf. [install-odoo-mac.md](install-odoo-mac.md) - cf. [install-odoo-mac.md](install-odoo-mac.md)
- cf. [install-odoo-docker.md](install-odoo-docker.md)
## Setup obeesdoo ## Setup obeesdoo

15
docker-compose.yml

@ -1,21 +1,22 @@
version: '3' version: '3'
services: services:
odoo: odoo:
build: . build: .
command: python3 odoo-bin -c odoo.conf
depends_on: depends_on:
- db - db
ports: ports:
- "8069:8069" - "8069:8069"
volumes: volumes:
- ./config:/etc/odoo/
- ./:/app/extra-addons/obeesdoo
- ./odoo.conf:/home/odoo/odoo/odoo.conf:Z
- ./:/home/odoo/obeesdoo:Z
db: db:
image: postgres:10 image: postgres:10
environment: environment:
- POSTGRES_DB=postgres
- POSTGRES_DB=beescoop
- POSTGRES_PASSWORD=odoo - POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo - POSTGRES_USER=odoo
volumes:
- ./initial-data-load:/docker-entrypoint-initdb.d:Z
ports:
- "5432:5432"

1
initial-data-load/00_initial.sql

@ -0,0 +1 @@
CREATE USER postgres;

6
initial-data-load/01_readme.md

@ -0,0 +1,6 @@
# Put a database dump here to load it in postgresql
Us the format `01_*.sql.gz` or `01_*.sql`.
Files are loaded alphabetically, it needs to be loaded after the creation of the odoo user and before we disable cron.
A postgres user has to be created because otherwise there will be errors importing the dump.

4
initial-data-load/03_disable_crons.sql

@ -0,0 +1,4 @@
UPDATE ir_cron SET active='f';
UPDATE ir_mail_server SET active='f', smtp_encryption='none', smtp_port=1025, smtp_host='localhost',smtp_user='', smtp_pass='';
UPDATE fetchmail_server SET active='f', password='', server='localhost';
update res_users set password='admin' where login='admin';

54
install-odoo-docker.md

@ -0,0 +1,54 @@
# Create development environment using docker
> Tested on fedora 31
## 1) install Docker
Checkout the [installation guide](https://docs.docker.com/install/) from docker.
TODO: make it work with [podman](https://podman.io/).
Be sure to start the docker daemon using `systemctl start docker` (enable if you want it to persist on reboot).
Depending on the distribution, you might need to either use sudo or create a docker group.
The following instructions assume that you can use docker without being root, add sudo if necessary.
## 2) Build the images (odoo - postgresql)
~ 15 minutes
```bash
docker-compose build
```
## 3) Load data in postgresql
Copy the sql.gz dump into the `initial-data-load` folder.
Prefix it with 02, so that it is loaded after user creation and before the crons are stopped.
```bash
docker-compose up db
```
This could take a while (~20 minutes) depending on the data dump you are using.
In order to reset your database, remove the container.
(It will have to rebuild the database the next time you start it).
```bash
docker-compose rm db
```
## 4) Run the project
All the modules need to be updated in order to be recognised.
To do that run
```bash
docker-compose run -p 8096:8096 odoo python odoo.py -c odoo.conf -d beescoop -u all
```
Once the update has been done, you can simply run the whole project by running
```bash
docker-compose up
```
I like to start the database in the background to only have the logs of the application.
```bash
docker-compose up -d db
docker-compose up odoo
```
## 5) Login
To login you may either use your account or the admin account whose password should have been reset to admin.

24
odoo.conf

@ -0,0 +1,24 @@
[options]
admin_passwd = admin
debug=True
dev=True
db_host=db
db_port=5432
db_user=odoo
db_password=odoo
database=beescoop
addons_path=/home/odoo/odoo/addons,
/home/odoo/obeesdoo,
/home/odoo/vertical-cooperative,
/home/odoo/addons,
# /home/odoo/procurement-addons,
/home/odoo/l10n-belgium,
/home/odoo/mis-builder,
/home/odoo/web,
/home/odoo/website,
/home/odoo/server-tools,
/home/odoo/account-financial-reporting,
/home/odoo/account-financial-tools,
/home/odoo/bank-payment,
/home/odoo/pos,
/home/odoo/reporting-engine
Loading…
Cancel
Save