Skip to content

Commit

Permalink
Feat: remove Supervisor dependency
Browse files Browse the repository at this point in the history
Removed Supervisor dependency that was dragging Python 2 into the
installed packages.
Everything is running with Python 3 now:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        15  0.6  0.2 285336 38156 ?        S    16:38   0:00 /usr/bin/python3 /usr/bin/salt-master -d -l debug
root        44  1.5  0.2 210236 39772 ?        S    16:38   0:00 /usr/bin/python3 usr/bin/salt-api -d -l debug

Fix #1
  • Loading branch information
mbologna committed Apr 6, 2018
1 parent 5450e12 commit fb68ee8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
12 changes: 3 additions & 9 deletions Dockerfile-master
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
FROM opensuse:tumbleweed
MAINTAINER Michele Bologna <michele.bologna@gmail.com>

RUN zypper --non-interactive --no-gpg-checks refresh && \
zypper --non-interactive up --no-recommends -y && \
zypper --non-interactive in -y salt-master salt-api && \
zypper --non-interactive addrepo https://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Tumbleweed/devel:languages:python.repo && \
zypper --non-interactive --no-gpg-checks refresh && \
zypper --non-interactive in --no-recommends -y supervisor && \
RUN zypper --non-interactive in --no-recommends -y salt-master salt-api && \
zypper clean && \
useradd saltdev -p '$6$0BIlOqYqg5Rcuu5A$ojdWZ.aZztdSqPCnqsEE3ViRDcFAZ0MSp0UUvT23GG5mnbUOcalZPh8basKox2wcn4F1if2kfChOO/J1K2boe.' && \
mkdir /var/run/supervisord/ && \
sed -i -e 's/^user: salt$/user: root/g' /etc/salt/master

COPY etc_master/supervisord.conf /etc/supervisor.d/supervisord.conf
COPY etc_master/salt/master.d/autoaccept.conf /etc/salt/master.d/
COPY etc_master/salt/master.d/netapi.conf /etc/salt/master.d/
COPY entrypoint-master.sh /entrypoint-master.sh

VOLUME ["/srv/salt"]

EXPOSE 8000
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor.d/supervisord.conf"]
CMD /entrypoint-master.sh
4 changes: 1 addition & 3 deletions Dockerfile-minion
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM opensuse:tumbleweed
MAINTAINER Michele Bologna <michele.bologna@gmail.com>

RUN zypper --non-interactive --no-gpg-checks refresh && \
zypper --non-interactive up --no-recommends -y && \
zypper --non-interactive in -y salt-minion && \
RUN zypper --non-interactive in --no-recommends -y salt-minion && \
zypper clean

CMD ["/usr/bin/salt-minion", "-l", "debug"]
36 changes: 36 additions & 0 deletions entrypoint-master.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Start the first process
/usr/bin/salt-master -d -l debug
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start salt-master: $status"
exit $status
fi

# Start the second process
usr/bin/salt-api -d -l debug
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start salt-api: $status"
exit $status
fi

# Naive check runs checks once a minute to see if either of the processes exited.
# This illustrates part of the heavy lifting you need to do if you want to run
# more than one service in a container. The container exits with an error
# if it detects that either of the processes has exited.
# Otherwise it loops forever, waking up every 60 seconds

while sleep 60; do
ps aux |grep salt-master |grep -q -v grep
PROCESS_1_STATUS=$?
ps aux |grep salt-api |grep -q -v grep
PROCESS_2_STATUS=$?
# If the greps above find anything, they exit with 0 status
# If they are not both 0, then something is wrong
if [ $PROCESS_1_STATUS -ne 0 -o $PROCESS_2_STATUS -ne 0 ]; then
echo "One of the processes has already exited."
exit 1
fi
done
8 changes: 0 additions & 8 deletions etc_master/supervisord.conf

This file was deleted.

0 comments on commit fb68ee8

Please sign in to comment.