Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How do I backup?

Subscribe

Get notified when there's activity on this post

This question has been flagged
backupdocker
1 Reply
9313 Views
Avatar
John

I'm using odoo in docker. I''m trying to setup backups, but all the info I've found is ancient.


I've seen many backing up "/var/lib/odoo" - but that is overkill as it backs up the app itself, not just user files.


Which are the user files that I need to backup?


I've seen some people mention "/usr/lib/python2.7/dist-packages/odoo/addons" as well - is that necessary, or outdated info?

0
Avatar
Discard
Avatar
MUHAMMAD Imran
Best Answer

Odoo Backup

A simple docker container that run Odoo backups covering both Odoo files and PostgreSQL db based on docker-pg-backup. It then copy the backup files on GoogleDrive using drive cli.

Getting the image

There are various ways to get the image onto your system:

The preferred way (but using most bandwidth for the initial image) is to get our docker trusted build like this:

docker pull martel/odoo-backup:latest

To build the image yourself without apt-cacher (also consumes more bandwidth since deb packages need to be refetched each time you build) do:

docker build -t martel/odoo-backup .

If you do not wish to do a local checkout first then build directly from github.

git clone git://github.com/martel-innovate/odoo-backup

Run

To create a running container do:

docker run --name="backups"\
           --hostname="pg-backups" \
           --link=watchkeeper_db_1:db \
           -v ${PWD}/backup:/backup \
           -v ${PWD}/credentials.json:/var/credentials.json \
           -i -d martel/pg-backup

In this example I used a volume into which the actual backups will be stored.

Specifying environment

You can also use the following environment variables to pass a user name and password etc for the database connection.

  • PGUSER if not set, defaults to : docker
  • PGPASSWORD if not set, defaults to : docker
  • PGPORT if not set, defaults to : 5432
  • PGHOST if not set, defaults to : db
  • PGDATABASE if not set, defaults to : db
  • ODOO_FILES if not set, defaults to : 1 (it will backup also files in /var/lib/odoo)
  • DRIVE_DESTINATION if not set, defaults to : "" (no path, so it will not run a Drive backup)

Example usage:

docker run -e PGUSER=bob -e PGPASSWORD=secret -e ODOO_FILES=1
    -e DRIVE_DESTINATION=path -link db -i -d martel/pg-backup

One other environment variable you may like to set is a prefix for the database dumps.

  • DUMPPREFIX if not set, defaults to : PG

Example usage:

docker run -e DUMPPREFIX=foo -link db -i -d martel/pg-backup

Here is a more typical example using docker-composer:

For docker-compose.yml:

db:
  image: postgres:9.4
  environment:
    - POSTGRES_USER=docker
    - POSTGRES_PASS=docker

dbbackups:
  image: martel/pg-backup:latest
  hostname: pg-backups
  links:
    - db:db
  volumes:
    - ${PWD}/backup:/var/backup
    - ${PWD}/credentials.json:/var/credentials/credentials.json #TODO document how to create the file
  environment:
    - ODOO_FILES=0
    - DRIVE_DESTINATION=path
    - ODOO_FILES=0
    - DRIVE_DESTINATION=path
    - PGHOST=db
    - PGDB=db
    - PGUSER=docker
    - PGPASSWORD=docker
    - PGPORT=5432

Then run using:

docker-compose up -d dbbackup
4
Avatar
Discard
John
Author

Hi thanks for this option - I'm sure some will benefit from it.

But unfortunately it doesn't answer the question. We need to know which files to backup, not add more complexity.

Adding another app just to do backups is overkill.

If you know which files need to be backed up, please let me know, it would be appreciated.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Error in Backup
backup docker v15
Avatar
0
Aug 24
2191
Database backup error: Postgres subprocess ('/usr/bin/pg_dump', '--no-owner', '--file=/tmp/tmpAa0O5Q/dump.sql', u'ahlain_db01') error 1 Solved
backup
Avatar
Avatar
Avatar
Avatar
Avatar
9
Jul 25
67157
how to backup ? Solved
backup
Avatar
Avatar
Avatar
Avatar
Avatar
9
Jul 24
103344
docker-compose resulted in The connection was reset (from firefox) or Empty reply from server (from curl)? Solved
docker
Avatar
Avatar
2
Sep 23
8036
Admin password does not load from odoo.conf
docker
Avatar
Avatar
1
Sep 22
3699
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now