Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command line interface for backup/restore options #8170

Closed
ghost opened this issue Aug 20, 2015 · 35 comments
Closed

command line interface for backup/restore options #8170

ghost opened this issue Aug 20, 2015 · 35 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 20, 2015

there is no command line interface for backup/restore provided

Impacted versions:

  • 8.0

Steps to reproduce:

  1. At http://localhost:8069/web/database/manager we have "Backup" and "Restore" options.

    VS:

  2. No such options available through command line interface, see: ./odoo.py --help

Current behavior:

  • It's not possible to make backup and/or restore task from command line interface of odoo.py.

Expected behavior:

  • Command line interface for backupt/restore
  • This procedure should be able to execute in conditions of up and running odoo server instance, without its interruption (at least backup procedure, or both).
@francesco-carrella
Copy link

+1

@anassahmed
Copy link

It will certainly ease the cron job setup as I take a backup from the database and a copy from the data directory every day in the current setup.

I hope this issue gets fixed soon 👍

@habfast
Copy link

habfast commented Jun 15, 2016

This would be very welcome indeed.

@Yenthe666
Copy link
Collaborator

@mart-e I'd like this option too. I've labelled it as wishlist for now.

@mart-e
Copy link
Contributor

mart-e commented Jun 15, 2016

Hello,

What is the issue with restoring the database using the command line? It's actually very efficient and recommended for large databases.

$ zcat dump.sql.gz | psql mynewdatabase

@ghost
Copy link
Author

ghost commented Jun 15, 2016

Hello @mart-e,
what about filestore? The command you mention should restore only database, it's not a proper equivalent of "Backup" and "Restore" options at /web/database/manager, as filestore location config is available inside odoo, than it should be more convenient to include some routine into the odoo for restore option of command line

@mart-e
Copy link
Contributor

mart-e commented Jun 15, 2016

Filestore is also just moving a folder inside the localstorage directory. Of course you needs to be aware where it is as it may change between Odoo deployment but hopefully the system administrator knows this.

So still a wishlist, I am not against it if somebody makes a nice PR for master with a clean code.

@m-abdalrahman
Copy link

m-abdalrahman commented Oct 31, 2016

I've written simple cli program for odoo backup
https://github.com/m-abdalrahman/odoobup

@BetaUliansyah
Copy link

BetaUliansyah commented Oct 31, 2016

While Muhammad's solution suitable for development sever, in production
server, I use this:

  1. https://github.com/Yenthe666/auto_backup
  2. Scheduled action above module for whatever time and frequency you
    want, and auto remove 1 day
  3. use https://github.com/MediaFire/mediafire-fuse in crontab to send
    the backup files to your mediafire account

PS: Previously I have wrongly referred to https://www.odoo.com/apps/modules/10.0/auto_backup/

2016-10-31 8:13 GMT+07:00 Muhammad Abd al-Rahman notifications@github.com:

I've written simple cli program for backup
https://github.com/m-abdalrahman/odoobup


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#8170 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADjSBHFkU47w4a1ubn6I--kqYlLq84VFks5q5UCrgaJpZM4FvHJ_
.

*Jasa Add-on Domain Agan ke Google Apps Free Edition *
*10$/user/tahunhttp://goo.gl/4LBLRf http://goo.gl/4LBLRf *

@Yenthe666
Copy link
Collaborator

Hi @BetaUliansyah,

The module you like sounds quite familiar to one that I've made and open sourced to the community. You can find the module here: https://github.com/Yenthe666/auto_backup
P.S: Could you make a few printscreens of that module? I have a feeling it could be a copy of my module..

Regards,
Yenthe

@BetaUliansyah
Copy link

Hi @Yenthe666 ,

I misquote the source. I am using your module. But when I replied to this thread, I searched the module auto_backup in odoo apps market, and thats why I ended up with link to the paid modules.

I have corrected my previous reply at github.

@treviser
Copy link

It definitely looks like a copy of your module just ported to Odoo 10.0

When you check the "Also Available for Version" options in the app store
(9.0, 8.0, 7.0, master), you will end up at your modules.

On 31.10.2016 07:56, Yenthe V.G wrote:

Hi @BetaUliansyah https://github.com/BetaUliansyah,

The module you like sounds quite familiar to one that I've made and
open sourced to the community. You can find the module here:
https://github.com/Yenthe666/auto_backup
P.S: Could you make a few printscreens of that module? I have a
feeling it could be a copy of my module..

Regards,
Yenthe


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#8170 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/ABuxnRjaXi_JGeWsQYiC2H0POXl7NASDks5q5ZEAgaJpZM4FvHJ_.

twanda AG
Ermin Trevisan
Artherstrasse 19
CH-6318 Walchwil
T +41 41 758 1515
M +41 79 208 7373
E trevi@twanda.com
www.twanda.ch
www.twanda.ch/page/restaurant

@Yenthe666
Copy link
Collaborator

@treviser thank you for the tip, didn't even notice that.
It is amazing that it is so easy to copy and sell somebody his module..

@treviser
Copy link

treviser commented Oct 31, 2016

@Yenthe666 always happy to be at your service :-)

But to be serious: Bruce did change the license to "Odoo proprietary license", you did change the license from AGPL (Version 8.0) to LGPL (Version 9.0) which makes it basically possible to convert it to a propriatery license, but I don't know if this can be done without your consent as an author.

What is also astonishing is that Odoo app store allows to use the same app name without clarifying the legal aspects.

Whatever the legal situation, morally it is rather smart just to sell your module without even contacting you.

@yajo
Copy link
Contributor

yajo commented Oct 31, 2016

you did change the license from AGPL (Version 8.0) to LGPL (Version 9.0) which makes it basically possible to convert it to a propriatery license

That's absolutely a lie.

@lukebranch
Copy link

lukebranch commented Oct 31, 2016

@Yenthe666 ,

I personally believe this kind of behaviour is a bit of a problem in the Odoo App Store. I've seen a number of modules carbon copied (or close enough to) without attribution.

I don't believe the publishers are unaware of the implications of the license, I am under the impression that they just don't care unless there are significant consequences.

I think there needs to be a more effective deterrent for this sort of behaviour by means of a reporting and review mechanism in the Odoo apps store to make it more attractive to publishers. I believe many are likely nervous about publishing their hard work just to have someone purchase it and republish a derivative work (that is close to a copy) under their own name at a cheaper price.

I believe some sort of reporting and review mechanism would be beneficial, even if the review is nothing more than a diff check between reported modules.

For paid apps Envato seems to do a pretty good job of this and offers better incentives for those who publish with envato exclusively for example, as well as offering single use tiers and multi-use/distribution tiers for reselling derivative works of a module.

I believe emulating some of their business processes may be beneficial for the Odoo apps store in order to combat this sort of behaviour.

@treviser
Copy link

@yajo I'm still trying to truly understand the terms "library" and "combined works", so could you elaborate a bit more about your statement?

@yajo
Copy link
Contributor

yajo commented Nov 2, 2016

You confuse relicensing with depending on some work.

Only the author of a project, the owner of the copyright, has the rights to change its license, and that applies under all the *GPL family. That happened from Odoo v8 to v9.

When some code is under LGPL, however, that means you can use that code as a library of a private program. Take for instance GTK+. Its license is LGPL 2, so you can create a privative app that uses GTK as a library, but cannot create a privative fork of GTK+ changing its license.

Review http://www.gnu.org/licenses/gpl-faq.html, they can help you more than me.

@treviser
Copy link

treviser commented Nov 2, 2016

@yajo Thanks for your reply. Can't porting of a module to a new version in this case be considered as depending on some work (means @Yenthe666 's module version 9.0 under LGPL3) and therefore it is not just a plain relicensing issue?

@yajo
Copy link
Contributor

yajo commented Nov 3, 2016

No, you depend on other work when you add it to dependencies; when you migrate you are modifying the source of the addon. Think about it: if you could relicense any LGPL work to the license of your wish, it would be the same as publishing your code under the public domain, and the LGPL would have no meaning at all.

tl;dr: You can't legally change the license of any project, unless you are the owner of the original source, but you can use that project as a dependency for yours as long as both have compatible licenses.

@treviser
Copy link

treviser commented Nov 3, 2016

That's what I felt also, I just wanted to be very cautious in my statement without proper legal knowledge. Thanks for the clarification.

@mart-e
Copy link
Contributor

mart-e commented Nov 3, 2016

Hi guys,

For this kind of issue on module publications, you can always contact us at apps odoo com.
We can do code comparison of modules if you believe there is abuse or copyright irregularities.

@treviser
Copy link

treviser commented Nov 3, 2016

@mart-e In this case it is less a code comparison problem, for me it is questionable how somebody is able to hijack an existing module name for a new Odoo version and changing the license to a proprietary one without Odoo asking for a written consent of the previous authors. Due to this action, @Yenthe666 will not be able to port his own module with his license to version 10 without renaming it, which breaks consistency and leads to total confusion for app store clients.

@Yenthe666
Copy link
Collaborator

Hi @mart-e,

Could this be handled as soon as possible please? I've just got an e-mail from somebody that bought this ripped of V10 version on the app store:
image

For the love of god, can we please build in some validations and checks on this? I could literally copy any module, make it paid, choose the licenses and get away with it.. not something good to see.

@fredsonphiri
Copy link

You can backup from command line or using cron with:
wget --post-data 'master_master_pwd=actual_password&name=actual_data_base_name&backup_format=zip' -O back_up_filename.zip http://localhost:8069/web/database/backup

Credits to:http://www.garasiku.web.id/web/joomla/index.php/odoo-openerp/97-odoo-9-backup-using-wget

@djallits
Copy link

djallits commented Sep 5, 2017

Small correction to strip out the extra master_ in the --post-data value.

wget --post-data 'master_pwd=ADMIN_PASSWORD&name=DB_NAME&backup_format=zip' -O back_up_filename.zip http://localhost:8069/web/database/backup

@stellaf
Copy link

stellaf commented Nov 27, 2017

wget --post-data 'master_pwd=ADMIN_PASSWORD&name=DB_NAME&backup_format=zip' -O back_up_filename.zip http://localhost:8069/web/database/backup
works for backup.

What is the command for restore then?

@stellaf
Copy link

stellaf commented Nov 27, 2017

find out from other web, https://www.odoo.com/forum/help-1/question/restore-takes-at-least-4-arguments-4-given-error-in-restore-odoo-9-via-web-front-end-using-curl-cli-109204

syntaxc for restore database in commandline is
$ curl -F 'master_pwd=password' -F backup_file=@/home/user/test.zip -F 'copy=true' -F 'name=dbname' http://localhost:8069/web/database/restore

@pedrobaeza
Copy link
Collaborator

As there are workarounds provided, I close this.

@stidiovip
Copy link

I get 400 - Bad request : Invalid CSRF Token for this

@harmancasvi
Copy link

Hi everyone! Since I prefer using curl, this site provides a dedicated post to Odoo backup and restore via CLI :)

Just in case -so you don't have to go to the actual site- here's the relevant code for backing up:
curl -X POST -F 'master_pwd=ADMIN_PASSWORD' -F 'name=DB_NAME' -F 'backup_format=zip' -o /backup_dir/back_up_filename.zip http://localhost:8069/web/database/backup

And for restoring:
curl -F 'master_pwd=superadmin_passwd' -F backup_file=@/opt/odoo/odoo_backups/db1.2018-04-14.zip -F 'copy=true' -F 'name=db3' http://localhost:8069/web/database/restore

Backup script (~/odoo_backup.sh):

#!/bin/bash

# vars
BACKUP_DIR=~/odoo_backups
ODOO_DATABASE=db1
ADMIN_PASSWORD=superadmin_passwd

# create a backup directory
mkdir -p ${BACKUP_DIR}

# create a backup
curl -X POST \
    -F "master_pwd=${ADMIN_PASSWORD}" \
    -F "name=${ODOO_DATABASE}" \
    -F "backup_format=zip" \
    -o ${BACKUP_DIR}/${ODOO_DATABASE}.$(date +%F).zip \
    http://localhost:8069/web/database/backup


# delete old backups
find ${BACKUP_DIR} -type f -mtime +7 -name "${ODOO_DATABASE}.*.zip" -delete

You can always automate the backup with a cron job, hence the provided script. Hope it helps!

@DuongNHD
Copy link

DuongNHD commented Dec 5, 2018

Hi @Yenthe666 ,
I have a problem.
After the backup service is successfully, the server create file at path /tmp (same /tmp/tmp****/filestore, dump.sql, manifest) causing the hardware full. What is the way config to remove this file??

One more thing, how to config list_db is True?
Thanks.

@Yenthe666
Copy link
Collaborator

You'll need to code something to auto remove thrm every once in a while.
The list_db parameter is configured in the Odoo config file, under /etc.
You can ask these kind if questions on the official help forums at help.odoo.com

@Reechee88
Copy link

Reechee88 commented Dec 5, 2018

I have also problem with assets... I got http 401 error after 30-60 minutes... Not only for assets, but for API-s.

E.g.:
"GET /web/content/26553-4ee91ce/web.assets_common.js HTTP/1.1" 401 -
"GET /web/content/26554-7acf2d5/web.assets_backend.js HTTP/1.1" 401 -
"GET /api/job_cities_v2 HTTP/1.1" 401 -

It runs smoothly for an hour but after that it is dead. Everything is 401... It is so sporadically.

Running Odoo 11 CE under Docker with nginx.

What could be the problem? I am investigating it since 40 hours now...

Second failure on same day... Not it gives HTTP 400 for every quest...

E.g.:
2018-12-05 12:06:29,007 9 INFO darsana werkzeug: 212.52.180.205 - - [05/Dec/2018 12:06:29] "POST /api/user_v2/apply HTTP/1.1" 400 -

What the hell??!

@lmignon
Copy link
Contributor

lmignon commented Dec 5, 2018

@Reechee88 you can take a look at acsone/click-odoo-contrib#33
It's proposal to add new command line script to backup an odoo database..
see description for more info: https://github.com/acsone/click-odoo-contrib/pull/33/files#diff-88b99bb28683bd5b7e3a204826ead112R104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests