Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting supervisord to work correctly #2

Closed
justinhelmer opened this issue Dec 23, 2017 · 4 comments
Closed

getting supervisord to work correctly #2

justinhelmer opened this issue Dec 23, 2017 · 4 comments

Comments

@justinhelmer
Copy link

justinhelmer commented Dec 23, 2017

Hello binhex,

I could use a bit of assistance. I am using this base repo to create an arch container for stuff.

Here is my Dockerfile:

FROM binhex/arch-base:2017102500
MAINTAINER binhex

ADD build/*.conf /etc/supervisor/conf.d/
ADD build/*.sh /arch/build/
ADD run/*.sh /arch/run/

RUN chmod +x /arch/build/*.sh /arch/run/*.sh && /bin/bash /arch/build/install.sh

VOLUME /config

EXPOSE 3000
EXPOSE 80

CMD ["/bin/bash", "/root/init.sh"]

My install:

#!/bin/bash

# exit script if return code != 0
set -e

# download build scripts from github
curl --connect-timeout 5 --max-time 600 --retry 5 --retry-delay 0 --retry-max-time 60 -o /tmp/scripts-master.zip -L https://github.com/binhex/scripts/archive/master.zip

# unzip build scripts
unzip /tmp/scripts-master.zip -d /tmp

# move shell scripts to /root
mv /tmp/scripts-master/shell/arch/docker/*.sh /root/

pacman_packages="git mongodb nodejs"

pacman -S --needed $pacman_packages --noconfirm

# cleanup
yes | pacman -Scc
rm -rf /usr/share/locale/*
rm -rf /usr/share/man/*
rm -rf /usr/share/gtk-doc/*
rm -rf /tmp/*

My supervisor conf:

[program:start-script]
autostart = true
autorestart = false
startsecs = 0
user = root
command = /arch/run/init.sh
stdout_logfile = /arch/log/init.out.log
stderr_logfile = /arch/log/init.err.log
umask = 000

[program:mongod]
autostart = true
autorestart = false
startsecs = 0
user = root
command = mongod
stdout_logfile = /arch/log/mongod.out.log
stderr_logfile = /arch/log/mongod.err.log
umask = 000

I can see supervisor starting correctly, and I can see the output loading my conf file:

Created by...
___.   .__       .__
\_ |__ |__| ____ |  |__   ____ ___  ___
 | __ \|  |/    \|  |  \_/ __ \\  \/  /
 | \_\ \  |   |  \   Y  \  ___/ >    <
 |___  /__|___|  /___|  /\___  >__/\_ \
     \/        \/     \/     \/      \/
   https://hub.docker.com/u/binhex/

2017-12-23 22:48:07.233409 [info] System information Linux de58e6619c7f 4.4.15+ #15217 SMP PREEMPT Wed Dec 20 18:19:46 CST 2017 x86_64 GNU/Linux
2017-12-23 22:48:07.394645 [warn] PUID not defined (via -e PUID), defaulting to '99'
2017-12-23 22:48:07.630342 [warn] PGID not defined (via -e PGID), defaulting to '100'
2017-12-23 22:48:08.496001 [warn] UMASK not defined (via -e UMASK), defaulting to '000'
2017-12-23 22:48:08.565417 [info] Permissions already set for volume mappings
2017-12-23 22:48:08.648115 [info] Starting Supervisor...
2017-12-23 22:48:11,170 CRIT Set uid to user 0
2017-12-23 22:48:11,170 INFO Included extra file "/etc/supervisor/conf.d/archlinux.conf" during parsing
2017-12-23 22:48:11,171 INFO supervisord started with pid 7
2017-12-23 22:48:12,172 INFO reaped unknown pid 8

All my services start correctly, but I cannot correctly stop/start services with supervisorctl.

When attempting to launch supervisorctl or when running supervisorctl restart, I see the following:

unix:///run/supervisor.sock no such file

I tried manually creating an empty file in that location and adding elevated permissions, but I just get the following:

unix:///run/supervisor.sock refused connection

I figured there was a trick you know that could help me get it going. Otherwise, everything is working perfectly.

Any help would be greatly appreciated.

@justinhelmer
Copy link
Author

No clue what my issue was, but things appear to be working perfectly now.

@justinhelmer
Copy link
Author

repopened with updated comment

@binhex
Copy link
Owner

binhex commented Dec 28, 2017

All my services start correctly, but I cannot correctly stop/start services with supervisorctl.

you shouldn't be stopping and starting processes inside the container, instead you should set all processes to auto start via supervisord and then if you want to stop everything then you use the "docker stop" command to stop the container, remember docker is not the same as a vm, there is no init.d, there is no upstart, and there is no systemd, in short you define what you want to start via supervisord only.

@justinhelmer
Copy link
Author

thanks binhex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants