Skip to content

Erp Development

Creating containers

Setup first bench

Edit Honcho’s Procfile

Install an app

Start Frappe without debugging

If you faced some troubles

Creating containers

First of all you need to clone “frappe_docker” repo:

Terminal window
git clone https://github.com/frappe/frappe_docker.git

Second step rename the folders below:

Terminal window
cd frappe_docker
cp -R devcontainer-example .devcontainer
cp -R development/vscode-example development/.vscode

Now you have to open a cloned folder as “dev container”. Open the cloned folder in the new window . It requires Dev Containers extension for VS Code.

VS Code message you that you can reopen this folder as container. Bet it.After that you will have almost empty working directory. Don’t worry about that.

It should create and start frappe_docker_devcontainer with 5 subcontainers inside.

Setup first bench 

If you’re installing Frappe from version-14 branch

Terminal window
bench init --skip-redis-config-generation --frappe-branch version-14 --python python3 frappe-bench

If you’re installing Frappe from version-15 branch

You should login as root for the next steps. You can do it by connecting to the devcontainer_frappe using terminal.

Out of container, in your local terminal:

Terminal window
docker ps # See all the running containers
docker exec -it -u root <devcontainer_frappe_id> bash # Connect to container using bash
nvm install 20.11
nvm use 20.11
npm install -g yarn
bench init --skip-redis-config-generation --frappe-branch version-15 --python python3 frappe-bench

Configure database and redis connection

Terminal window
bench set-config -g db_host mariadb
bench set-config -g redis_cache redis://redis-cache:6379
bench set-config -g redis_queue redis://redis-queue:6379
bench set-config -g redis_socketio redis://redis-queue:6379

For any reason the above commands fail, set the values in common_site_config.json manually.

{

db_host": "mariadb",
redis_cache": "redis://redis-cache:6379",
"redis_queue": "redis://redis-queue:6379",
"redis_socketio": "redis://redis-socketio:6379"

}

Edit Honcho’s Procfile

Terminal window
./env/bin/pip install honcho
sed -i '/redis/d' ./Procfile

Create a new site with bench

bench new-site mysite.localhost --mariadb-root-password 123 --admin-password admin --no-mariadb-socket		

To develop a new app, the last step will be setting the site into developer mode. Documentation is available at this link.

bench --site mysite.localhost set-config developer_mode 1	
bench --site mysite.localhost clear-cache

Install an app

If you’re installing ERPNext from version-14 branch

bench get-app --branch version-14 erpnext	
bench --site mysite.localhost install-app erpnext	

Then write:

bench version (to see all your installed apps versions)
bench --site mysite.localhost migrate 	
bench --site mysite.localhost clear-cache	

If you’re installing ERPNext from version-15 branch

bench get-app --branch version-15 erpnext	
bench --site mysite.localhost install-app erpnext	

Then write:

bench version (to see all your installed apps versions)
bench --site mysite.localhost migrate 	
bench --site mysite.localhost clear-cache	

Start Frappe without debugging

Execute following command from the frappe-bench directory:

Terminal window
bench start

You can now login with the user Administrator and the password you choose when creating the site. Your website will now be accessible at location mysite.localhost:8000

If you faced some troubles 

If you got ProgrammingError on site - try

Terminal window
bench reinstall

If after that you got a “Your system is being updated. Please refresh again after a few moments” on the login page - try to erase “maintenance_mode” (ot set it to 0) property in common_site_config.json.