Last active
November 22, 2015 13:19
-
-
Save viztastic/93d9d98ada8c38baff82 to your computer and use it in GitHub Desktop.
Webserver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
====== | |
Dockerfile | |
====== | |
FROM ubuntu:14.04 | |
RUN apt-get update -y && apt-get install -y curl wget git supervisor build-essential | |
RUN mkdir -p /var/log/supervisor | |
RUN mkdir -p /data/logs | |
RUN cd /opt && git clone https://github.com/InconceivableDuck/Nodevember.git | |
RUN curl https://raw.githubusercontent.com/isaacs/nave/master/nave.sh > /opt/nave.sh | |
RUN bash /opt/nave.sh usemain 4.2.1 | |
RUN cd /opt && wget http://www.haproxy.org/download/1.6/src/haproxy-1.6.2.tar.gz | |
RUN cd /opt && tar xzf haproxy-1.6.2.tar.gz | |
RUN cd /opt/haproxy-1.6.2 && make TARGET=linux2628 && make install | |
ADD haproxy.cfg /opt/haproxy-1.6.2/haproxy.cfg | |
ADD supervisor.conf /etc/supervisor/conf.d/supervisor.conf | |
EXPOSE 80 8081 8082 8083 | |
CMD "/usr/bin/supervisord" | |
======== | |
supervisor.conf file | |
======== | |
[supervisord] | |
nodaemon=true | |
[program:app1] | |
command=node /opt/Nodevember/app/index.js | |
environment=PORT="8081" | |
stdout_logfile=/logs/app1.log | |
stdout_logfile_maxbytes=1GB | |
redirect_stderr=true | |
[program:app2] | |
command=node /opt/Nodevember/app/index.js | |
environment=PORT="8082" | |
stdout_logfile=/logs/app2.log | |
stdout_logfile_maxbytes=1GB | |
redirect_stderr=true | |
[program:app3] | |
command=node /opt/Nodevember/app/index.js | |
environment=PORT="8083" | |
stdout_logfile=/logs/app3.log | |
stdout_logfile_maxbytes=1GB | |
redirect_stderr=true | |
[program:app4] | |
command=node /opt/Nodevember/app/index.js | |
environment=PORT="8084" | |
stdout_logfile=/logs/app4.log | |
stdout_logfile_maxbytes=1GB | |
redirect_stderr=true | |
[program:haproxy] | |
command=haproxy -f /opt/haproxy-1.5.3/haproxy.cfg | |
stdout_logfile=/logs/haproxy.log | |
stdout_logfile_maxbytes=1GB | |
redirect_stderr=true | |
==== | |
Build and run | |
=== | |
1. Make a data directory | |
$ mkdir -p $HOME/logs | |
$ git clone salis | |
$ cd ./salis/docker/node | |
$ docker build -t api:0.1 . | |
$ docker run -d -v /mnt/logs:/logs -p 80:80 app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment