Help migrating from EasyInstall to Docker

Hello,

I hope you are all well and safe.

I decided to try to update my server and go from Ubuntu 18 to 20.

I created Backups of everything and installed buntu 20.04. I was trying with the EasyInstall and with manual install and the 2 ways gave me considerable headache. I remember the last time I did this had been very straightforward.

I had tried to stay away from Docker for a long time, but in desperation gave it a try, and to my surprise ERPNext installed easily and without problems all the times I tried, so very impressed with the ERPNext Docker version.

The problem now is that I am trying to bring all the data from previous install, and I am having it difficult.

Following @revant_one suggestions in one of his posts, I deleted the database of the recently installed ERPNext, and recreated it. Then I was able to import all the data to the empty database from my previous sql file.

But I am not able to make any progress from there. I tried with the migrate command, but I get an error that I have not been able to solve:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/commands/migrate.py", line 52, in <module>
    main()
  File "/home/frappe/frappe-bench/commands/migrate.py", line 45, in main
    migrate_sites()
  File "/home/frappe/frappe-bench/commands/migrate.py", line 36, in migrate_sites
    migrate()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 90, in migrate
    frappe.get_attr(fn)()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/website_theme/website_theme.py", line 188, in after_migrate
    doc.generate_bootstrap_theme()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/website_theme/website_theme.py", line 79, in generate_bootstrap_theme
    frappe.throw('<div style="font-family: monospace;">{stderr}</div>'.format(stderr=stderr))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 446, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 425, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 379, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: <div style="font-family: monospace;">Error: File to import not found or unreadable: frappe/public/scss/website.<br>        on line 28 of stdin<br>>> @import "frappe/public/scss/website";<br><br>   ^<br><br></div>

I have to confess that I am very lost with the locations of the different folders in Docker.

I understand there is a file missing in there, but I am not able to undertand where should it go, nor find it.

If someone could enlighten me a little bit, I woudl be very grateful.

Thanks and kind regards from Spain,

Alb

from where did you try this command?

from existing container (docker exec) or from new container (docker run)?

if it is new container try mounting assets-vol as well as sites-vol and run the command

the erpnext-python container needs js assets sometimes, we’re making sure they are available by doing this:

and

erpnext-python container needs erpnext-nginx container to populate assets and symlink frappe/node_modules.

erpnext-nginx container copies assets from self into assets-vol which is also mounted by erpnext-python.

Hello @revant_one,

Many thanks for your reply.

I did this from new container, as instructions in here suggest: Here

This is what I used:

docker run
-e “MAINTENANCE_MODE=1”
-v myerp_sites-vol:/home/frappe/frappe-bench/sites
-v myerp_assets-vol:/home/frappe/frappe-bench/sites/assets
–network myerp_default
frappe/erpnext-worker:edge migrate

I thought I was mounting those volumes with -v erpastillero_sites-vol:/home/frappe/frappe-bench/sites \ and -v erpastillero_assets-vol:/home/frappe/frappe-bench/sites/assets \

Should I mount them in any other way?

Many thanks and kind regards,

Alb

Do you want to restore your old database to your new docker container ? if so , why are you not using bench backup - bench restore ?

1 Like

try executing from command from running container?

with docker exec

1 Like

Hi @bahaou and @revant_one ,

Many thanks for your replies.

I wasn’t using what you suggest because I was on a headless-chicken loop.

I was following instructions here and there, without being very sure of I was doing.

I wanted indeed to restore my old database to my new docker container, so I did, as you suggested:

docker exec -it <erpnext-python> bash`
docker exec -it <erpnext-python> bash
bench --site erp1.mydomain.com restore /backup --with-public-files /backup --with-private-files /backup

This went well, but I was still getting a Internal Server Error on the Frontend, so I did:

bench --site erp1.astilleroslagos.com migrate

With this everything is nearly in there, but I am still getting:

raise raise_exception(msg)
frappe.exceptions.ValidationError: <div style="font-family: monospace;">Error: File to import not found or unreadable: frappe/public/scss/website.<br>        on line 28 of stdin<br>>> @import "frappe/public/scss/website";<br><br>   ^<br><br></div>
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 20, in <module>
    subprocess.check_call(
  File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/frappe/frappe-bench/env/bin/python', '/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py', 'frappe', '--site', 'erp1.mydomain.com', 'migrate']' returned non-zero exit status 1.

This only affects the login page, and all the data and everything else seems okay and seems to operate okay.

So I am nearly there, I just need to figure out a little more of something…

Many thanks for your help, and kind regards from Spain

Alb

I think issue is with Mariadb user permission,

in case of restore command the user {db_name}@localhost is created, what we need is {db_name}@% follow this frappe_docker/development at main · frappe/frappe_docker · GitHub

briefly, run following in root MySQL shell, replace db_name and db_password with actual name and password.

UPDATE mysql.user SET Host = '%' where User = 'db_name'; FLUSH PRIVILEGES;
SET PASSWORD FOR 'db_name'@'%' = PASSWORD('db_password'); FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON `db_name`.* TO 'db_name'@'%'; FLUSH PRIVILEGES;
EXIT;

Hi @revant_one,

Many thanks for your help.

I was able to solve my problem by being able to login and delete the website theme I had, and choosing the default one. After that it was all normal.

In any case, I tried to do the migration with what you suggest, and I get this:

UPDATE mysql.user SET Host = '%' where user = '1978b3f2a9ed6f9d';

View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

I am trying to do this before the migration. Is that correct?

Many thanks and kind regards,

Alb