Moving to docker

Currently I run erp-next in a virtual machine with the mysql database on the same virtual machine.

I’m looking to move to a docker version of erpnext. What would be the implication with regards to the migration? Can I just backup the mys database and point to that one from the erpnext docker (running mysql in a separate container)? I only did some customization on the documents and such, no python code changes etc.

Would launching the same version of erpnext, in a docker, with the data backup, simply work, or am I overlooking some things?

If you’ve customized doctypes using the customize form tool (rather than editing doctypes directly in development mode), everything should transfer fine. Just take a backup, including public/private files, and load the backup using the restore bench command.

https://www.frappeframework.com/docs/user/en/bench/reference/restore

3 Likes

Thanks for your response. Much appreciated. Will try this weekend.

if your DB is reasonable, you can use this method.

DB and file(s) size matters here because it will backup all files, push to S3 compatible storage, download files from storage and restore automatically using the scripts

1 Like

Sorry to come back on this one. Im not completely sure from the documentation how to go about. Is there a step by step script?

Because I also dont have S3 storage.

Perhaps anybody availbale to support thos migration (against compensation)?

Moving a site.

  1. Take bench --site {site-name} backup --with-files on the running setup.
  2. Copy files from sites/{site-name}/private/backups to new server and optionally stop old server so users don’t create new data.
  3. In case of container setup copy files from server into container using docker cp or placing files in volume location.
  4. Enter any worker container and create site using bench new-site --no-mariadb-socket command. Name the site as per configured domain name. (Note down the db_name from site_config.json created)
  5. Enter mariadb container / use mysql client and execute drop database {db_name}; create database {db_name}. This will clean the site db that was created by new site. We do this so that we have a running site configured without any database resulting in Internal Server Error.
  6. In mysql shell execute, use {db_name}; source /path/to/database.sql. This will restore the database from backup on fresh db. We use source from mysql shell as it re-connects in case of disconnection or timeout during restoration of huge database. Simple alternate command will be mysql -uroot -p{root-password} -h{hostname} {db_name} < /path/to/database.sql
  7. Copy additional keys and encryption_key from backed up site_config.json. (Note, DO NOT change the db_name, db_password keys from newly created site, only copy other keys from backup site_config)
4 Likes

Thanks for the extensive explanation. Going to give it a go.