Skip to content

Commit

Permalink
Cleanup supervisor environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
unimock committed Oct 7, 2016
1 parent 0d92bcf commit 4acda05
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
11 changes: 6 additions & 5 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MAINTAINER Uni Mock <[email protected]> version: 0.0
# Let the container know that there is no tty
ENV DEBIAN_FRONTEND noninteractive

# --- set timezone
ARG BUILD_TZ="Europe/Berlin"
RUN echo "$BUILD_TZ" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata
Expand Down Expand Up @@ -52,7 +53,6 @@ RUN dpkg-reconfigure dash
# --- 7 Synchronize the System Clock
RUN apt-get -y install ntp ntpdate

RUN echo "kann wieder raus"

# --- 8 Install Postfix, Dovecot, MySQL, phpMyAdmin, rkhunter, binutils
ARG BUILD_MYSQL_PW="pass"
Expand Down Expand Up @@ -194,27 +194,28 @@ RUN mkdir -p /usr/local/bin
COPY ./bin/* /usr/local/bin/
RUN chmod a+x /usr/local/bin/*


#
# establisch supervisord
#
ADD /supervisor /etc/supervisor
# link old /etc/init.d/ startup scripts to supervisor
RUN ls -m1 /etc/supervisor/services.d | while read i; do ln -sf /etc/supervisor/super-init.sh /etc/init.d/$i ; done
RUN ls -m1 /etc/supervisor/services.d | while read i; do mv /etc/init.d/$i /etc/init.d/$i-orig ; ln -sf /etc/supervisor/super-init.sh /etc/init.d/$i ; done
RUN ln -sf /etc/supervisor/systemctl /bin/systemctl
RUN chmod a+x /etc/supervisor/* /etc/supervisor/*.d/*

copy /supervisor/invoke-rc.d /usr/sbin/invoke-rc.d
#
# create directory for service volume
#
RUN mkdir -p /service ; chmod a+rwx /service
ADD .track.gitignore /.gitignore
ADD track.gitignore /.gitignore

#
# Create bootstrap archives
#
RUN mkdir -p /bootstrap ; tar -C /var/vmail -czf /bootstrap/vmail.tgz .
RUN mkdir -p /bootstrap ; tar -C /var/www -czf /bootstrap/www.tgz .

ENV TERM xterm
#
# startup script
#
Expand Down
10 changes: 9 additions & 1 deletion build/supervisor/init.d/postfix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
cd /var/spool/postfix

echo " - calling newaliases"
newaliases

cd /var/spool/postfix
echo " - appling hosts, localtime, resolv.conf from /etc to /var/spool/postfix/etc"
FILES="etc/localtime etc/services etc/resolv.conf etc/hosts \
etc/nsswitch.conf etc/nss_mdns.config"
Expand All @@ -13,4 +13,12 @@ for file in $FILES; do
if [ -f ${file} ]; then chmod a+rX ${file}; fi
done

echo " - creating /etc/mailname with <$(hostname -f)>"
echo $(hostname -f) > /etc/mailname


list=`cd /etc/postfix && ls *.db`
for i in $list ; do
echo " - running postmap for </etc/postfix/${i%.db}>"
postmap /etc/postfix/${i%.db}
done
3 changes: 3 additions & 0 deletions build/supervisor/invoke-rc.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

/etc/init.d/${1} ${2}
4 changes: 4 additions & 0 deletions build/supervisor/super-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ SVC=`basename $0`

if [ "$1" = "reload" ] ; then
/usr/bin/supervisorctl stop ${SVC}
test -x /etc/supervisor/init.d/${SVC} && /etc/supervisor/init.d/${SVC}
/usr/bin/supervisorctl start ${SVC}
elif [ "$1" = "start" ] ; then
test -x /etc/supervisor/init.d/${SVC} && /etc/supervisor/init.d/${SVC}
/usr/bin/supervisorctl $1 ${SVC}
else
/usr/bin/supervisorctl $1 ${SVC}
fi
9 changes: 1 addition & 8 deletions build/supervisor/systemctl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,5 @@

SVC=${2%.service}

case "$1" in
restart | stop | status | start )
/etc/init.d/${SVC} ${1}

/usr/bin/supervisorctl ${1} ${SVC}
;;
*)
echo "error: unkown command: $@"
exit 1
esac
File renamed without changes.

0 comments on commit 4acda05

Please sign in to comment.