Restoring Backup

953 views
Skip to first unread message

Mahesh

unread,
Nov 27, 2013, 4:38:27 AM11/27/13
to erpnext-dev...@googlegroups.com
Hello,

I have current older version of erpnext hosted on erpnext server.

I have desired to restore backup on my local machine, and hence I have downloaded the virtual machine and have successfully imported latest erpnext ova file.

I have also executed restoring the backup using the following

  • cd ~/erpnext
  •  wget https://link/to/backup --no-check-certificate #
  •  downloads database dump from erpnext.com
  •  gunzip path/to/backup # unzip the database dump
  •  ./lib/wnf.py --restore path/to/backup --force
  •  ./lib/wnf.py --update origin master --reload_gunicorn

Now I go to host browser and type


and I only see a fresh new install of ERPNEXT, ( and I do not see the restored version from backup )

even tried following in the VM shell..

db_name = "erpnext" in conf.py

which returned nothing.

Requesting to receive help in order to see a local version of my ERPNEXT with restored backup


Thanks in advance.
Regards,
Mahesh

Anand Doshi

unread,
Nov 27, 2013, 12:43:53 PM11/27/13
to ERPNext Developer's Forum
Hi Mahesh,

Since your database name in conf.py is erpnext, you need to use:
./lib/wnf.py --restore erpnext path/to/backup --force

-Anand.


--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mahesh

unread,
Nov 28, 2013, 6:27:36 AM11/28/13
to erpnext-dev...@googlegroups.com
ran this

./lib/wnf.py --restore erpnext path/to/backup --force

and then ran

./lib/wnf.py --update origin master --reload_gunicorn

However, I keep getting

Internal Server Error

when i try to logon through http://localhost:8000/

The Shell screen shot is here. http://imgur.com/d3fhc3A


Please let me how to go about further to this.





Regards,
Mahesh



Mahesh

unread,
Dec 2, 2013, 3:14:10 AM12/2/13
to erpnext-dev...@googlegroups.com
Requesting help from the community and also developers to intervene.

Regards,
Mahesh

rushabh

unread,
Dec 2, 2013, 10:27:30 AM12/2/13
to erpnext-dev...@googlegroups.com, ma...@maheshengg.com
Mahesh,

That screenshot is not enough - still cant figure what is calling the function. Earlier screens of the trace is required.

The core issue is that your instance is very old and not patched for quite a while. Ideally you should get help from a sys admin or let us update it for you :)

best,
Rushabh
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Maxwell Morais

unread,
Dec 2, 2013, 12:23:52 PM12/2/13
to erpnext-dev...@googlegroups.com
Hi, Mesh!

In terminal, inside you repository puts

./lib/wnf.py --sync_all
./lib/wnf.py --latest


2013/12/2 Mahesh <ma...@maheshengg.com>



--

Maxwell Morais
Tecnologia da Informação

Mahesh

unread,
Dec 3, 2013, 5:35:37 AM12/3/13
to erpnext-dev...@googlegroups.com
Hi Maxwell,

heres what happened when I put
./lib/wnf.py --sync_all  ..............................>  http://i.imgur.com/QEJXOlz.png  
./lib/wnf.py --latest        ............................> http://i.imgur.com/wvSnJms.png

In the above commands, it returns following

"ImportError: No Module named semantic_version"


Dear Rushabh,
I am not able to get a complete dump of log that happens on the console after I run
./lib/wnf.py --update origin master --reload_gunicorn ( googled, but couldnt find the procedure, shall be grateful if the community helps achieve it )

Agreed, instance is very old and not patched for quite a while, I should perhaps fix it by allowing you to update it. I am approaching seperately to support regarding this.

Thanks & Regards,
Mahesh







Maxwell Morais

unread,
Dec 3, 2013, 6:02:14 AM12/3/13
to erpnext-dev...@googlegroups.com
installl semantic_version, with pip or easy_install

sudo easy_install semantic-version
or
sudo pip install semantic-version


2013/12/3 Mahesh <ma...@maheshengg.com>

Pratik Vyas

unread,
Dec 11, 2013, 1:32:45 AM12/11/13
to erpnext-dev...@googlegroups.com
Hi Mahesh,

Can you run update again, latest version should be able to patch your instance without any exceptions.


--
Pratik
erpnext

Mahesh

unread,
Dec 12, 2013, 12:24:07 AM12/12/13
to erpnext-dev...@googlegroups.com
hi, when I say

./lib/wnf.py --restore erpnext path/to/sqlfile --force

it is saying no such file.
where as I checked with dir , the file is very much there...

what am I missing.

Sorry for putting a very silly question here.....


Regards,
Mahesh




--

Aditya Duggal

unread,
Jun 16, 2014, 1:45:06 AM6/16/14
to erpnext-dev...@googlegroups.com
Hi,

I am trying to restore a backup on v4 but I guess the old method does not work.

Can someone please let me know the correct way to restore an old backup on v4.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Jun 16, 2014, 3:05:53 AM6/16/14
to erpnext-dev...@googlegroups.com
Thanks Aditya for pointing out. Fixed instructions:

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/aeddb58c-a507-4d08-8673-cb069e31257b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aditya Duggal

unread,
Jun 16, 2014, 7:31:02 AM6/16/14
to erpnext-dev...@googlegroups.com
Hi,

I am getting a frappe command not found after I did the below things:

:~/frappe-bench/sites$ frappe --restore DBNAME SQLFILE
frappe: command not found

What am I missing?
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Jun 17, 2014, 3:16:21 AM6/17/14
to erpnext-dev...@googlegroups.com
Aditya,

You have to start the Python virtual env:

cd frappe-bench
. env/bin/activate


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/8f43f0a9-bdd5-45c2-96f5-65885a2d883a%40googlegroups.com.

Aditya Duggal

unread,
Jul 2, 2014, 7:19:48 AM7/2/14
to erpnext-dev...@googlegroups.com
I am getting this error:

Traceback (most recent call last):
  File "/home/addy/frappe-bench/env/bin/frappe", line 9, in <module>
    load_entry_point('frappe==4.1.0', 'console_scripts', 'frappe')()
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 53, in main
    return run(fn, parsed_args)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 81, in run
    out = globals().get(fn)(*args.get(fn), **args)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 67, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 375, in restore
    _install(db_name, source_sql=source_sql, quiet=quiet, force=force)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 306, in _install
    admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall)
  File "/home/addy/frappe-bench/apps/frappe/frappe/installer.py", line 30, in install_db
    create_database_and_user(force, verbose)
  File "/home/addy/frappe-bench/apps/frappe/frappe/installer.py", line 47, in create_database_and_user
    raise Exception("Database %s already exists" % (db_name,))
Exception: Database rigpl already exists


No matter what name of the database I choose, I am getting the same error. Could you please let me know what is it that I am missing.

Anand Doshi

unread,
Jul 2, 2014, 9:01:44 AM7/2/14
to ERPNext Developer's Forum
If you are doing this in a VM or somewhere other than your production server, use --force at the end of the command and it should be safe. Also, once the database is restored, you should get a message "Scheduler is disabled". Make sure that this message appears, else email pulling will start on this test setup.

-Anand.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/8c2d6ad2-ca18-418f-be23-384e7baa5ce8%40googlegroups.com.

Aditya Duggal

unread,
Jul 2, 2014, 9:18:00 AM7/2/14
to erpnext-dev...@googlegroups.com
Hi Anand,

Thanks for the tip. But now I guess I am stuck with another error as below:

(env)addy@addy:~/frappe-bench/sites$ frappe --restore DB_NAME /home/Downloads/XXX_database.sql --force
MySQL root password: 
Created user DB_NAME
Created database DB_NAME
Granted privileges to user DB_NAME and database DB_NAME
Starting database import...
sh: 1: cannot open /home/Downloads/XXX_database.sql: No such file
Imported from database /home/Downloads/XXX_database.sql
Traceback (most recent call last):
  File "/home/addy/frappe-bench/env/bin/frappe", line 9, in <module>
    load_entry_point('frappe==4.1.0', 'console_scripts', 'frappe')()
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 53, in main
    return run(fn, parsed_args)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 81, in run
    out = globals().get(fn)(*args.get(fn), **args)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 67, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 375, in restore
    _install(db_name, source_sql=source_sql, quiet=quiet, force=force)
  File "/home/addy/frappe-bench/apps/frappe/frappe/cli.py", line 308, in _install
    install_app("frappe", verbose=verbose, set_as_patched=not source_sql)
  File "/home/addy/frappe-bench/apps/frappe/frappe/installer.py", line 87, in install_app
    frappe.clear_cache()
  File "/home/addy/frappe-bench/apps/frappe/frappe/__init__.py", line 284, in clear_cache
    frappe.sessions.clear_cache()
  File "/home/addy/frappe-bench/apps/frappe/frappe/sessions.py", line 55, in clear_cache
    for sess in frappe.db.sql("""select user, sid from tabSessions""", as_dict=1):
  File "/home/addy/frappe-bench/apps/frappe/frappe/database.py", line 118, in sql
    self._cursor.execute(query)
  File "/home/addy/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/addy/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, "Table 'rigpl.tabSessions' doesn't exist")
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr...@googlegroups.com.

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr...@googlegroups.com.

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Aditya Duggal

unread,
Jul 2, 2014, 9:32:57 AM7/2/14
to erpnext-dev...@googlegroups.com
Hi Anand,

Please disregard the previous post, it turns out that I was not using the correct path (new to Linux and its paths)
But after the import of database I guess I am stuck with the Apps and I am getting an error for the rigpl_erpnext apps hook.

The error console is here: http://pastebin.com/JFr24LVv

Let me know how could I resolve this error.

I guess this error would also answer one of my queries that how could I setup a system on Develop branch to do the testing and then push the commits to the production branch.

Anand Doshi

unread,
Jul 2, 2014, 9:59:24 AM7/2/14
to ERPNext Developer's Forum
You need to have your custom apps also installed on your setup.

I recommend that you clone a fresh bench, but before restore/install, copy the standard_apps.json file from your production setup. Then run the install command and later restore your database.

-Anand.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/ab8fc319-499e-4edf-8c4f-60a6938d6163%40googlegroups.com.

Aditya Duggal

unread,
Jul 2, 2014, 10:25:00 AM7/2/14
to erpnext-dev...@googlegroups.com
Hi Anand,

I lost you in your explanation. I have checked my production server and there indeed is a standard_apps.json file under frappe-bench folder but when I checked on the contents then there is no mention of the custom apps in this json file.

Can you please elaborate as to how I could accomplish this feat. 

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Jul 3, 2014, 1:17:39 AM7/3/14
to erpnext-dev...@googlegroups.com
Aditya, you will have to install custom apps via:

frappe --install_app yourapp



To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/77b95933-5af7-4bfd-bd30-9fd2574d2ace%40googlegroups.com.

Aditya Duggal

unread,
Jul 4, 2014, 1:34:26 AM7/4/14
to erpnext-dev...@googlegroups.com
HI Anand,

The standard_apps.json in my production system is the same as the one in my test machine. the path which I am referring to is:

/frappe-bench/standard_apps.json

The content of this file in my production server only reflect to the 3 standard apps of erpnext and not to the custom app of rigpl.

I have also tried to edit the standard_apps.json file in my test environment to point to the rigpl_erpnext app and then run the install command but then I am getting this error:

Traceback (most recent call last):
  File "./scripts/virtualenv.py", line 2365, in <module>
    main()
  File "./scripts/virtualenv.py", line 829, in main
    after_install(options, home_dir)
  File "./scripts/virtualenv.py", line 2341, in after_install
    subprocess.check_output('/'.join([home_dir, 'bin', 'pip install honcho']), shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '/frappe-bench/env/bin/pip install honcho' returned non-zero exit status 1

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Pratik Vyas

unread,
Jul 4, 2014, 4:40:44 AM7/4/14
to erpnext-dev...@googlegroups.com
On Fri, Jul 4, 2014 at 11:04 AM, Aditya Duggal <aditya...@gmail.com> wrote:
> HI Anand,
>
> The standard_apps.json in my production system is the same as the one in my
> test machine. the path which I am referring to is:
>
> /frappe-bench/standard_apps.json
>
> The content of this file in my production server only reflect to the 3
> standard apps of erpnext and not to the custom app of rigpl.
>
> I have also tried to edit the standard_apps.json file in my test environment
> to point to the rigpl_erpnext app and then run the install command but then
> I am getting this error:
>
> Traceback (most recent call last):
> File "./scripts/virtualenv.py", line 2365, in <module>
> main()
> File "./scripts/virtualenv.py", line 829, in main
> after_install(options, home_dir)
> File "./scripts/virtualenv.py", line 2341, in after_install
> subprocess.check_output('/'.join([home_dir, 'bin', 'pip install
> honcho']), shell=True)
> File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
> raise CalledProcessError(retcode, cmd, output=output)
> subprocess.CalledProcessError: Command '/frappe-bench/env/bin/pip install
> honcho' returned non-zero exit status 1
>

Hi Aditya,

We'll be improving our bench system to make this easy. Will get back
to you soon about that.

You can try the following,

```
cd apps
git clone github.com/org/app1
pip install -e app1
git clone github.com/org/app2
pip install -e app2
cd ../sites
../env/bin/frappe --restore db_dump_file db_name sitename
../env/bin/frappe --use sitename
cd ..
./env/bin/honcho start
```

--
Pratik
erpnext

Aditya Duggal

unread,
Jul 4, 2014, 8:34:15 AM7/4/14
to erpnext-dev...@googlegroups.com, ma...@maheshengg.com
Hi Pratik,

Thanks for the help, I guess I am almost there.

I have been able to restore the database but I guess the website is not working on my system. When I login to 0.0.0.0:8000, I am getting a traceback "Keyerror" which is enclosed something to do with templates of website.

The link to pastebin is here http://pastebin.com/BPDHyVX8

Let me know what have I missed. 

Aditya Duggal

unread,
Jul 5, 2014, 6:37:07 AM7/5/14
to erpnext-dev...@googlegroups.com
Hi Pratik,

Have you had the chance to check on the problem?

Pratik Vyas

unread,
Jul 6, 2014, 12:31:51 AM7/6/14
to erpnext-dev...@googlegroups.com

Hi Aditya,

Doesn't seem like a deployment issue. Raise on on frappe/frappe

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/ac6227ad-77cf-4a9f-838c-3624ed65bc43%40googlegroups.com.

Aditya Duggal

unread,
Jul 7, 2014, 3:06:32 AM7/7/14
to erpnext-dev...@googlegroups.com
Hi Pratik,

Just raised an issue of frappe https://github.com/frappe/frappe/issues/676

Kindly let me know what else is needed from my end.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages