Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN cd /opt \
&& git clone https://github.com/ToolDAQ/middleman.git \
&& cd middleman/ \
&& git checkout v3.0 \
&& . Setup.sh \
&& . ./Setup.sh \
&& make

# docs build fails if index.html is not present, which kills the docker build
Expand All @@ -50,7 +50,7 @@ RUN sed -e 's/#LoadModule mpm_prefork_module/LoadModule mpm_prefork_module/' -i
&& sed -e '/LoadModule mpm_event_module/ s/^#*/#/' -i /etc/httpd/conf.modules.d/00-mpm.conf

RUN echo 'CP=$(type -t cp)' >> /etc/rc.local ;\
echo 'if [ ! -z "${CP}" ]; then unalias cp; fi' >> /etc/rc.local ;\
echo 'if [ ! -z "${CP}" ] && [ "${CP}" != "file" ]; then unalias cp; fi' >> /etc/rc.local ;\
echo "cp -f /web/httpd.conf /etc/httpd/conf/" >> /etc/rc.local ;\
echo "alias cp='cp -i'" >> /etc/rc.local ;\
echo "chmod a+x /web/SetupDatabase.sh" >> /etc/rc.local ;\
Expand All @@ -66,10 +66,11 @@ RUN echo 'CP=$(type -t cp)' >> /etc/rc.local ;\
echo 'disown $!' >> /etc/rc.local ;\
echo "/web/Trigger_proxy &> /dev/null &" >> /etc/rc.local ;\
echo 'disown $!' >> /etc/rc.local ;\
echo "httpd" >> /etc/rc.local ;\
echo "/web/backgroundSD &> /dev/null " >> /etc/rc.local ;\
echo "/web/backgroundSD &> /dev/null &" >> /etc/rc.local ;\
echo 'disown $!' >> /etc/rc.local ;\
echo "httpd -DFOREGROUND" >> /etc/rc.local ;\
chmod +x /etc/rc.local

#ENTRYPOINT ["/bin/bash"]
#CMD ["-c",". /etc/rc.local"]
CMD /bin/bash -c '. /etc/rc.local'
CMD /bin/bash -c '. /etc/rc.local 2>&1 | tee /web/.rclocal.log'
5 changes: 5 additions & 0 deletions SetupDatabase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ if [ -f /.DBSetupDone ]; then
# pg_ctl version for containers
STATUS=$(sudo -u postgres pg_ctl -D /var/lib/pgsql/data status &> /dev/null; echo $?)
if [ ${STATUS} -eq 3 ]; then
if [ -f /var/run/postgresql/.s.PGSQL.5432.lock ]; then
echo "removing stale lockfile"
sudo rm -f /var/run/postgresql/.s.PGSQL.5432.lock
fi
echo "running pg_ctl start"
sudo -u postgres /usr/bin/pg_ctl start -D /var/lib/pgsql/data -s -o "-p 5432" -w -t 300
fi
exit 0;
Expand Down