Installing ERPNext on Ubuntu 20.0.4. SIGTERM being sent to Redis - node.js

I am following this tutorial, to install ERPNext on my Ubuntu 20.0.4 LTS OS.
I managed to follow all the instructions, however, when I run bench start, the system fails to start.
Here is the console output:
WARN: bench is installed in editable mode!
This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
10:26:19 system | redis_cache.1 started (pid=11096)
10:26:19 system | redis_queue.1 started (pid=11097)
10:26:19 system | redis_socketio.1 started (pid=11095)
10:26:19 redis_socketio.1 | 11105:C 24 May 2022 10:26:19.200 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
10:26:19 system | socketio.1 started (pid=11100)
10:26:19 redis_queue.1 | 11106:C 24 May 2022 10:26:19.205 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
10:26:19 system | web.1 started (pid=11098)
10:26:19 redis_queue.1 | 11106:C 24 May 2022 10:26:19.208 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=11106, just started
10:26:19 redis_queue.1 | 11106:C 24 May 2022 10:26:19.208 # Configuration loaded
10:26:19 redis_queue.1 | 11106:M 24 May 2022 10:26:19.209 * Increased maximum number of open files to 10032 (it was originally set to 1024).
10:26:19 redis_queue.1 | 11106:M 24 May 2022 10:26:19.217 * Running mode=standalone, port=11000.
10:26:19 redis_cache.1 | 11103:C 24 May 2022 10:26:19.223 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
10:26:19 redis_cache.1 | 11103:C 24 May 2022 10:26:19.224 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=11103, just started
10:26:19 redis_cache.1 | 11103:C 24 May 2022 10:26:19.224 # Configuration loaded
10:26:19 redis_cache.1 | 11103:M 24 May 2022 10:26:19.225 * Increased maximum number of open files to 10032 (it was originally set to 1024).
10:26:19 system | watch.1 started (pid=11099)
10:26:19 redis_socketio.1 | 11105:C 24 May 2022 10:26:19.229 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=11105, just started
10:26:19 redis_socketio.1 | 11105:C 24 May 2022 10:26:19.229 # Configuration loaded
10:26:19 redis_socketio.1 | 11105:M 24 May 2022 10:26:19.230 * Increased maximum number of open files to 10032 (it was originally set to 1024).
10:26:19 redis_socketio.1 | 11105:M 24 May 2022 10:26:19.231 * Running mode=standalone, port=12000.
10:26:19 system | worker_short.1 started (pid=11113)
10:26:19 system | schedule.1 started (pid=11115)
10:26:19 redis_cache.1 | 11103:M 24 May 2022 10:26:19.243 * Running mode=standalone, port=13000.
10:26:19 redis_cache.1 | 11103:M 24 May 2022 10:26:19.244 # Server initialized
10:26:19 redis_cache.1 | 11103:M 24 May 2022 10:26:19.244 # 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.
10:26:19 redis_cache.1 | 11103:M 24 May 2022 10:26:19.244 # 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.
10:26:19 redis_cache.1 | 11103:M 24 May 2022 10:26:19.244 * Ready to accept connections
10:26:19 redis_queue.1 | 11106:M 24 May 2022 10:26:19.247 # Server initialized
10:26:19 redis_queue.1 | 11106:M 24 May 2022 10:26:19.248 # 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.
10:26:19 redis_queue.1 | 11106:M 24 May 2022 10:26:19.248 # 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.
10:26:19 redis_queue.1 | 11106:M 24 May 2022 10:26:19.248 * Ready to accept connections
10:26:19 redis_socketio.1 | 11105:M 24 May 2022 10:26:19.248 # Server initialized
10:26:19 redis_socketio.1 | 11105:M 24 May 2022 10:26:19.248 # 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.
10:26:19 redis_socketio.1 | 11105:M 24 May 2022 10:26:19.249 # 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.
10:26:19 redis_socketio.1 | 11105:M 24 May 2022 10:26:19.249 * Ready to accept connections
10:26:19 system | worker_long.1 started (pid=11118)
10:26:19 system | worker_default.1 started (pid=11124)
10:26:21 socketio.1 | listening on *: 9000
10:26:23 schedule.1 | WARN: bench is installed in editable mode!
10:26:23 schedule.1 |
10:26:23 schedule.1 | This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
10:26:23 schedule.1 |
10:26:23 web.1 | WARN: bench is installed in editable mode!
10:26:23 web.1 |
10:26:23 web.1 | This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
10:26:23 web.1 |
10:26:23 watch.1 | WARN: bench is installed in editable mode!
10:26:23 watch.1 |
10:26:23 watch.1 | This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`
10:26:23 watch.1 |
10:26:26 watch.1 |
10:26:26 web.1 | * Running on all addresses.
10:26:26 web.1 | WARNING: This is a development server. Do not use it in a production deployment.
10:26:26 web.1 | * Running on http://[PUBLIC_IP_ADDRESS]:8000/ (Press CTRL+C to quit)
10:26:26 web.1 | * Restarting with stat
10:26:27 web.1 | * Debugger is active!
10:26:27 web.1 | * Debugger PIN: 214-927-934
10:26:28 watch.1 | yarn run v1.22.18
10:26:28 watch.1 | $ node esbuild --watch --live-reload
10:26:30 watch.1 | clean: postcss.plugin was deprecated. Migration guide:
10:26:30 watch.1 | https://evilmartians.com/chronicles/postcss-8-plugin-migration
10:26:35 system | worker_short.1 stopped (rc=1)
10:26:35 system | sending SIGTERM to redis_cache.1 (pid 11096)
10:26:35 system | sending SIGTERM to redis_socketio.1 (pid 11095)
10:26:35 system | sending SIGTERM to redis_queue.1 (pid 11097)
10:26:35 system | sending SIGTERM to web.1 (pid 11098)
10:26:35 system | sending SIGTERM to socketio.1 (pid 11100)
10:26:35 system | sending SIGTERM to watch.1 (pid 11099)
10:26:35 system | sending SIGTERM to schedule.1 (pid 11115)
10:26:35 system | sending SIGTERM to worker_long.1 (pid 11118)
10:26:35 system | sending SIGTERM to worker_default.1 (pid 11124)
10:26:35 redis_cache.1 | 11103:signal-handler (1653387995) Received SIGTERM scheduling shutdown...
10:26:35 redis_cache.1 | 11103:M 24 May 2022 10:26:35.885 # User requested shutdown...
10:26:35 redis_cache.1 | 11103:M 24 May 2022 10:26:35.885 * Removing the pid file.
10:26:35 redis_cache.1 | 11103:M 24 May 2022 10:26:35.885 # Redis is now ready to exit, bye bye...
10:26:35 system | redis_queue.1 stopped (rc=-15)
10:26:35 system | worker_default.1 stopped (rc=-15)
10:26:35 system | redis_socketio.1 stopped (rc=-15)
10:26:35 system | redis_cache.1 stopped (rc=-15)
10:26:35 system | socketio.1 stopped (rc=-15)
10:26:35 system | schedule.1 stopped (rc=-15)
10:26:36 system | web.1 stopped (rc=-15)
10:26:36 system | watch.1 stopped (rc=-15)
What is causing this issue, and how do I fix it?

It seems that they are errors in the latest versions of the bench installer, it has happened to me in some VPS.
The first is a problem with the Transparent Huge Pages (THP), you have to disable them, I suggest you create a service that checks that they are disabled during boot and keep them that way, or try this option:
https://www.ibm.com/docs/en/db2-big-sql/5.0.4?topic=sql-disabling-transparent-hugepages
You also have a problem with the number of files to watch, you can solve it with this:
sudo vim /etc/sysctl.conf
fs.inotify.max_user_watches=524288
vm.overcommit_memory = 1
Check:
sudo sysctl -p
It should appear something like this:
fs.file-max = 65535
vm.swappiness = 10
fs.inotify.max_user_watches = 524288
Remember to restart.

Related

alpine image error: /bin/sh: can't access tty; job control turned off

I have redis pod with cpec:
spec:
containers:
- name: master
image: xyzwy/redis:7.0
command: ["sh", "-ic"]
args:
- redis-server
- /bin/sh
when I deploy it i get an error in a first line:
***/bin/sh: can't access tty; job control turned off***
1:C 09 May 2022 13:31:44.287 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 09 May 2022 13:31:44.287 # Redis version=7.0.0, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 09 May 2022 13:31:44.287 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 09 May 2022 13:31:44.288 * monotonic clock: POSIX clock_gettime
1:M 09 May 2022 13:31:44.289 * Running mode=standalone, port=6379.
1:M 09 May 2022 13:31:44.289 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 09 May 2022 13:31:44.290 # Server initialized
1:M 09 May 2022 13:31:44.291 * The AOF directory appendonlydir doesn't exist
1:M 09 May 2022 13:31:44.291 * Ready to accept connections
how can I solve this?
Problem was in
command: ["sh", "-ic"]
-i can not be there, it is not interactive

Redis-server command works inside container but not when docker-compose starts

I have been working on a project to dockerize and automate redis deployments when i stumbled upon a very weird issue with my build. This is my current Dockerfile
ARG BUILD_VERSION=5
FROM redis:${BUILD_VERSION}
RUN mkdir /var/log/redis
RUN chown -R redis:redis /data /var/log/redis
EXPOSE 6379
WORKDIR /usr/local/etc/redis
CMD ["/usr/local/bin/redis-server", "/etc/redis.conf"]
This is my compose:
version: '2.2'
services:
redis:
image: test:red5
restart: unless-stopped
ports:
- "6379:6379"
user: $UID:$GID
volumes:
- /var/lib/redis/:/var/lib/redis/
- /var/log/redis/:/var/log/redis/
- /etc/redis.conf:/etc/redis.conf
to be clear i am mounting the redis dirs and configs as volumes because that is whats on the server.. the UID and GID variable gets called in my .env file.
When i docker exec inside the container and run "/usr/local/bin/redis-server", "/etc/redis.conf" the redis server intializes with no problem. but when i run doocker-compose up i get this exit code.
docker-compose up
Creating network "redis_default" with the default driver
Creating redis_redis_1 ... done
Attaching to redis_redis_1
redis_redis_1 exited with code 0
First question ever on stack overflow :).. Assistance is appreciated
logs(bind address issue was already resolved):
I have no name!#b306768fd72f:/usr/local/src$ tail -f /var/log/redis/redis.log
37:C 19 Jan 2022 18:41:09.928 # Configuration loaded
38:M 19 Jan 2022 18:41:09.931 # Could not create server TCP listening socket *:6379: bind: Address already in use
41:C 19 Jan 2022 18:41:40.389 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
41:C 19 Jan 2022 18:41:40.389 # Redis version=5.0.14, bits=64, commit=00000000, modified=0, pid=41, just started
41:C 19 Jan 2022 18:41:40.389 # Configuration loaded
42:M 19 Jan 2022 18:41:40.393 * Running mode=standalone, port=6379.
42:M 19 Jan 2022 18:41:40.393 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
42:M 19 Jan 2022 18:41:40.393 # Server initialized
42:M 19 Jan 2022 18:41:40.394 * DB loaded from disk: 0.001 seconds
42:M 19 Jan 2022 18:41:40.394 * Ready to accept connections
Found the issue in /etc/redis.conf..
daemonize yes
this was blocking docker from running redis-server properly since it was trying to create a pidfile.. container is now running

While executing Docker command "docker-compose up" getting error - - "node-app-1 | /bin/sh: [npm,: not found"

My docker file
FROM node:alpine
WORKDIR /usr/src/app/
COPY package.json .
RUN npm install
COPY . /usr/src/app/
CMD ["npm" ,"start"]
My docker.yml file
version: '3'
services:
redis-server:
image: 'redis'
node-app:
build: .
ports:
- '8080:8080'
docker-compose output
$ docker-compose up
Container visits-node-app-1 Created
Container visits-redis-server-1 Created
Attaching to visits-node-app-1, visits-redis-server-1
visits-redis-server-1 | 1:C 19 Oct 2021 13:10:09.712 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
visits-redis-server-1 | 1:C 19 Oct 2021 13:10:09.712 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started
visits-redis-server-1 | 1:C 19 Oct 2021 13:10:09.712 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.713 * monotonic clock: POSIX clock_gettime
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.715 * Running mode=standalone, port=6379.
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.715 # Server initialized
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.715 # 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.
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.717 * Loading RDB produced by version 6.2.6
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.717 * RDB age 272 seconds
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.717 * RDB memory usage when created 0.77 Mb
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.717 # Done loading RDB, keys loaded: 0, keys expired: 0.
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.717 * DB loaded from disk: 0.000 seconds
visits-redis-server-1 | 1:M 19 Oct 2021 13:10:09.717 * Ready to accept connections
visits-node-app-1 | /bin/sh: [npm,: not found
visits-node-app-1 exited with code 127

PostgreSQL not working on docker when volume is initialized

I am using windows docker
my docker-compose file is as shown below:
version: '3.5'
services:
postgres:
container_name: postgres_container
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-root}
PGDATA: /data/postgres
volumes:
- ./postgres-data:/var/
ports:
- "5432:5432"
restart: unless-stopped
When i build it i get following error log and container exits
Attaching to postgres_container
postgres_container | The files belonging to this database system will be owned by user "postgres".
postgres_container | This user must also own the server process.
postgres_container |
postgres_container | The database cluster will be initialized with locale "en_US.utf8".
postgres_container | The default database encoding has accordingly been set to "UTF8".
postgres_container | The default text search configuration will be set to "english".
postgres_container |
postgres_container | Data page checksums are disabled.
postgres_container |
postgres_container | fixing permissions on existing directory /data/postgres ... ok
postgres_container | creating subdirectories ... ok
postgres_container | selecting dynamic shared memory implementation ... posix
postgres_container | selecting default max_connections ... 100
postgres_container | selecting default shared_buffers ... 128MB
postgres_container | selecting default time zone ... Etc/UTC
postgres_container | creating configuration files ... ok
postgres_container | running bootstrap script ... ok
postgres_container | performing post-bootstrap initialization ... ok
postgres_container | syncing data to disk ... ok
postgres_container |
postgres_container |
postgres_container | Success. You can now start the database server using:
postgres_container |
postgres_container | pg_ctl -D /data/postgres -l logfile start
postgres_container |
postgres_container | initdb: warning: enabling "trust" authentication for local connections
postgres_container | You can change this by editing pg_hba.conf or using the option -A, or
postgres_container | --auth-local and --auth-host, the next time you run initdb.
postgres_container | waiting for server to start....2020-04-17 13:18:31.599 UTC [47] LOG: starting PostgreSQL 12.2 (Debian 12.2-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
postgres_container | 2020-04-17 13:18:31.607 UTC [47] LOG: could not bind Unix address "/var/run/postgresql/.s.PGSQL.5432": Input/output error
postgres_container | 2020-04-17 13:18:31.607 UTC [47] HINT: Is another postmaster already running on port 5432? If not, remove socket file "/var/run/postgresql/.s.PGSQL.5432" and retry.
postgres_container | 2020-04-17 13:18:31.607 UTC [47] WARNING: could not create Unix-domain socket in directory "/var/run/postgresql"
postgres_container | 2020-04-17 13:18:31.607 UTC [47] FATAL: could not create any Unix-domain sockets
postgres_container | 2020-04-17 13:18:31.610 UTC [47] LOG: database system is shut down
postgres_container | stopped waiting
postgres_container | pg_ctl: could not start server
postgres_container | Examine the log output.
postgres_container |
postgres_container | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_container |
postgres_container | 2020-04-17 13:18:32.246 UTC [1] LOG: starting PostgreSQL 12.2 (Debian 12.2-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
postgres_container | 2020-04-17 13:18:32.246 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres_container | 2020-04-17 13:18:32.246 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres_container | 2020-04-17 13:18:32.255 UTC [1] LOG: could not bind Unix address "/var/run/postgresql/.s.PGSQL.5432": Input/output error
postgres_container | 2020-04-17 13:18:32.255 UTC [1] HINT: Is another postmaster already running on port 5432? If not, remove socket file "/var/run/postgresql/.s.PGSQL.5432" and retry.
postgres_container | 2020-04-17 13:18:32.255 UTC [1] WARNING: could not create Unix-domain socket in directory "/var/run/postgresql"
postgres_container | 2020-04-17 13:18:32.255 UTC [1] FATAL: could not create any Unix-domain sockets
postgres_container | 2020-04-17 13:18:32.259 UTC [1] LOG: database system is shut down
postgres_container exited with code 1
I checked 5432 port its open and no process is using it.
when i remove volume from my docker-compose.yml file it works
perfectly
the volume i am using ./postgres-data is the local directory on my system i want to map it to the PostgreSQL container to restore database.
You are using docker on Windows and mounting the directory where the socket will be created (/var) as volume but windows filesystem doesn't support unix sockets.
Change the configuration in order to:
leave the unix socket (/var/run/postgresql/...) inside the docker without mounting as volume
mount data directory as volume

Node red on-close event does not wait for async function to finish

According to the documentation
https://nodered.org/docs/creating-nodes/node-js
when Node-red (or the specific node in question) closes down,the "close" event is called and if a listener is registered with a parameter it should wait for done() before completely stopping.
this.on('close', function(done) {
doSomethingWithACallback(function() {
done();
});
});
It doesn't work for me though. My mistake, I'm sure, but I don't see where. The following code displays the first "Closing" entry in the log, but not the second entry "Waited enough. Actually finishing now.":
node.on("close", function(done) {
node.log('Closing.');
setTimeout(function(){
node.log('Waited enough.Actually finishing now.');
done();
},5000);
});
Can someone please give me a pointer ?
Using:
Node-red 0.17.5
node.js 6.14.1
Edit: output log added below
pi#raspberrypi:~ $ node-red-start
Start Node-RED
Once Node-RED has started, point a browser at http://192.168.1.17:1880
On Pi Node-RED works better with the Firefox or Chrome browser
Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot
To find more nodes and example flows - go to http://flows.nodered.org
Starting as a systemd service.
Started Node-RED graphical event wiring tool..
16 Apr 10:11:27 - [info]
Welcome to Node-RED
===================
16 Apr 10:11:27 - [info] Node-RED version: v0.17.5
16 Apr 10:11:27 - [info] Node.js version: v6.14.1
16 Apr 10:11:27 - [info] Linux 4.14.30-v7+ arm LE
16 Apr 10:11:30 - [info] Loading palette nodes
16 Apr 10:11:47 - [info] Dashboard version 2.7.0 started at /ui
16 Apr 10:11:50 - [info] Settings file : /home/pi/.node-red/settings.js
16 Apr 10:11:50 - [info] User directory : /home/pi/.node-red
16 Apr 10:11:50 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
16 Apr 10:11:50 - [info] Server now running at http://127.0.0.1:1880/
16 Apr 10:11:51 - [info] Starting flows
16 Apr 10:11:51 - [info] Started flows
Stopping Node-RED graphical event wiring tool....
16 Apr 10:12:06 - [info] Stopping flows
16 Apr 10:12:06 - [info] [simple-queue:queue1] Closing.
Stopped Node-RED graphical event wiring tool..
You are hitting a bug that was fixed in Node-RED 0.18.
Prior to Node-RED 0.18, the code that handled the shutdown of the runtime did not wait for the all of the node close handlers to complete before the process was terminated.

Resources