Add Varnish to web container as optional

This commit is contained in:
Mark Smith 2022-10-10 15:37:52 +00:00
parent 7ecea71f20
commit 544314cbd9
4 changed files with 18 additions and 2 deletions

View File

@ -14,7 +14,7 @@ ENV LJHOME /dw
# Install some packages we need in web only.
RUN echo $COMMIT && \
apt-get update && \
apt-get install -y mysql-client vim-tiny && \
apt-get install -y mysql-client vim-tiny varnish && \
curl https://raw.githubusercontent.com/dreamwidth/dw-free/master/doc/dependencies-system | \
xargs apt-get -y install && \
curl https://raw.githubusercontent.com/dreamwidth/dw-free/master/doc/dependencies-cpanm | \
@ -39,7 +39,10 @@ ADD config/ /dw/ext/local
RUN bash /opt/setup.sh
# We run on 80, TLS is handled by a proxy of some kind.
EXPOSE 80
EXPOSE 80/tcp
# Varnish is here and is layered in front of Apache typically.
EXPOSE 6081/tcp
# Kick off the startup script, which does some healthcheck and then starts
# Apache if things look good.

View File

@ -0,0 +1,6 @@
vcl 4.0;
backend default {
.host = "127.0.0.1";
.port = "80";
}

View File

@ -7,3 +7,7 @@
# Set up Apache2.
rm -rf /etc/apache2
ln -s /dw/ext/local/etc/apache2 /etc/apache2
# Set up Varnish.
rm -rf /etc/varnish/default.vcl
ln -s /dw/ext/local/etc/varnish/dreamwidth.vcl /etc/varnish/default.vcl

View File

@ -11,6 +11,9 @@ mkdir $LJHOME/ext/local/etc/apache2/sites-enabled || true
cp $LJHOME/ext/local/dreamwidth-prod.conf $LJHOME/ext/local/etc/apache2/sites-enabled/dreamwidth.conf
/usr/sbin/apache2ctl start
# Kick off Varnish
service varnish start
# Sleep a few seconds to ensure things get up and running
sleep 5