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.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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.
FIrst, install Docker (https://docs.docker.com/install/)
Then create a file structure that looks like this:
addons
config
odoo.conf
enterprise
docker-compose.ymlInside of the 'addons' folder clone/checkout your local code modules
Inside of the 'config' folder have one file, odoo.conf that contains:
- [options]addons_path = /home/odoo/user,/home/odoo/enterprise
Inside of the 'enterprise' folder put all of the enterprise addons
And, finally, the docker-compose.yml should look like this:
- version: '2'services:web:container_name: odooimage: odoo:11.0depends_on:- dbports:- "8069:8069"volumes:- odoo-web-data:/var/lib/odoo- ./config:/etc/odoo- ./enterprise/addons:/home/odoo/enterprise- ./addons:/home/odoo/userdb:container_name: dbimage: postgres:9.4environment:- POSTGRES_PASSWORD=odoo- POSTGRES_USER=odoo- PGDATA=/var/lib/postgresql/data/pgdatavolumes:- odoo-db-data:/var/lib/postgresql/data/pgdatavolumes:odoo-web-data:odoo-db-data:
Once you have everything in place, run the following command:
docker-compose up -d
That will create a Docker Container for your database and another one for your Odoo code
With your customized code in the 'addons' folder, point your IDE there and start coding.
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.
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
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
Thank you very much for this valuable write-up, but please formulate it as question/answer, that way you can also earn the upvotes :-)