Skip to content

Commit

Permalink
Added a runit service for apache
Browse files Browse the repository at this point in the history
  • Loading branch information
Homme Zwaagstra committed Mar 26, 2014
1 parent 76896de commit 694f5bd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ RUN sed --file /tmp/postgresql.conf.sed --in-place /etc/postgresql/9.1/main/post
RUN mkdir -p /etc/my_init.d
ADD shmmax.sh /etc/my_init.d/shmmax.sh

# Create an `apache2` `runit` service
ADD apache2 /etc/sv/apache2
RUN update-service --add /etc/sv/apache2

# Create a `renderd` `runit` service
RUN mkdir /etc/sv/renderd
ADD renderd.sh /etc/sv/renderd/run
ADD renderd /etc/sv/renderd

# Clean up APT when done
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Expand Down
10 changes: 10 additions & 0 deletions apache2/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

##
# Runit run script for apache2
#

# Activate the Ubuntu Apache environment
. /etc/apache2/envvars

exec /usr/sbin/apache2 -k start -DNO_DETACH
File renamed without changes.
11 changes: 4 additions & 7 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ cli () {
}

startrenderd () {
if [ ! -e /etc/service/renderd ]
if ! update-service --check renderd
then
echo "Starting renderd"
ln -s /etc/sv/renderd /etc/service/ || die "Could not link renderd into runit"
update-service --add /etc/sv/renderd || die "Could not add renderd as a runit service"
else
echo "Starting renderd"
sv start renderd || die "Could not start renderd"
Expand All @@ -98,11 +98,8 @@ startrenderd () {
startservices () {
startrenderd

if ! pgrep apache2 > /dev/null
then
echo "Starting web server"
service apache2 start || die "Could not start apache"
fi
echo "Starting web server"
sv start apache2 || die "Could not start apache"
}

help () {
Expand Down

0 comments on commit 694f5bd

Please sign in to comment.