fig docker monitoring broken container

℡╲_俬逩灬. 提交于 2019-12-03 16:13:24

You have to configure each program (container) in different files and them must be into /etc/supervisor/conf.d/ folder, in where the supervisor should look for the programs. In your case I propose:

#It is the /redis.conf
[program:redis]
command= /bin/bash -c "fig up redis"
        "fig logs redis"
directory=/path/of/fig_file
autostart=true
autorestart=true
stdout_logfile=/path/to/log/redis.log
redirect_stderr=true

And for pg:

#It is the /pg.conf
[program:pg]
command= /bin/bash -c "fig up pg"
        "fig logs pg"
directory=/path/of/fig_file
autostart=true
autorestart=true
stdout_logfile=/path/to/log/pg.log
redirect_stderr=true

And the same configuration (mongo.conf and app.conf) for the others program (mongo and app).

When you boot your machine or restart it, each program must be up.

The example above you run the container and you can keep it alive because you fallow the logs of it.

You can check the state of each programs with:

sudo supervisorctl 

And see:

app                          RUNNING    pid 17036, uptime 0:22:28
mongodb                      RUNNING    pid 17018, uptime 0:22:29
pg                           RUNNING    pid 17030, uptime 0:22:28
redis                        RUNNING    pid 17019, uptime 0:22:29

good luck!!

I would use Upstart which I've had pretty good experience from. Supervisord is best when processes don't daemonize.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!