I have a test version of ERPNext running in docker. People have been trying it out, and setting things up.
At some point we will want to bring up a live version, on a different domain name.
Is there any way we can copy all the things we setup on the test version into the live version?
I am imagining that bench backup of the test site, followed by bench restore of the backup into the new site won’t work (the database names are different, for a start, and the domain name won’t be the same).
Thankyou everyone - so much else has gone wrong with my attempts at a docker install, I didn’t trust the restore engine to be able to restore to a different database. I will try it when I have everything running properly.
Copy the database backup into the database container (uncompressed) as backup.sql
docker-compose exec db bash
mysql -p
drop database _346dbbd99919e6b7;
create database _346dbbd99919e6b7;
source /var/lib/mysql/backup.sql
Exit
Copy the encryption_key from the original sites_config.json to the new one
Connect to the server
Result: Internal Server Error docker-compose logs backend reveals:
“Access denied for user ‘_346dbbd99919e6b7’@‘172.16.21.4’ (using password: YES)”
I am doing the first database command in the troubleshooting link. It says: UPDATE mysql.user SET Host = '%' where User = 'db_name'; FLUSH PRIVILEGES;
The result is:
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
Query OK, 0 rows affected (0.000 sec)
For reference:
select Host, User from user;
+-------------+-------------------+
| Host | User |
+-------------+-------------------+
| % | _346dbbd99919e6b7 |
| % | root |
| 172.16.21.4 | _346dbbd99919e6b7 |
| localhost | mariadb.sys |
| localhost | root |
+-------------+-------------------+
5 rows in set (0.001 sec)
I have confirmed that "db_name": "_346dbbd99919e6b7" in site_config.json.
I can also log onto the database from the database container mysql -p -u _346dbbd99919e6b7 _346dbbd99919e6b7 successfully.
Finally fixed it by running a valid Mariadb command:
grant all privileges on `<database name from sites/<domain name>/site_config.json`.* TO `<same database name (which is also the user name!)`@'%' IDENTIFIED BY '<password from the same file>';
Would it be an idea to update the troubleshooting page?