6
Local Dev Environment Setup
Linden Crandall edited this page 2025-01-14 23:15:12 +00:00

Getting Started

Prerequisites

In order to start developing you need to satisfy the following prerequisites:

  • Docker: Docker Engine
  • docker-compose: Docker Engine
  • IMPORTANT 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; test by trying to run a docker command without sudo i.e. docker ps)
  • Git
  • VS Code or VS Codium (VS Codium not tested)
  • Dev Containers extension installed for VS Code. Dev Containers

Step-By-Step Setup

  • Request access to Shiloh's private frappe_docker git repo. Clone repo:
git clone https://githaven.org/Shiloh/frappe_docker.git
  • Enter your Shiloh git account creds. ex):
Cloning into 'frappe_docker'...
Username for 'https://githaven.org': USERNAME
Password for 'https://USERNAME@githaven.org': ************
  • cd to frappe_docker dir:
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 finishes building, you should be in a new VS Code window within the new dev container as the frappe user.
  • From the terminal in VS Code, 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) THIS ONLY NEEDS TO BE RAN ONCE:
python installer.py -j apps.json -s development.localhost -p 3.10.13 -v
  • After installer.py finishes, 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
  • Login defaults (unless you changed them)
  • Frappe
username: Administrator
password: admin

References

Frappe Docker Development Setup Guide for Custom Apps

frappe_docker/docs/development.md