Recommended EC2 running architecture (no docker, no kubernetes)

What I want to do

I’d like to run dgraph (zero, alpha) in the same EC2 machine (standalone), the machine will be behind an ALB with Auto Scaling configured.

I’d like to know the best approach in order to start/run dgraph (zero and alpha) on the same machine, on the startup (since autoscaling is going to scale machines horizontally)

What I did

I have created a service via systemmd, it starts dgraph on the machine boot through an .sh script, it is the pseudo-flow:

systemmd.service → installer.sh → /usr/local/bin/dgraph alpha [params], /usr/local/bin/dgraph zero [params]

What issue I am facing

The alpha process is killed suddenly

systemctl status my-dgraph-startup-service.service

● my-dgraph-startup-service.service - ABC Service
Loaded: loaded (/etc/systemd/system/my-dgraph-startup-service.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-08-10 17:42:30 UTC; 1min ago
Main PID: 1723 (installer.sh)
CGroup: /system.slice/my-dgraph-startup-service.service
├─1723 /bin/bash /usr/custom_components/installer.sh
├─2538 PM2 v4.5.6: God Daemon (/root/.pm2)
├─2559 node /usr/custom_components/api/bin/dgraph-api/src/app.js
├─2585 /usr/local/bin/dgraph zero --wal=/usr/local/bin/zw --v=2 --telemetry=false --cwd=/usr/local/bin
├─2613 /usr/local/bin/dgraph alpha --wal=/usr/local/bin/zw --v=2 --cwd=/usr/local/bin --log_dir=/usr/local/bin/logalpha
└─2936 sleep 60d

After 5 minutes

● my-dgraph-startup-service.service - ABC Service
Loaded: loaded (/etc/systemd/system/my-dgraph-startup-service.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-08-10 17:42:30 UTC; 5min ago
Main PID: 1723 (installer.sh)
CGroup: /system.slice/my-dgraph-startup-service.service
├─1723 /bin/bash /usr/custom_components/installer.sh
├─2538 PM2 v4.5.6: God Daemon (/root/.pm2)
├─2559 node /usr/custom_components/api/bin/dgraph-api/src/app.js
├─2585 /usr/local/bin/dgraph zero --wal=/usr/local/bin/zw --v=2 --cwd=/usr/local/bin
└─2936 sleep 60d

Realize the process 2613 is killed, it is not possible to trace what happened on the OS.

Also, if I run the command directly in the shell it doesn’t kill the alpha.

Dgraph metadata

The alpha logs attached

dgraph.ERROR (379 Bytes)
dgraph.WARNING (498 Bytes)
dgraph.INFO (20.3 KB)

Dgraph version : v20.07.2