diff --git a/Makefile b/Makefile index 8a55b5544..72e25f4cc 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ all: docker-images DOCKER := sudo docker -docker-images: gcc-explorer-image d-explorer-image rust-explorer-image +docker-images: gcc-explorer-image d-explorer-image rust-explorer-image gcc-explorer-image-1204 .s3cfg: config.py echo 'from config import *; print "[default]\\naccess_key = {}\\nsecret_key={}\\n" \ @@ -11,6 +11,8 @@ docker-images: gcc-explorer-image d-explorer-image rust-explorer-image docker/gcc-explorer/.s3cfg: .s3cfg cp $< $@ +docker/gcc-explorer-1204/.s3cfg: .s3cfg + cp $< $@ docker/d-explorer/.s3cfg: .s3cfg cp $< $@ docker/rust-explorer/.s3cfg: .s3cfg @@ -19,6 +21,9 @@ docker/rust-explorer/.s3cfg: .s3cfg gcc-explorer-image: docker/gcc-explorer/.s3cfg $(DOCKER) build -t "mattgodbolt/gcc-explorer:gcc" docker/gcc-explorer +gcc-explorer-image-1204: docker/gcc-explorer-1204/.s3cfg + $(DOCKER) build -t "mattgodbolt/gcc-explorer:gcc1204" docker/gcc-explorer-1204 + d-explorer-image: docker/d-explorer/.s3cfg $(DOCKER) build -t "mattgodbolt/gcc-explorer:d" docker/d-explorer diff --git a/docker/d-explorer/run.sh b/docker/d-explorer/run.sh index 63f3bd35a..352bf9858 100755 --- a/docker/d-explorer/run.sh +++ b/docker/d-explorer/run.sh @@ -1,8 +1,9 @@ #!/bin/bash set -ex +. /site.sh -git clone -b release --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer +git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer cd /gcc-explorer make prereqs GDC=/usr/bin/gdc-4.9 nodejs app.js --env amazon-d diff --git a/docker/gcc-explorer-1204/Dockerfile b/docker/gcc-explorer-1204/Dockerfile new file mode 100644 index 000000000..53f4a7100 --- /dev/null +++ b/docker/gcc-explorer-1204/Dockerfile @@ -0,0 +1,56 @@ +FROM ubuntu:12.04 +MAINTAINER Matt Godbolt + +RUN apt-get -y update && apt-get install -y python-software-properties +RUN add-apt-repository -y ppa:chris-lea/node.js && add-apt-repository -y ppa:ubuntu-toolchain-r/test + +RUN apt-get -y update && apt-get install -y \ + curl \ + git \ + make \ + nodejs \ + s3cmd \ + clang \ + g++ \ + g++-4.4 \ + g++-4.5 \ + g++-4.5-arm-linux-gnueabi \ + g++-4.6 \ + g++-4.6-arm-linux-gnueabi \ + g++-4.7 \ + g++-4.7-multilib \ + g++-4.8 \ + g++-4.8-multilib \ + gcc-4.4 \ + gcc-4.5 \ + gcc-4.6 \ + gcc-4.7-base \ + gcc-4.7-multilib \ + gcc-4.8 \ + gcc-4.8-multilib \ + gcc-avr \ + gcc-msp430 \ + gcc-snapshot + +RUN mkdir -p /root +RUN mkdir -p /root/.ssh +COPY .s3cfg /root/ +COPY known_hosts /root/.ssh/ +COPY compilers.sh /root/ +RUN bash /root/compilers.sh +RUN rm /root/compilers.sh +RUN rm /root/.s3cfg +RUN apt-get purge -y curl s3cmd openjdk-6-jre-lib +RUN apt-get autoremove -y +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +##################### +RUN useradd gcc-user && mkdir -p /gcc-explorer /home/gcc-user && chown gcc-user /gcc-explorer && chown gcc-user /home/gcc-user +ENV HOME /home/gcc-user +COPY run.sh / + +USER gcc-user +WORKDIR /gcc-explorer +EXPOSE 20480 +CMD ["/run.sh"] diff --git a/docker/gcc-explorer-1204/compilers.sh b/docker/gcc-explorer-1204/compilers.sh new file mode 100644 index 000000000..2034c719d --- /dev/null +++ b/docker/gcc-explorer-1204/compilers.sh @@ -0,0 +1,20 @@ +#/bin/bash + +set -e +cd /opt + +for compiler in clang-3.2.tar.gz \ + clang-3.3.tar.gz \ + gcc-4.9.0-0909-concepts.tar.gz \ + gcc-4.9.0-with-concepts.tar.gz \ + gcc-4.9.0.tar.gz \ + intel.tar.gz \ + ; do + s3cmd --config /root/.s3cfg get s3://gcc-explorer/opt/$compiler /opt/$compiler + tar zxf $compiler + rm $compiler +done + +curl http://llvm.org/releases/3.4.1/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz | tar Jxf - + +find /opt -executable -type f | xargs strip || true diff --git a/docker/gcc-explorer-1204/known_hosts b/docker/gcc-explorer-1204/known_hosts new file mode 100644 index 000000000..cc3b9fb8c --- /dev/null +++ b/docker/gcc-explorer-1204/known_hosts @@ -0,0 +1,2 @@ +|1|6kkg4vXFndu74Cif5Oz9098PsY4=|k0sy2nylJdzYTwQK+aKmITvX8S8= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== +|1|9zKzfbCf91lj6RBfxx8gmxHV7Lc=|9JCgnqPKdeIaFvFF0tijjEgBWOk= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== diff --git a/docker/gcc-explorer-1204/run.sh b/docker/gcc-explorer-1204/run.sh new file mode 100755 index 000000000..267ac1380 --- /dev/null +++ b/docker/gcc-explorer-1204/run.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -ex + +. /site.sh + +git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer +cd /gcc-explorer +make prereqs +nodejs app.js --env amazon1204 diff --git a/docker/gcc-explorer/Dockerfile b/docker/gcc-explorer/Dockerfile index d79cf7011..f9f3cdebc 100644 --- a/docker/gcc-explorer/Dockerfile +++ b/docker/gcc-explorer/Dockerfile @@ -1,7 +1,7 @@ -FROM ubuntu:12.04 +FROM ubuntu:14.04 MAINTAINER Matt Godbolt -RUN apt-get -y update && apt-get install -y python-software-properties +RUN apt-get -y update && apt-get install -y python-software-properties software-properties-common RUN add-apt-repository -y ppa:chris-lea/node.js && add-apt-repository -y ppa:ubuntu-toolchain-r/test RUN apt-get -y update && apt-get install -y \ @@ -10,27 +10,11 @@ RUN apt-get -y update && apt-get install -y \ make \ nodejs \ s3cmd \ - clang \ - g++ \ - g++-4.4 \ - g++-4.5 \ - g++-4.5-arm-linux-gnueabi \ - g++-4.6 \ - g++-4.6-arm-linux-gnueabi \ - g++-4.7 \ - g++-4.7-multilib \ + clang-3.5 \ g++-4.8 \ - g++-4.8-multilib \ - gcc-4.4 \ - gcc-4.5 \ - gcc-4.6 \ - gcc-4.7-base \ - gcc-4.7-multilib \ - gcc-4.8 \ - gcc-4.8-multilib \ - gcc-avr \ - gcc-msp430 \ - gcc-snapshot + g++-4.8-powerpc-linux-gnu \ + g++-arm-linux-gnueabihf \ + g++-aarch64-linux-gnu RUN mkdir -p /root RUN mkdir -p /root/.ssh diff --git a/docker/gcc-explorer/compilers.sh b/docker/gcc-explorer/compilers.sh index 2034c719d..f083d8caf 100644 --- a/docker/gcc-explorer/compilers.sh +++ b/docker/gcc-explorer/compilers.sh @@ -3,18 +3,4 @@ set -e cd /opt -for compiler in clang-3.2.tar.gz \ - clang-3.3.tar.gz \ - gcc-4.9.0-0909-concepts.tar.gz \ - gcc-4.9.0-with-concepts.tar.gz \ - gcc-4.9.0.tar.gz \ - intel.tar.gz \ - ; do - s3cmd --config /root/.s3cfg get s3://gcc-explorer/opt/$compiler /opt/$compiler - tar zxf $compiler - rm $compiler -done - -curl http://llvm.org/releases/3.4.1/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz | tar Jxf - - find /opt -executable -type f | xargs strip || true diff --git a/docker/gcc-explorer/run.sh b/docker/gcc-explorer/run.sh index 55ab6681c..f4640d6b3 100755 --- a/docker/gcc-explorer/run.sh +++ b/docker/gcc-explorer/run.sh @@ -2,7 +2,9 @@ set -ex -git clone -b release --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer +. /site.sh + +git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer cd /gcc-explorer make prereqs nodejs app.js --env amazon diff --git a/docker/rust-explorer/run.sh b/docker/rust-explorer/run.sh index b51cc6186..4642fd665 100755 --- a/docker/rust-explorer/run.sh +++ b/docker/rust-explorer/run.sh @@ -2,7 +2,9 @@ set -ex -git clone -b release --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer +. /site.sh + +git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer cd /gcc-explorer make prereqs nodejs app.js --env amazon-rust diff --git a/gcc-explorer.conf b/gcc-explorer.conf index 82621c1ef..e0872936c 100644 --- a/gcc-explorer.conf +++ b/gcc-explorer.conf @@ -20,6 +20,8 @@ script set -e HOME=/root export HOME + DEV_MODE=0 + export DEV_MODE mkfifo /tmp/gcc-explorer-log ( logger -t gcc /tmp/gcc-explorer-log diff --git a/run_site.sh b/run_site.sh index 5abbd0000..aac0e2fa8 100755 --- a/run_site.sh +++ b/run_site.sh @@ -2,28 +2,40 @@ set -ex +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SUDO=sudo if [[ $UID = 0 ]]; then SUDO= fi -$SUDO docker pull mattgodbolt/gcc-explorer +EXTERNAL_PORT=80 +CONFIG_FILE=${DIR}/site-prod.sh +if [[ ${DEV_MODE=1} = 1 ]]; then + EXTERNAL_PORT=8000 + CONFIG_FILE=${DIR}/site-dev.sh +else + $SUDO docker pull mattgodbolt/gcc-explorer +fi + +ALL="gcc gcc1204 d rust nginx" +$SUDO docker stop ${ALL} || true +$SUDO docker rm ${ALL} || true -$SUDO docker stop gcc d rust nginx || true -$SUDO docker rm gcc d rust nginx || true +CFG="-v ${CONFIG_FILE}:/site.sh:ro" -GCC=$(sudo docker run --name gcc -d -p 10240:10240 mattgodbolt/gcc-explorer:gcc) -D=$(sudo docker run --name d -d -p 10241:10241 mattgodbolt/gcc-explorer:d) -RUST=$(sudo docker run --name rust -d -p 10242:10242 mattgodbolt/gcc-explorer:rust) +$SUDO docker run --name gcc1204 ${CFG} -d -p 20480:20480 mattgodbolt/gcc-explorer:gcc1204 +$SUDO docker run --name gcc ${CFG} --link gcc1204:gcc1204 -d -p 10240:10240 mattgodbolt/gcc-explorer:gcc +$SUDO docker run --name d ${CFG} -d -p 10241:10241 mattgodbolt/gcc-explorer:d +$SUDO docker run --name rust ${CFG} -d -p 10242:10242 mattgodbolt/gcc-explorer:rust -trap "$SUDO docker stop $GCC $D $RUST" SIGINT SIGTERM SIGPIPE +trap "$SUDO docker stop ${ALL}" SIGINT SIGTERM SIGPIPE $SUDO docker run \ - -p 80:80 \ + -p ${EXTERNAL_PORT}:80 \ --name nginx \ --volumes-from gcc \ -v /var/log/nginx:/var/log/nginx \ - -v /home/ubuntu:/var/www \ - -v $(pwd)/nginx:/etc/nginx/sites-enabled \ + -v /home/ubuntu:/var/www:ro \ + -v $(pwd)/nginx:/etc/nginx/sites-enabled:ro \ --link gcc:gcc --link d:d --link rust:rust \ dockerfile/nginx diff --git a/site-dev.sh b/site-dev.sh new file mode 100644 index 000000000..e6fb04e5c --- /dev/null +++ b/site-dev.sh @@ -0,0 +1,2 @@ +# Sourced when running in development mode +export BRANCH=master diff --git a/site-prod.sh b/site-prod.sh new file mode 100644 index 000000000..06aeed68b --- /dev/null +++ b/site-prod.sh @@ -0,0 +1,2 @@ +# Sourced when loaded in production +export BRANCH=release