How to Install Frappe/Erpnext Development Environment using Docker for Windows

Frappe Application Development Tutorial: https://frappe.io/docs/user/en/tutorial

frappe_docker GitHub repository: https://github.com/frappe/frappe_docker

You may be wondering what is this “dbench”, I was too. It is a thin wrapper & short script that basically runs the “bench” script but inside your Docker container, hence the “d” prefix. However, there are some special commands that are handled by dbench itself:

./dbench -h
            Shows this help message
./dbench
            Launches you into an interactive shell in the container as user frappe
./dbench <command to send to bench>
            Runs the bench command <command>, i.e. ./dbench new-site "site1.local" = bench new-site "site1.local"
./dbench setup docker [ stop | down ]
            Builds and starts the docker containers using "docker-compose up -d"
./dbench setup hosts
            Adds all site names to the containers hosts file
./dbench -c frappe | root <command to run>
            Runs a command in the container, as the selected user

Other commands are passed directly to bench inside the Docker container.

Docker for Windows only: You can run dbench in Windows e.g. using Git Bash for Windows. However, due to this issue you will get this error: the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty’. As a workaround, you will need to prefix winpty to every docker command. Use this before calling any docker command:

alias docker='winpty docker'

Edit in dbench: (currently as PR #86)

    winpty docker exec -itu "${user}" frappe bash -c "[email protected]"

Because of frontmatter bug, you need to edit the following in dbench:

    run frappe "cd .. && bench init frappe-bench --frappe-branch version-12 --ignore-exist --skip-redis-config-generation && cd frappe-bench"

Now you can run:

./dbench setup
# this will run: bench init frappe-bench
./dbench init

./dbench init in particular will take a long time, because it will download a lot of packages:

Add a new site and start Frappe:

./dbench new-site site1.local
./dbench setup hosts
./dbench start

Troubleshooting: If “./dbench start” fails, and you get output similar to the following:

$ ./dbench start
 17:41:53 system           | redis_socketio.1 started (pid=687)
 17:41:53 redis_socketio.1 | /bin/sh: 1: redis-server: not found
 17:41:53 system           | redis_socketio.1 stopped (rc=127)
 17:41:53 system           | worker_long.1 started (pid=701)
 17:41:53 system           | worker_short.1 started (pid=700)
 17:41:53 system           | schedule.1 started (pid=697)
 17:41:53 system           | watch.1 started (pid=692)
 17:41:53 system           | web.1 started (pid=696)
 17:41:53 system           | redis_queue.1 started (pid=695)
 17:41:53 redis_queue.1    | /bin/sh: 1: redis-server: not found
 17:41:53 system           | redis_queue.1 stopped (rc=127)
 17:41:53 system           | worker_default.1 started (pid=698)
 17:41:53 system           | redis_cache.1 started (pid=699)
 17:41:53 redis_cache.1    | /bin/sh: 1: redis-server: not found
 17:41:53 system           | redis_cache.1 stopped (rc=127)
 17:41:53 system           | socketio.1 started (pid=702)
 17:41:53 system           | sending SIGTERM to worker_long.1 (pid 701)
 17:41:53 system           | sending SIGTERM to watch.1 (pid 692)
 17:41:53 system           | sending SIGTERM to web.1 (pid 696)
 17:41:53 system           | sending SIGTERM to schedule.1 (pid 697)
 17:41:53 system           | sending SIGTERM to worker_default.1 (pid 698)
 17:41:53 system           | sending SIGTERM to socketio.1 (pid 702)
 17:41:53 system           | sending SIGTERM to worker_short.1 (pid 700)
 17:41:53 system           | watch.1 stopped (rc=-15)
 17:41:53 system           | schedule.1 stopped (rc=-15)
 17:41:53 system           | web.1 stopped (rc=-15)
 17:41:53 system           | worker_default.1 stopped (rc=-15)
 17:41:53 system           | worker_long.1 stopped (rc=-15)
 17:41:53 system           | worker_short.1 stopped (rc=-15)
 17:41:53 system           | socketio.1 stopped (rc=-15)

then your problem might be issue #1.

Solution: Make sure that inside Docker container:

  • ~/frappe-bench/Procfile contains exactly like Procfile_docker in frappe_docker repo, and
  • ~/frappe-bench/sites/site1.local/site_config.json contains exactly like sites/common_site_config.json in frappe_docker folder.

Troubleshooting: You may get “bench” errors:

  • Error: No such command “serve”.
  • Error: No such command “worker”.
$ ./dbench start
 17:51:14 system           | socketio.1 started (pid=758)
 17:51:14 system           | schedule.1 started (pid=755)
 17:51:14 system           | worker_short.1 started (pid=757)
 17:51:14 system           | worker_long.1 started (pid=750)
 17:51:14 system           | web.1 started (pid=753)
 17:51:14 system           | watch.1 started (pid=754)
 17:51:14 system           | worker_default.1 started (pid=756)
 17:51:17 socketio.1       | listening on *: 9000
 17:51:18 web.1            | Usage: bench [OPTIONS] COMMAND [ARGS]…
 17:51:18 web.1            | Try "bench --help" for help.
 17:51:18 web.1            |
 17:51:18 web.1            | Error: No such command "serve".
 17:51:18 worker_short.1   | Usage: bench [OPTIONS] COMMAND [ARGS]…
 17:51:18 worker_short.1   | Try "bench --help" for help.
 17:51:18 worker_short.1   |
 17:51:18 worker_short.1   | Error: No such command "worker".
 17:51:18 system           | web.1 stopped (rc=2)
 17:51:18 system           | sending SIGTERM to worker_long.1 (pid 750)
 17:51:18 system           | sending SIGTERM to watch.1 (pid 754)
 17:51:18 system           | sending SIGTERM to schedule.1 (pid 755)
 17:51:18 system           | sending SIGTERM to worker_default.1 (pid 756)
 17:51:18 system           | sending SIGTERM to socketio.1 (pid 758)
 17:51:18 system           | sending SIGTERM to worker_short.1 (pid 757)
 17:51:18 system           | watch.1 stopped (rc=-15)
 17:51:18 system           | worker_long.1 stopped (rc=-15)
 17:51:18 system           | schedule.1 stopped (rc=-15)
 17:51:18 system           | worker_default.1 stopped (rc=-15)
 17:51:18 system           | worker_short.1 stopped (rc=-15)
 17:51:18 system           | socketio.1 stopped (rc=-15)

Use Frappe: Open your browser to localhost:8000/login. Then log in using the username Administrator and the password admin.

FAQ: Can I install Frappe/Erpnext Development Environment using Ubuntu in Windows 10 Store (aka WSL)?

Unfortunately, I’ve tried using Ubuntu in Windows 10 Store, doesn’t work because MariaDB won’t run.

Although frappe-bench itself will work, I think a better and more consistent/cross-platform approach is the Docker way.

social-work-2356009_1920@2x

Samuel Life in Other Word

When, while the lovely valley teems with vapor around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God!

O my friend — but it is too much for my strength — I sink under the weight of the splendor of these visions! A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine.

I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.

When, while the lovely valley teems with vapor around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing, Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me.