Skip to content

Instantly share code, notes, and snippets.

@rkrishnasanka
Last active May 10, 2025 22:20
Show Gist options
  • Save rkrishnasanka/29075ddc4584dd05133ec3c23b26661e to your computer and use it in GitHub Desktop.
Save rkrishnasanka/29075ddc4584dd05133ec3c23b26661e to your computer and use it in GitHub Desktop.
Installing supervisor
```sh
sudo yum install python3 pip
```
```sh
pip install supervisor
export PATH="$PATH:/path/to/your/supervisord/bin"
sudo echo_supervisord_conf > /etc/supervisord.conf
```
This is the supervisor config for nimbus
`/etc/supervisor/conf.d/nimbus.conf`
```conf
[program:nimbus]
command=/home/ec2-user/deploy/server_linux_amd64.out
autostart=true
autorestart=true
stderr_logfile=/home/ec2-user/deploy/log/nimbus.err.log
stdout_logfile=/home/ec2-user/deploy/log/nimbus.out.log
user=ec2-user
```
To restart the server
```sh
supervisorctl reread
supervisorctl update
supervisorctl restart nimbus
```
sudo yum update -y
sudo amazon-linux-extras enable nginx1
sudo yum install -y nginx
sudo nano /etc/nginx/conf.d/reverse-proxy.conf
server {
    listen 80;

    location / {
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
sudo nginx -T
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl restart nginx

Finally installed using immortal

here is the run.yml

cmd: ./server_linux_amd64.out
cwd: /home/ec2-user/deploy/
env:
   /// TODO: Put all variables here
    
log:
    file: /home/ec2-user/deploy/log/immortal.log
    age: 86400 # seconds
    num: 7     # int
    size: 1    # MegaBytes
    timestamp: true # will add timesamp to log
    restart: true
user: ec2-user
wait: 1

Run it using:

immortal -c nimbus.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment