This question has been flagged
2 Replies
11289 Views

I am new to Odoo and have struggled getting my local development environment set up properly to mimic the Odoo.sh (Enterprise) instance that we have.

Avatar
Discard

Thank you very much for this valuable write-up, but please formulate it as question/answer, that way you can also earn the upvotes :-)

Two things:
  1. My intent was to help someone, not gain upvotes. By you closing it it serves neither of those objectives.
  2. I have tried to edit it, both before it was closed and after. Why would I not be able to edit my own post.
Based on those two items I will not be contributing to the "help" forum anymore. It has proven to be a complete waste of time -- more of a game than anything of real use.

Thanks,

Tim Turnquist

On Mon, May 14, 2018 at 3:56 PM, Ermin Trevisan <trevi@twanda.com> wrote:

Thank you very much for this valuable write-up, but please formulate it as question/answer, that way you can also earn the upvotes :-)

--
Ermin Trevisan


Sent by Odoo S.A. using Odoo.


Best Answer

This is the answer by Tim Turnquist, I have made a Q&A from his original post.

I am new to Odoo and have struggled getting my local development environment set up properly to mimic the Odoo.sh (Enterprise) instance that we have. It uses the Odoo Docker Image that is on the Docker Hub, but adds an easy way to include the Enterprise addons. I have recently completed setting this up and thought I might share what I learned with the community. 

  1. FIrst, install Docker (https://docs.docker.com/install/)

  2. Then create a file structure that looks like this:

  3. addons
    config
        odoo.conf
    enterprise
    docker-compose.yml
  4. Inside of the 'addons' folder clone/checkout your local code modules

  5. Inside of the 'config' folder have one file, odoo.conf that contains:

  6. [options]
    addons_path = /home/odoo/user,/home/odoo/enterprise
  7. Inside of the 'enterprise' folder put all of the enterprise addons

  8. And, finally, the docker-compose.yml should look like this:

  9. version: '2'
    services:
    web:
    container_name: odoo
    image: odoo:11.0
    depends_on:
    - db
    ports:
    - "8069:8069"
    volumes:
    - odoo-web-data:/var/lib/odoo
    - ./config:/etc/odoo
    - ./enterprise/addons:/home/odoo/enterprise
    - ./addons:/home/odoo/user
    db:
    container_name: db
    image: postgres:9.4
    environment:
    - POSTGRES_PASSWORD=odoo
    - POSTGRES_USER=odoo
    - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
    - odoo-db-data:/var/lib/postgresql/data/pgdata
    volumes:
    odoo-web-data:
    odoo-db-data:
  10. Once you have everything in place, run the following command:

  11. docker-compose up -d
  12. That will create a Docker Container for your database and another one for your Odoo code

  13. With your customized code in the 'addons' folder, point your IDE there and start coding.

  14. Your code changes can be seen at http://localhost:8069. (You may need to recycle your Odoo container, upgrade your app or update the apps list to see the changes)

While this is not an exact replica of Odoo.sh, it is fairly close and enables me to get up and into development mode quickly and easily. I hope this helps someone.


Please let me know if you have any questions, comments or other feedback.

Avatar
Discard

I would like to add another tip that I have been using to quickly get up and running from backups using this technique.

In order to back up Odoo, you need a data dump from postgres, and a backup of the filestore.

I store my backups as follows:

./backups

--./backups/filestore (mapped to odoo filestore in web container)

--./backups/db (contains 1 .sql file for each database, mapped to /docker-entrypoint-initdb.d in db container)

On the Odoo container you would like to back up, just execute pg_dump, something like this:

docker exec <container> pg_dump -U odoo -E UTF-8 -F p -b -C <DB_NAME> -f /docker-entrypoint-initdb.d/<DB_NAME>.sql

Next time you start a container w/ fresh volumes, the sql dump will be loaded into the new db, and your container will already have access to the filestore that you mounted. Just make sure that when you spin up new containers, the filestore you are using hasn't been modified since the last backup was taken.

You can see the logs as the database gets initialized, right after you start the containers:

docker logs --tail 50 --follow --timestamps <db container>

Forgot to mention how to add the mappings. In your docker-compose.yml, add:

Under db -> volumes:

- ./backups/db:/docker-entrypoint-initdb.d

Under web -> volumes:

./backups/filestore:/var/lib/odoo/filestore

Best Answer

I managed that using GitLab Auto DevOPS 
you can create a script to get any change on ur code and create test env and prod env 
and run the test procedures on ur code before build and deploy exactly like odoo.sh   

u can use docker only or kubernetes with teraform to accomplish this cycle 

Avatar
Discard