From f7dca71fdd234632a9f578c2da36066c54b93d11 Mon Sep 17 00:00:00 2001 From: Linden Crandall Date: Sun, 12 Jan 2025 22:50:34 +0000 Subject: [PATCH] Add Local Dev Environment Setup --- Local-Dev-Environment-Setup.md | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Local-Dev-Environment-Setup.md diff --git a/Local-Dev-Environment-Setup.md b/Local-Dev-Environment-Setup.md new file mode 100644 index 0000000..93511cc --- /dev/null +++ b/Local-Dev-Environment-Setup.md @@ -0,0 +1,65 @@ +# Getting Started + +## Prerequisites +In order to start developing you need to satisfy the following prerequisites: + +- Docker: [Docker Engine](https://docs.docker.com/engine/install/ubuntu/) +- docker-compose: [Docker Engine](https://docs.docker.com/engine/install/ubuntu/) +- Add current user to docker group: `sudo usermod -aG docker $USER` (you might have to logout and login again, or reboot your OS for changes to take effect) +- Git +- VS Code or VS Codium (VS Codium not tested) +- Dev Containers extension installed for VS Code. [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) + +## Step-By-Step Setup +- Request access to Shiloh's private `frappe_docker` git repo. Clone and cd to `frappe_docker` dir. +``` +git clone https://githaven.org/Shiloh/frappe_docker.git +cd frappe_docker +``` +- Run: +``` +cp -r devcontainer-example .devcontainer +cp -r development/vscode-example development/.vscode +``` +- Open project in VSCode: +``` +code . +``` +- When VS Code is opened, you should see a pop-up in the bottom right that says: "Reopen In Container". Select that and the dev container will be built and started automatically. If you don't see the pop up, close VS Code and reopen it. Alternatively, open VS Code, open command palette `Ctrl + Shift + P` then search for and select "Reopen in Container" **If this doesn't work, you might not have added your current user to the docker group correctly. This is required and can be tested by running docker commands without sudo i.e. `docker ps`** +- Once the dev container is finished building and you are in the new dev container VS Code window, copy `apps-example.json` to `apps.json`: +``` +cp apps-example.json apps.json +``` +- In apps.json, define the git repos and branches, which are apps, to be installed: +``` +[ + { + "url": "https://githaven.org/Shiloh/brotherton-erpnext", + "branch": "production" + }, + { + "url": "https://github.com/frappe/hrms", + "branch": "version-15" + } +] + +``` +- Run `installer.py` with the following flags (read `installer.py` to see what it does and for additional flags): +``` +python installer.py -j apps.json -s deverpnext.localhost -p 3.10.13 -v +``` +- cd into new frappe-bench folder and start python virtual environment: +``` +cd frappe-bench +. env/bin/activate +``` +- Set default site in Bench: +```bench use development.localhost +``` +- From /frappe-bench dir, start dev server: +```bench start +``` +- you should be able to now access your site with all of the apps you specified in `apps.json` at +``` +http://localhost:8000 +```