How to migrate my docker on Wndows to WSL2 Ubuntu?

I pull the Github repo to Windows instead of inside the WSL2 distro. It is so slow that makes development almost impossible.

Anyone has experience of moving everything from Windows to WSL2 Linux?

Edit:
I tried the following:

  1. Delete the containers which created from Windows frappe_docker folder. I didn’t delete the frappe_docker_devcontainer_mariadb-data volume.
  2. On WSL2 Ubuntu, pull the frappe docker repo, and start vscode .

The containers will be recreated, but how can I bring back the sites?

Should I use bench --site {site} backup and bench --site {site} restores {path/to/database/file} for backup and restore my site data?

If I use backup/restore, the site data, does that mean I don’t need to use bench new-site {site} to recreate the sites?

Or if I run bench --site {site} restores in my newly created containers, the site will be restored inside frappe-bench/sites folder?

I think this is crucial if I need to move my development between computers.

Hello @flim

The Frappe sites are metadata in DB and files in filesystem.

Best way to move a site is:

  • Inside the original backend container, run:

bench --site all backup --with-files --compress

This will backup your sites (DB and sites’ Files) into GZ backup files.
 

  • Copy these files into the new backend container.
     
  • The inside the new backend container, run:

UPDATED

bench new-site <site.name> --db-root-username <root> --db-root-password <root.password> 
bench --site <site.name> --restore <db-ql-gz-file> --with-public-files <files-gz> --with-private-files <private-files-gz>

Make sure that you point the command to the right files’ paths.
 

  • Once done with the above, run:
bench --site <site.name> migrate

 
Let us know how it goes.

K

How about the apps in frappe-bench/apps folder?
Is it simply copy the apps folder to the WSL2 Ubuntu’s frappe-bench folder, and modify the apps.json and apps.txt in the frappe-bench\sites?

I updated the answer above. Please take note.

What are the folders under you original frappe-bench/apps folder?

I use the official frappe/frappe_docker python installer.py to setup the bench, it installed frappe and erpnext apps. Here is a list of sites and apps in my original Windows environment. I don’t have site installed erpnext yet.

(env) frappe@5c4d172b3896:/workspace/development/frappe-bench$ bench --site all list-apps
airexpress.local
frappe        15.74.2 version-15
airplane_mode 0.0.1   develop

irfan.cabs
frappe  15.74.2 version-15
rentals 0.0.1   develop
commit  1.0.0   main

library.test
frappe             15.74.2 version-15
library_management 0.0.1   develop

This is the apps.json and apps.txt inside the sites folder:

apps.json

{
    "frappe": {
        "resolution": {
            "commit_hash": null,
            "branch": null
        },
        "required": [],
        "idx": 1,
        "version": "15.63.0"
    },
    "erpnext": {
        "is_repo": true,
        "resolution": {
            "commit_hash": "5dd99f896ee57bca5fbb85cb0f56f0443ef38b14",
            "branch": "version-15"
        },
        "required": [],
        "idx": 2,
        "version": "15.55.4"
    },
    "library_management": {
        "is_repo": true,
        "resolution": {
            "commit_hash": "318f26bb4f212d6a9c7c19524facdb76e8457a5a",
            "branch": "develop"
        },
        "required": [],
        "idx": 4,
        "version": "0.0.1"
    },
    "rentals": {
        "is_repo": true,
        "resolution": {
            "commit_hash": "c682fa860feeb21ad6ef31356bd8516f73d869de",
            "branch": "develop"
        },
        "required": [],
        "idx": 6,
        "version": "0.0.1"
    },
    "commit": {
        "is_repo": true,
        "resolution": {
            "commit_hash": "7595f0278ee121a8dfc3ba077c074d6f61e3897a",
            "branch": "main"
        },
        "required": [],
        "idx": 8,
        "version": "1.0.0"
    },
    "airplane_mode": {
        "is_repo": true,
        "resolution": {
            "commit_hash": "75b7f7995609cc6bcdb54e6ab08319182bf1062a",
            "branch": "develop"
        },
        "required": [],
        "idx": 9,
        "version": "0.0.1"
    }
}

apps.txt

frappe
airplane_mode
commit
erpnext
library_management
rentals

To move the app I run bench new-app {app_name} on the destination computer, then copy the app folder to overwrite the destination, i.e. frappe-bench/apps/rentals/retals, then run bench new-site and bench --site {site} restore.

I also moved my app to Github so that I can run bench get-app command.

1 Like