Force database creation in install script?

Thanks so much for the help revant_one. I’ll look at that in a minute.

I edited config/redis_queue.conf to use port 11001 and bench start got farther this time:

$ bench start
09:29:01 system           | redis_queue.1 started (pid=7697)
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.959 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.959 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.959 # Current maximum open files is 1024. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
09:29:00 redis_queue.1    |                 _._
09:29:00 redis_queue.1    |            _.-``__ ''-._
09:29:00 redis_queue.1    |       _.-``    `.  `_.  ''-._           Redis 2.8.19 (00000000/0) 64 bit
09:29:00 redis_queue.1    |   .-`` .-```.  ```\/    _.,_ ''-._
09:29:00 redis_queue.1    |  (    '      ,       .-`  | `,    )     Running in stand alone mode
09:29:00 redis_queue.1    |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 11001
09:29:00 redis_queue.1    |  |    `-._   `._    /     _.-'    |     PID: 7697
09:29:00 redis_queue.1    |   `-._    `-._  `-./  _.-'    _.-'
09:29:00 redis_queue.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|
09:29:00 redis_queue.1    |  |    `-._`-._        _.-'_.-'    |           http://redis.io
09:29:00 redis_queue.1    |   `-._    `-._`-.__.-'_.-'    _.-'
09:29:00 redis_queue.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|
09:29:00 redis_queue.1    |  |    `-._`-._        _.-'_.-'    |
09:29:00 redis_queue.1    |   `-._    `-._`-.__.-'_.-'    _.-'
09:29:00 redis_queue.1    |       `-._    `-.__.-'    _.-'
09:29:00 redis_queue.1    |           `-._        _.-'
09:29:00 redis_queue.1    |               `-.__.-'
09:29:00 redis_queue.1    |
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.961 # Server started, Redis version 2.8.19
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.961 # 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.
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.961 # 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.
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.962 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
09:29:00 redis_queue.1    | [7697] 25 Jul 09:29:00.962 * The server is now ready to accept connections on port 11001
09:29:01 system           | watch.1 started (pid=7696)
09:29:01 system           | worker_long.1 started (pid=7695)
09:29:01 system           | web.1 started (pid=7694)
09:29:01 system           | redis_socketio.1 started (pid=7698)
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 # Current maximum open files is 1024. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
09:29:01 redis_socketio.1 |                 _._
09:29:01 redis_socketio.1 |            _.-``__ ''-._
09:29:01 redis_socketio.1 |       _.-``    `.  `_.  ''-._           Redis 2.8.19 (00000000/0) 64 bit
09:29:01 redis_socketio.1 |   .-`` .-```.  ```\/    _.,_ ''-._
09:29:01 redis_socketio.1 |  (    '      ,       .-`  | `,    )     Running in stand alone mode
09:29:01 redis_socketio.1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 12000
09:29:01 redis_socketio.1 |  |    `-._   `._    /     _.-'    |     PID: 7698
09:29:01 redis_socketio.1 |   `-._    `-._  `-./  _.-'    _.-'
09:29:01 redis_socketio.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
09:29:01 redis_socketio.1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io
09:29:01 redis_socketio.1 |   `-._    `-._`-.__.-'_.-'    _.-'
09:29:01 redis_socketio.1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
09:29:01 redis_socketio.1 |  |    `-._`-._        _.-'_.-'    |
09:29:01 redis_socketio.1 |   `-._    `-._`-.__.-'_.-'    _.-'
09:29:01 redis_socketio.1 |       `-._    `-.__.-'    _.-'
09:29:01 redis_socketio.1 |           `-._        _.-'
09:29:01 redis_socketio.1 |               `-.__.-'
09:29:01 redis_socketio.1 |
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 # Server started, Redis version 2.8.19
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 # 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.
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 # 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.
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
09:29:01 redis_socketio.1 | [7698] 25 Jul 09:29:00.981 * The server is now ready to accept connections on port 12000
09:29:01 system           | socketio.1 started (pid=7715)
09:29:01 system           | worker_short.1 started (pid=7713)
09:29:01 system           | redis_cache.1 started (pid=7716)
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.082 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.082 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.082 # Current maximum open files is 1024. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
09:29:01 redis_cache.1    |                 _._
09:29:01 redis_cache.1    |            _.-``__ ''-._
09:29:01 redis_cache.1    |       _.-``    `.  `_.  ''-._           Redis 2.8.19 (00000000/0) 64 bit
09:29:01 redis_cache.1    |   .-`` .-```.  ```\/    _.,_ ''-._
09:29:01 redis_cache.1    |  (    '      ,       .-`  | `,    )     Running in stand alone mode
09:29:01 redis_cache.1    |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 13000
09:29:01 redis_cache.1    |  |    `-._   `._    /     _.-'    |     PID: 7716
09:29:01 redis_cache.1    |   `-._    `-._  `-./  _.-'    _.-'
09:29:01 redis_cache.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|
09:29:01 redis_cache.1    |  |    `-._`-._        _.-'_.-'    |           http://redis.io
09:29:01 redis_cache.1    |   `-._    `-._`-.__.-'_.-'    _.-'
09:29:01 redis_cache.1    |  |`-._`-._    `-.__.-'    _.-'_.-'|
09:29:01 redis_cache.1    |  |    `-._`-._        _.-'_.-'    |
09:29:01 redis_cache.1    |   `-._    `-._`-.__.-'_.-'    _.-'
09:29:01 redis_cache.1    |       `-._    `-.__.-'    _.-'
09:29:01 redis_cache.1    |           `-._        _.-'
09:29:01 redis_cache.1    |               `-.__.-'
09:29:01 redis_cache.1    |
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.082 # Server started, Redis version 2.8.19
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.083 # 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.
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.083 # 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.
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.083 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
09:29:01 redis_cache.1    | [7716] 25 Jul 09:29:01.083 * The server is now ready to accept connections on port 13000
09:29:01 system           | worker_default.1 started (pid=7714)
09:29:01 system           | schedule.1 started (pid=7717)
09:29:05 socketio.1       | listening on *: 9000
09:29:13 watch.1          | compiling /home/frappe/frappe-bench/apps/frappe/frappe/public/less/avatar.less
09:29:13 web.1            |  * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
09:29:14 web.1            |  * Restarting with inotify reloader
09:29:14 watch.1          | compiling /home/frappe/frappe-bench/apps/frappe/frappe/public/less/calendar.less
09:29:15 watch.1          | compiling /home/frappe/frappe-bench/apps/frappe/frappe/public/less/common.less
09:29:15 worker_default.1 | Traceback (most recent call last):
09:29:15 worker_default.1 |   File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
09:29:15 worker_default.1 |     "__main__", fname, loader, pkg_name)
09:29:15 worker_default.1 |   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
09:29:15 worker_default.1 |     exec code in run_globals
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
09:29:15 worker_default.1 |     main()
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
09:29:15 worker_default.1 |     click.Group(commands=commands)(prog_name='bench')
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
09:29:15 worker_default.1 |     return self.main(*args, **kwargs)
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main
09:29:15 worker_default.1 |     rv = self.invoke(ctx)
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
09:29:15 worker_default.1 |     return _process_result(sub_ctx.command.invoke(sub_ctx))
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
09:29:15 worker_default.1 |     return _process_result(sub_ctx.command.invoke(sub_ctx))
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
09:29:15 worker_default.1 |     return ctx.invoke(self.callback, **ctx.params)
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
09:29:15 worker_default.1 |     return callback(*args, **kwargs)
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/scheduler.py", line 163, in start_worker
09:29:15 worker_default.1 |     start_worker(queue)
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 102, in start_worker
09:29:15 worker_default.1 |     Worker(queues, name=get_worker_name(queue)).work()
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 423, in work
09:29:15 worker_default.1 |     self.register_birth()
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 242, in register_birth
09:29:15 worker_default.1 |     if self.connection.exists(self.key) and \
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 855, in exists
09:29:15 worker_default.1 |     return self.execute_command('EXISTS', name)
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 579, in execute_command
09:29:15 worker_default.1 |     return self.parse_response(connection, command_name, **options)
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 585, in parse_response
09:29:15 worker_default.1 |     response = connection.read_response()
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 577, in read_response
09:29:15 worker_default.1 |     response = self._parser.read_response()
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 238, in read_response
09:29:15 worker_default.1 |     response = self._buffer.readline()
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 168, in readline
09:29:15 worker_default.1 |     self._read_from_socket()
09:29:15 worker_default.1 |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 143, in _read_from_socket
09:29:15 worker_default.1 |     (e.args,))
09:29:15 worker_default.1 | redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)
09:29:15 system           | worker_default.1 stopped (rc=1)
09:29:15 system           | sending SIGTERM to redis_socketio.1 (pid 7698)
09:29:15 system           | sending SIGTERM to worker_long.1 (pid 7695)
09:29:15 system           | sending SIGTERM to watch.1 (pid 7696)
09:29:15 system           | sending SIGTERM to redis_queue.1 (pid 7697)
09:29:15 system           | sending SIGTERM to web.1 (pid 7694)
09:29:15 system           | sending SIGTERM to schedule.1 (pid 7717)
09:29:15 system           | sending SIGTERM to socketio.1 (pid 7715)
09:29:15 system           | sending SIGTERM to redis_cache.1 (pid 7716)
09:29:15 system           | sending SIGTERM to worker_short.1 (pid 7713)
09:29:15 redis_socketio.1 | [7698 | signal handler] (1469453355) Received SIGTERM scheduling shutdown...
09:29:15 worker_long.1    | 09:29:15 Warm shut down requested
09:29:15 worker_long.1    | Traceback (most recent call last):
09:29:15 worker_long.1    |   File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
09:29:15 worker_long.1    |     "__main__", fname, loader, pkg_name)
09:29:15 worker_long.1    |   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
09:29:15 worker_long.1    |     exec code in run_globals
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
09:29:15 worker_long.1    |     main()
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
09:29:15 worker_long.1    |     click.Group(commands=commands)(prog_name='bench')
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
09:29:15 worker_long.1    |     return self.main(*args, **kwargs)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main
09:29:15 worker_long.1    |     rv = self.invoke(ctx)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
09:29:15 worker_long.1    |     return _process_result(sub_ctx.command.invoke(sub_ctx))
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
09:29:15 worker_long.1    |     return _process_result(sub_ctx.command.invoke(sub_ctx))
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
09:29:15 worker_long.1    |     return ctx.invoke(self.callback, **ctx.params)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
09:29:15 worker_long.1    |     return callback(*args, **kwargs)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/scheduler.py", line 163, in start_worker
09:29:15 worker_long.1    |     start_worker(queue)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 102, in start_worker
09:29:15 worker_long.1    |     Worker(queues, name=get_worker_name(queue)).work()
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 423, in work
09:29:15 worker_long.1    |     self.register_birth()
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 242, in register_birth
09:29:15 worker_long.1    |     if self.connection.exists(self.key) and \
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 855, in exists
09:29:15 worker_long.1    |     return self.execute_command('EXISTS', name)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 579, in execute_command
09:29:15 worker_long.1    |     return self.parse_response(connection, command_name, **options)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 585, in parse_response
09:29:15 worker_long.1    |     response = connection.read_response()
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 577, in read_response
09:29:15 worker_long.1    |     response = self._parser.read_response()
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 238, in read_response
09:29:15 worker_long.1    |     response = self._buffer.readline()
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 168, in readline
09:29:15 worker_long.1    |     self._read_from_socket()
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 126, in _read_from_socket
09:29:15 worker_long.1    |     data = self._sock.recv(socket_read_size)
09:29:15 worker_long.1    |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 385, in request_stop
09:29:15 worker_long.1    |     raise StopRequested()
09:29:15 worker_long.1    | rq.worker.StopRequested
09:29:15 system           | schedule.1 stopped (rc=-15)
09:29:15 redis_cache.1    | [7716 | signal handler] (1469453355) Received SIGTERM scheduling shutdown...
09:29:15 redis_cache.1    | [7716] 25 Jul 09:29:15.682 # User requested shutdown...
09:29:15 redis_cache.1    | [7716] 25 Jul 09:29:15.682 # Redis is now ready to exit, bye bye...
09:29:15 worker_short.1   | 09:29:15 Warm shut down requested
09:29:15 worker_short.1   | Traceback (most recent call last):
09:29:15 worker_short.1   |   File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
09:29:15 worker_short.1   |     "__main__", fname, loader, pkg_name)
09:29:15 worker_short.1   |   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
09:29:15 worker_short.1   |     exec code in run_globals
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
09:29:15 worker_short.1   |     main()
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
09:29:15 worker_short.1   |     click.Group(commands=commands)(prog_name='bench')
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
09:29:15 worker_short.1   |     return self.main(*args, **kwargs)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main
09:29:15 worker_short.1   |     rv = self.invoke(ctx)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
09:29:15 worker_short.1   |     return _process_result(sub_ctx.command.invoke(sub_ctx))
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
09:29:15 worker_short.1   |     return _process_result(sub_ctx.command.invoke(sub_ctx))
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
09:29:15 worker_short.1   |     return ctx.invoke(self.callback, **ctx.params)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
09:29:15 worker_short.1   |     return callback(*args, **kwargs)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/scheduler.py", line 163, in start_worker
09:29:15 worker_short.1   |     start_worker(queue)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 102, in start_worker
09:29:15 worker_short.1   |     Worker(queues, name=get_worker_name(queue)).work()
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 423, in work
09:29:15 worker_short.1   |     self.register_birth()
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 242, in register_birth
09:29:15 worker_short.1   |     if self.connection.exists(self.key) and \
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 855, in exists
09:29:15 worker_short.1   |     return self.execute_command('EXISTS', name)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 579, in execute_command
09:29:15 worker_short.1   |     return self.parse_response(connection, command_name, **options)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/client.py", line 585, in parse_response
09:29:15 worker_short.1   |     response = connection.read_response()
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 577, in read_response
09:29:15 worker_short.1   |     response = self._parser.read_response()
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 238, in read_response
09:29:15 worker_short.1   |     response = self._buffer.readline()
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 168, in readline
09:29:15 worker_short.1   |     self._read_from_socket()
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/redis/connection.py", line 126, in _read_from_socket
09:29:15 worker_short.1   |     data = self._sock.recv(socket_read_size)
09:29:15 worker_short.1   |   File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/rq/worker.py", line 385, in request_stop
09:29:15 worker_short.1   |     raise StopRequested()
09:29:15 worker_short.1   | rq.worker.StopRequested
09:29:15 system           | socketio.1 stopped (rc=143)
09:29:15 redis_queue.1    | [7697 | signal handler] (1469453355) Received SIGTERM scheduling shutdown...
09:29:15 system           | redis_cache.1 stopped (rc=0)
09:29:15 redis_socketio.1 | [7698] 25 Jul 09:29:15.701 # User requested shutdown...
09:29:15 redis_socketio.1 | [7698] 25 Jul 09:29:15.701 # Redis is now ready to exit, bye bye...
09:29:15 system           | redis_socketio.1 stopped (rc=0)
09:29:15 redis_queue.1    | [7697] 25 Jul 09:29:15.756 # User requested shutdown...
09:29:15 redis_queue.1    | [7697] 25 Jul 09:29:15.756 # Redis is now ready to exit, bye bye...
09:29:15 system           | redis_queue.1 stopped (rc=0)
09:29:15 system           | watch.1 stopped (rc=-15)
09:29:15 system           | worker_short.1 stopped (rc=1)
09:29:15 system           | web.1 stopped (rc=0)
09:29:15 system           | worker_long.1 stopped (rc=1)

I’ll try disabling any existing redis server instances, regenerate the configs and try again.

Nope, that’s not it. As I discovered above, a webmin process is listening on port 11000.

$ sudo service redis-server status Redirecting to /bin/systemctl status redis-server.service ● redis-server.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead)

$ sudo netstat -anp | grep 11000 tcp 0 0 127.0.0.1:11000 0.0.0.0:* LISTEN 3796/lookup-domain- tcp 1 0 127.0.0.1:11000 127.0.0.1:38374 CLOSE_WAIT 3796/lookup-domain-

Which is a webmin process: /usr/libexec/webmin/virtual-server/lookup-domain-daemon.pl

And as posted above:

So now to look at that output and figure out why bench is choking. Maybe it got far enough to create an error log this time.

edit: nope, no error log. just what I got on stdout.

Is there a way to not use redis? MySQL does have its own query cache…

I guess I will try building the latest redis from source.

Not using redis. Not recommended.
try
bench serve

Thanks for the suggestion. Good to know. (I’ve also been reviewing the available commands via bench --help) It occurred to me that changing the port of the redis queue would require telling bench about that change, so…

in addition to editing config/redis_queue.conf to set:

port 11001

I edited sites/common_site_config.json to set:

"redis_queue": "redis://localhost:11001",

And voila! It started! With only one (non critical) error:

10:20:19 watch.1 | ParseError: Unrecognised input in /home/frappe/frappe-bench/apps/erpnext/erpnext/public/less/erpnext.less on line 135, column 14: 10:20:19 watch.1 | 134 .erpnext-icon { 10:20:19 watch.1 | 135 width: 24px;ack 10:20:19 watch.1 | 136 margin-right: 0px; 10:20:19 watch.1 |

Thanks again for your input revant_one, it encouraged me to persist to identify these issues.

So my recommendation is that Frappe/Bench/ERPNext should check for a Webmin/Virtualmin installation and if found, configure the redis queue to use a port other than 11000.

So now to figure out how to stop it, run it detached from the console for further testing, then setup for production with apache instead of nginx.

Progress! :slight_smile:

1 Like

I have it working in production behind Apache. For the sake of completeness of this record…

Summary:

  • removed the initial bench site
  • created a new one with a site name corresponding to the domain of the virtual host I intended to use
  • stopped apache
  • enabled and started nginx
  • ran sudo bench setup production frappe
  • stopped and disabled nginx
  • added configuration to apache vhost (see below)
  • added vhost user to frappe group
  • started apache

Added configuration to apache vhost (using LetsEncrypt SSL):

Alias "/assets" "/home/frappe/frappe-bench/sites/assets"
<Directory /home/frappe/frappe-bench/sites/assets>
    Options FollowSymLinks
    Require all granted
</Directory>
ProxyPreserveHost On
ProxyPass "/.well-known/" "!"
ProxyPass "/mail/" "!"
ProxyPass "/cgi-bin/" "!"
ProxyPass "/assets/" "!"
ProxyPass "/socket.io"  "http://127.0.0.1:9000/"
ProxyPass "/"  "http://127.0.0.1:8000/"
ProxyPassReverse "/socket.io"  "http://127.0.0.1:9000/"
ProxyPassReverse "/"  "http://127.0.0.1:8000/"

VM Operating system: CentOS Linux 7.2.1511
Webmin version: 1.801
Virtualmin version: 5.03
Apache version: 2.4.6

Though I have not actually logged in on it yet… :slight_smile:

3 Likes

@reidtech please create a page on Home · frappe/erpnext Wiki · GitHub

I have yet to add the protected and error directives from the nginx config to my apache config.

If I get a chance I will look at making a wiki page on this subject (ERPNext with Apache and Virtualmin/Webmin on a CentOS 7 VM). No promises though.

Is this forum pruned? Will this thread persist as long as this forum exists?

Just in case:
http://archive.is/tlxbu

But it appears archive.org is blocked:
http://web.archive.org/web/20160726153310/https://discuss.frappe.io/t/force-database-creation-in-install-script/14361

Actually it appears I do not actually have ERPNext installed, just Frappe/Bench?

I have no Setup > Settings > Show or Hide Modules…
https://frappe.github.io/erpnext/user/manual/en/setting-up/settings/module-settings.html

But frappe-bench/sites/apps.txt shows:
frappe erpnext

I must be missing something simple?

You need to install it to your site

bench --site sitename install-app erpnext

Thanks rmheta!

Thought for sure I had that step taken care of. When I run that command now I get:

Installing erpnext...
ERPNext can only be installed on a fresh site where the setup wizard is not completed
You can reinstall this site (after saving your data) using: bench --site [sitename] reinstall

So I guess I have to remove the site, recreate it and run this command?

Yup, a:

bench drop-site sitename
bench new-site sitename
bench --site sitename install-app erpnext
bench use sitename

And I’m in business. Thanks again for the help guys! :slight_smile:

Hmmm… now I have a giant “E” icon that obscures many of the icons on the desktop. I seem to recall a less/css error during my setup process, perhaps this is it?

edit:
Yup, that would be it. As noted above:

10:20:19 watch.1 | ParseError: Unrecognised input in /home/frappe/frappe-bench/apps/erpnext/erpnext/public/less/erpnext.less on line 135, column 14: 10:20:19 watch.1 | 134 .erpnext-icon { 10:20:19 watch.1 | 135 width: 24px;ack 10:20:19 watch.1 | 136 margin-right: 0px; 10:20:19 watch.1 |

frappe-bench/sites/assets/erpnext/css/erpnext.css is zero bytes.

I guess I’ll have to figure out how to translate that less file into a css file myself.

bench [--site sitename] reinstall
bench [--site sitename] install-app erpnext

can you try building it again? bench update should build it.
Or
bench build

Thanks revant_one! I just manually built the file, as there was only a single variable used in it anyway.

New problem… what does this mean?

Error: ENOENT, stat '/home/frappe/frappe-bench/index.html'

This is what I get when I look at http://127.0.0.1:9000 (the socket.io server).

As seen in the browser while at /desk:

GET https://*sitename*/socket.io/?EIO=3&transport=polling&t=1469815147633-31 404 (Not Found)

I suspect my apache proxy directives are inadequate for socketio as-is, looks like I will need to add the headers as specified in the nginx config…

I have been over my apache configuration six ways to Sunday, and I know I am hitting everything that Frappe/Bench/ERPNext expects.

Current config (still testing, USER=frappe user, SITENAME=domain):

ProxyPreserveHost Off
ProxyAddHeaders Off
ProxyTimeout 120
ProxyPass "/.well-known/" "!"
ProxyPass "/AutoDiscover/" "!"
ProxyPass "/mail/" "!"
ProxyPass "/cgi-bin/" "!"
ProxyPass "/assets/" "!"
ProxyPass "/files/" "!"
ProxyPass "/socket.io"  "http://127.0.0.1:9000"
<Location "/socket.io">
RequestHeader set Upgrade "HTTP/1.1"
RequestHeader set Connection "Upgrade"
RequestHeader set X-Frappe-Site-Name "SITENAME"
RequestHeader set Origin "https://SITENAME"
RequestHeader set Host "SITENAME"
#ProxyPass "http://127.0.0.1:9000"
</Location>
Alias "/assets" "/home/USER/frappe-bench/sites/assets"
<Directory /home/USER/frappe-bench/sites/assets>
Options FollowSymLinks
Require all granted
</Directory>
Alias "/files" "/home/USER/frappe-bench/sites/SITENAME/public/files"
<Directory /home/USER/frappe-bench/sites/SITENAME/public/files>
Options FollowSymLinks
Require all granted
</Directory>
ProxyPass "/"  "http://127.0.0.1:8000/"
<Location "/">
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Frappe-Site-Name "SITENAME"
RequestHeader set Host "SITENAME"
#ProxyPass "http://127.0.0.1:8000/"
</Location>
#ProxyPassReverse "/socket.io/"  "http://127.0.0.1:9000/"
#ProxyPassReverse "/"  "http://127.0.0.1:8000/"

So I thought I’d take a look at the code. And I find this in /home/USER/frappe-bench/apps/frappe/socketio.js early in the file as the first function called after http.listen:

// test route
app.get('/', function(req, res){
  res.sendfile('index.html');
});

Well now that matches the error I am getting, this file is not present in /home/USER/frappe-bench/apps/frappe/. Now obviously I am not the one who designed this, but that just seems wrong to me. I would assume that these ajax calls to /socket.io are intended to return data presumably in json format, not simply send an index.html file (which happens to not exist).

Has anyone else checked the javascript console of a browser connected to a copy of the latest versions of Frappe/Bench/ERPNext? Do you see similar 404 errors?

edit: well I thought why not just give it what it wants? so I created a simple /home/frappe/frappe-bench/index.html file:

<html>
<head></head>
<body>
<p>frappe-bench</p>
</body>
</html>

And the error is gone. But I am left wondering, is socketio.js really doing the job it was intended to do, or is it just sending an html file instead of actual polling data?

edit2: well I had a look, and sure enough, socketio.js is doing exactly that, just sending a simple html file, no actual data. and now that it is not hitting an error about the missing html file and retrying on an interval, the browser is calling for that “polling” data every few milliseconds and queueing up the requests, quickly saturating cpu usage on the client.

So after all this effort to get socketio/redis running, it is not actually doing anything! Wow.

It is starting to look to me like ERPNext is nowhere near ready for primetime.

edit 3: I’ll give it one more chance, and try commenting out the call to send index.html in socketio.js and see what I get.

edit 4: nope - no joy, commenting out that code bomb and restarting supervisord, the error that /socket.io spits out now is like Cannot GET /?EIO=3&transport=polling&t=1470083271385-2. So it really is not doing anything useful at all.

1 Like

Interesting findings, maybe we should have another thread for this?

FYI, This is my currently working Apache configuration (Apache 2.4 with Let’s encrpyt SSL).

Socket.io was the main problem, finally I found a way to make it work (transport=polling requests to /socket.io must be http, all other requests to /socket.io must be websocket).

<VirtualHost *:443>
        ServerAdmin erpnext@example.com
        ServerName erpnext.example.com

        DocumentRoot /home/frappe/frappe-bench/sites/erpnext.example.com/

        ProxyPreserveHost On
        ProxyRequests Off
        ProxyTimeout 120
        ProxyPass "/.well-known/" "!"
        ProxyPass "/AutoDiscover/" "!"
        ProxyPass "/mail/" "!"
        ProxyPass "/cgi-bin/" "!"
        ProxyPass "/assets/" "!"
        ProxyPass "/files/" "!"
        
        RewriteEngine On
        RewriteCond %{REQUEST_URI}  ^/socket.io               [NC]
        RewriteCond %{QUERY_STRING} transport=polling         [NC]
        RewriteRule /(.*) http://localhost:9000/socket.io/$1  [P,L]
        RequestHeader set Host "erpnext.example.com"
        RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
        ProxyPass "/socket.io" "ws://localhost:9000/socket.io/"
        ProxyPassReverse "/socket.io" "ws://localhost:9000/socket.io/"
        <Location "/socket.io">
            RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
        </Location>

        Alias "/assets" "/home/frappe/frappe-bench/sites/assets"
        <Directory /home/frappe/frappe-bench/sites/assets>
            Options FollowSymLinks
            Require all granted
        </Directory>
        Alias "/files" "/home/frappe/frappe-bench/sites/erpnext.example.com/public/files"
        <Directory /home/frappe/frappe-bench/sites/erpnext.example.com/public/files>
            Options FollowSymLinks
            Require all granted
        </Directory>
        ProxyPass "/"  "http://localhost:8000/"
        ProxyPassReverse "/"  "http://localhost:8000/"
        <Location "/">
            RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
        </Location>

        SSLCertificateFile /etc/letsencrypt/live/erpnext.example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/erpnext.example.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>