Bench to support multiple repositories

Okay, just run bench setup redis in the second folder, and try running bench start

No such commands.

dell@hercules:~/frappe/frappe-bench-llc$ bench setup redis
Usage: bench setup [OPTIONS] COMMAND [ARGS]…

Error: No such command “redis”.

dell@hercules:~/frappe/frappe-bench-llc$ bench setup --help
Usage: bench setup [OPTIONS] COMMAND [ARGS]…

Setup bench

Options:
–help Show this message and exit.

Commands:
auto-update
backups
config
dnsmasq
env
nginx
procfile
production
redis-async-broker
redis-cache
socketio
sudoers
supervisor

Your bench-repo seems old! Do git pull in the bench-repo directory

Will pulling the changes in bench-repo have any effect on apps frappe(v6) and erpnext(v6)?
Do I need to upgrade frappe and erpnext to v7 as well after pulling changes in bench-repo?

No no, bench-repo is backwards compatible.

After pulling the changes in bench-repo
bench setup redis gives following error
dell@hercules:~/frappe/frappe-bench-llc$ bench setup redis
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/dell/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/dell/frappe/bench-repo/bench/commands/setup.py”, line 41, in setup_redis
generate_config(‘.’)
File “/home/dell/frappe/bench-repo/bench/config/redis.py”, line 10, in generate_config
ports[key] = urlparse.urlparse(config[key]).port
KeyError: ‘redis_cache’

Try running bench setup config and then run that command again?

Now Even first bench not starting

dell@hercules:~/frappe/frappe-bench-llc$ bench setup config
dell@hercules:~/frappe/frappe-bench-llc$ bench setup redis
dell@hercules:~/frappe/frappe-bench-llc$ bench setup socketio
/home/dell/frappe/frappe-bench-llc
├── cookie@0.3.1
├── express@4.14.0
├── redis@2.6.2
├── socket.io@1.4.8
└── superagent@2.1.0

npm WARN enoent ENOENT: no such file or directory, open ‘/home/dell/frappe/frappe-bench-llc/package.json’
npm WARN frappe-bench-llc No description
npm WARN frappe-bench-llc No repository field.
npm WARN frappe-bench-llc No README data
npm WARN frappe-bench-llc No license field.

dell@hercules:~/frappe/frappe-bench-llc$ bench start

14:59:33 system | workerbeat.1 started (pid=32045)
14:59:33 system | worker.1 started (pid=32046)
14:59:33 system | redis_async_broker.1 started (pid=32053)
14:59:33 redis_async_broker.1 | 32054:M 09 Aug 14:59:33.557 * Increased maximum number of open files to 10032 (it was originally set to 1024).
14:59:33 redis_async_broker.1 | .
14:59:33 redis_async_broker.1 | .-__ ''-._ 14:59:33 redis_async_broker.1 | _.- . . ‘’-._ Redis 3.0.6 (00000000/0) 64 bit
14:59:33 redis_async_broker.1 | .- .-```. ```\/ _.,_ ''-._ 14:59:33 redis_async_broker.1 | ( ' , .-` | `, ) Running in standalone mode 14:59:33 redis_async_broker.1 | |`-._`-...-` __...-.-.|'_.-'| Port: 12311 14:59:33 redis_async_broker.1 | | -. ._ / _.-' | PID: 32054 14:59:33 redis_async_broker.1 | -._ -._ -./ .-’ .-’
14:59:33 redis_async_broker.1 | |-._-.
-.__.-' _.-'_.-'| 14:59:33 redis_async_broker.1 | | -.
-._ _.-'_.-' | http://redis.io 14:59:33 redis_async_broker.1 | -._ -._-..-'.-’ .-’
14:59:33 redis_async_broker.1 | |-._-.
-.__.-' _.-'_.-'| 14:59:33 redis_async_broker.1 | | -.
-._ _.-'_.-' | 14:59:33 redis_async_broker.1 | -._ -._-.
.-‘.-’ .-’
14:59:33 redis_async_broker.1 | -._ -..-’ _.-’
14:59:33 redis_async_broker.1 | -._ _.-' 14:59:33 redis_async_broker.1 | -.
.-’
14:59:33 redis_async_broker.1 |
14:59:33 redis_async_broker.1 | 32054:M 09 Aug 14:59:33.557 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
14:59:33 redis_async_broker.1 | 32054:M 09 Aug 14:59:33.557 # Server started, Redis version 3.0.6
14:59:33 redis_async_broker.1 | 32054:M 09 Aug 14:59:33.557 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
14:59:33 redis_async_broker.1 | 32054:M 09 Aug 14:59:33.557 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
14:59:33 redis_async_broker.1 | 32054:M 09 Aug 14:59:33.557 * The server is now ready to accept connections on port 12311
14:59:33 system | socketio.1 started (pid=32048)
14:59:33 system | web.1 started (pid=32063)
14:59:33 system | redis_cache.1 started (pid=32066)
14:59:33 redis_cache.1 | 32067:M 09 Aug 14:59:33.587 * Increased maximum number of open files to 10032 (it was originally set to 1024).
14:59:33 redis_cache.1 | .
14:59:33 redis_cache.1 | .-__ ''-._ 14:59:33 redis_cache.1 | _.- . . ‘’-.
Redis 3.0.6 (00000000/0) 64 bit
14:59:33 redis_cache.1 | .- .-```. ```\/ _.,_ ''-._ 14:59:33 redis_cache.1 | ( ' , .-` | `, ) Running in standalone mode 14:59:33 redis_cache.1 | |`-._`-...-` __...-.-.
|’_.-'| Port: 13000 14:59:33 redis_cache.1 | | -._ ._ / _.-' | PID: 32067 14:59:33 redis_cache.1 | -._ -._ -./ .-’ .-’
14:59:33 redis_cache.1 | |-._-.
-.__.-' _.-'_.-'| 14:59:33 redis_cache.1 | | -.
-._ _.-'_.-' | http://redis.io 14:59:33 redis_cache.1 | -._ -._-..-'.-’ .-’
14:59:33 redis_cache.1 | |-._-.
-.__.-' _.-'_.-'| 14:59:33 redis_cache.1 | | -.
-._ _.-'_.-' | 14:59:33 redis_cache.1 | -._ -._-.
.-‘_.-’ _.-’
14:59:33 redis_cache.1 | -._ -..-’ _.-’
14:59:33 redis_cache.1 | -._ _.-' 14:59:33 redis_cache.1 | -.
.-’
14:59:33 redis_cache.1 |
14:59:33 redis_cache.1 | 32067:M 09 Aug 14:59:33.587 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
14:59:33 redis_cache.1 | 32067:M 09 Aug 14:59:33.587 # Server started, Redis version 3.0.6
14:59:33 redis_cache.1 | 32067:M 09 Aug 14:59:33.587 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
14:59:33 redis_cache.1 | 32067:M 09 Aug 14:59:33.587 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
14:59:33 redis_cache.1 | 32067:M 09 Aug 14:59:33.587 * The server is now ready to accept connections on port 13000
14:59:34 socketio.1 | listening on *: 9000
14:59:34 socketio.1 | events.js:154
14:59:34 socketio.1 | throw er; // Unhandled ‘error’ event
14:59:34 socketio.1 | ^
14:59:34 socketio.1 |
14:59:34 socketio.1 | Error: Redis connection to localhost:12000 failed - connect ECONNREFUSED 127.0.0.1:12000
14:59:34 socketio.1 | at Object.exports._errnoException (util.js:893:11)
14:59:34 socketio.1 | at exports._exceptionWithHostPort (util.js:916:20)
14:59:34 socketio.1 | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1075:14)
14:59:34 system | socketio.1 stopped (rc=1)
14:59:34 system | sending SIGTERM to workerbeat.1 (pid 32045)
14:59:34 system | sending SIGTERM to worker.1 (pid 32046)
14:59:34 system | sending SIGTERM to web.1 (pid 32063)
14:59:34 system | sending SIGTERM to redis_async_broker.1 (pid 32053)
14:59:34 system | sending SIGTERM to redis_cache.1 (pid 32066)
14:59:34 redis_async_broker.1 | 32054:signal-handler (1470740374) Received SIGTERM scheduling shutdown…
14:59:34 redis_cache.1 | 32067:signal-handler (1470740374) Received SIGTERM scheduling shutdown…
14:59:34 system | workerbeat.1 stopped (rc=-15)
14:59:34 system | web.1 stopped (rc=-15)
14:59:34 system | worker.1 stopped (rc=-15)
14:59:34 redis_async_broker.1 | 32054:M 09 Aug 14:59:34.160 # User requested shutdown…
14:59:34 redis_async_broker.1 | 32054:M 09 Aug 14:59:34.160 # Redis is now ready to exit, bye bye…
14:59:34 system | redis_async_broker.1 stopped (rc=-15)
14:59:34 redis_cache.1 | 32067:M 09 Aug 14:59:34.189 # User requested shutdown…
14:59:34 redis_cache.1 | 32067:M 09 Aug 14:59:34.189 # Redis is now ready to exit, bye bye…
14:59:34 system | redis_cache.1 stopped (rc=-15)

@vjFaLk Thanks for your help. :slight_smile: :smiley: Now multi bench sites are up and running in development.After running all the setup commands it started working.

However in the production, I am facing issues while creating new site. While creating a new site 122.133.12.132 inside new bench (frappe-bench-gbt), site is being created inside old bench (frappe-bench)

[frappe@hcentos frappe-bench-gbt]$ bench new-site 122.133.12.132
MySQL root password:
Installing frappe…
Updating frappe : [========================================]
Updating country info : [========================================]
Set Administrator password:
Re-enter Administrator password:
Installing fixtures…
*** Scheduler is disabled ***
[frappe@hcentos frappe-bench-gbt]$ ls
apps config env logs node_modules Procfile sites
[frappe@hcentos frappe-bench-gbt]$ cd sites
[frappe@hcentos sites]$ ls
apps.txt assets common_site_config.json languages.txt
[frappe@hcentos ~]$ cd frappe-bench/sites && ls
122.133.12.132 apps.txt assets beat.schedule celerybeat.pid common_site_config.json currentsite.txt languages.txt site1.local
[frappe@hcentos frappe-bench]$ ls
apps config config-bak env logs node_modules patches.txt sites

Why is bench new-site 122.133.12.132 is referring to old bench ?

Any suggestions?

Errm, I don’t think you can set a IP as a name for a site :sweat_smile:

Even if i am running bench new-site test.erp.xyz.com
from frappe-bench-gbt directory it is creating test.erp.xyz.com site inside frappe-bench/sites instead of inside frappe-bench-gbt/sites .

Ah, then there might be a file called frappe_bench_dir inside /etc/, just delete that.

Thanks a lot. That helped. :smiley: :smiley: I can run multi bench in multiple port number.

Issue resolved.

Is anyone using this multi bench setup for production?

1 Like