diff --git a/open-source-docker/docker/open-source-build/slycat-developer/.vimrc b/open-source-docker/docker/open-source-build/slycat-developer/.vimrc new file mode 100644 index 000000000..95dbc1f12 --- /dev/null +++ b/open-source-docker/docker/open-source-build/slycat-developer/.vimrc @@ -0,0 +1,19 @@ +:set tabstop=2 +:set shiftwidth=2 +:set expandtab +:set smartindent +:syntax enable + +set hls + +set exrc +set secure + +if has("autocmd") + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") + \| exe "normal g'\"" | endif +endif + +:highlight ExtraWhitespace ctermbg=red guibg=red +:match ExtraWhitespace /\s\+$/ + diff --git a/open-source-docker/docker/open-source-build/slycat-developer/Dockerfile b/open-source-docker/docker/open-source-build/slycat-developer/Dockerfile new file mode 100644 index 000000000..10fc428b1 --- /dev/null +++ b/open-source-docker/docker/open-source-build/slycat-developer/Dockerfile @@ -0,0 +1,86 @@ +FROM sandialabs/slycat-base + +USER root + +# add machine uuid +RUN dbus-uuidgen > /var/lib/dbus/machine-id + +# add developer python packages +RUN /home/slycat/install/conda/bin/pip install --no-use-wheel behave nose selenium pyvirtualdisplay +# the developer run-slycat version starts sshd +COPY run-slycat.sh /etc/slycat/ + +# assign a password to root and slycat +RUN echo 'root:slycat' | chpasswd; echo 'slycat:slycat' | chpasswd + +# Generate a private certificate authority. +RUN openssl genrsa -out /root-ca.key 2048 +RUN openssl req -x509 -new -nodes -key /root-ca.key -days 365 -out /root-ca.cert -subj "/C=US/ST=New Mexico/L=Albuquerque/O=The Slycat Project/OU=QA/CN=Slycat" +# Generate a self-signed certificate +RUN openssl genrsa -out /web-server.key 2048 +RUN openssl req -new -key /web-server.key -out /web-server.csr -subj "/C=US/ST=New Mexico/L=Albuquerque/O=The Slycat Project/OU=QA/CN=localhost" +RUN openssl x509 -req -in /web-server.csr -CA /root-ca.cert -CAkey /root-ca.key -CAcreateserial -out web-server.cert -days 365 +# Put the server key and certificate where the reverse proxy can find them. +RUN cat /web-server.key /web-server.cert > /etc/slycat/combined.cer; chgrp slycat /etc/slycat/combined.cer; chmod 440 /etc/slycat/combined.cer +# Add our private CA to the system-wide list of certificate authorities, so push scripts will trust the web-server. +RUN cp /root-ca.cert /etc/pki/ca-trust/source/anchors/ +RUN /usr/bin/update-ca-trust + + +# Python packages previously present: +# python-coverage python-nose python-sphinx python-sphinx_rtd_theme behave +# sphinxcontrib-httpdomain sphinxcontrib-napoleon pyside Ghost.py +# +# Additional python packages may be added to this python installation. The procedure +# overview is: install Miniconda, add the additional packages to conda by running +# each package's setup.py, run conda's package utility. Below is a more detailed +# procedure. Refer to slycat-base/Dockerfile for more examples. +# -install Miniconda +# -set PATH so /bin is default python +# -download and un-tar additional python packages into their own dirs +# -cd into each pkg dir, run "python setup.py install" +# -create a Slycat additions package with "conda package --pkg-name= --pkg-version=" +# Install the additions with "conda install your_package" + + +# Install yum packages for development. +RUN yum install -y openssh-server sudo + +# Install yum packages for testing +RUN yum -y install cmake qt-devel libxml2-devel libxslt-devel qtwebkit-devel xorg-x11-server-Xvfb firefox + +# Make sure we find qmake for pyside +ENV PATH /usr/lib64/qt4/bin:$PATH + +# Setup the sshd service. +RUN mkdir /var/run/sshd; mkdir /var/log/sshd; ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' +# Set reasonable ssh timeouts for development. +RUN sed -e 's/^#ClientAliveInterval .*$/ClientAliveInterval 60/' -i /etc/ssh/sshd_config +RUN sed -e 's/^#ClientAliveCountMax .*$/ClientAliveInterval 10080/' -i /etc/ssh/sshd_config + +EXPOSE 22 + +# Make the slycat user a sudoer. +RUN /usr/sbin/usermod -a -G wheel slycat +RUN sed -e 's/^# %wheel\tALL=(ALL)\tALL$/%wheel\tALL=(ALL)\tALL/' -i /etc/sudoers + +# We want CouchDB to listen on all network interfaces, so developers can use its web UI. +RUN sed -e 's/^bind_address = .*$/bind_address = 0.0.0.0/' -i /usr/local/etc/couchdb/default.ini +# CouchDB will be listening on port 5984. +EXPOSE 5984 + +USER slycat +RUN cd /home/slycat/src/slycat; git pull; +# put the appropriate web server config in place +ADD web-server-config.ini /etc/slycat/web-server-config.ini +# Configure vim and setup useful aliases. +RUN echo "alias vi=vim" >> /home/slycat/.bash +ADD .vimrc /home/slycat/.vimrc +# Setup useful git defaults. +RUN HOME=/home/slycat git config --global color.ui true +RUN cd /home/slycat; wget -e http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz; mkdir ffmpeg; tar xf ffmpeg-release-64bit-static.tar.xz --strip-components 1 -C ffmpeg +RUN export PATH=$HOME/ffmpeg:$PATH +RUN echo "export PATH=$HOME/ffmpeg:/home/slycat/install/conda/bin:$PATH" >> /home/slycat/.bashrc +RUN echo "alias testslycat=\"behave -i \\\"(agent|hyperchunks|rest-api|slycat-web-server|slycat-project)\\\" /home/slycat/src/slycat/features/\"" >> /home/slycat/.bashrc + +USER root diff --git a/open-source-docker/docker/open-source-build/slycat-developer/run-slycat.sh b/open-source-docker/docker/open-source-build/slycat-developer/run-slycat.sh new file mode 100755 index 000000000..0e00a558e --- /dev/null +++ b/open-source-docker/docker/open-source-build/slycat-developer/run-slycat.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# +# + +service rsyslog start +service couchdb start +sleep 1 +/home/slycat/install/conda/bin/python /home/slycat/src/slycat/web-server/slycat-couchdb-setup.py +service slycat-feed-server start +service slycat-web-server start +service haproxy start +service sshd start + +while [ 0 ] +do + sleep 4 + + service slycat-web-server status + retval=$? + [ $retval -ne 0 ] && service slycat-web-server cleanup + + service slycat-feed-server status + retval=$? + [ $retval -ne 0 ] && service slycat-feed-server cleanup + +done diff --git a/open-source-docker/docker/open-source-build/slycat-developer/web-server-config.ini b/open-source-docker/docker/open-source-build/slycat-developer/web-server-config.ini new file mode 100644 index 000000000..f7faa327b --- /dev/null +++ b/open-source-docker/docker/open-source-build/slycat-developer/web-server-config.ini @@ -0,0 +1,42 @@ +[slycat] +couchdb-database: "slycat" +couchdb-host: "http://localhost:5984" +server-admins: ["slycat"] +session-timeout: datetime.timedelta(minutes=1000) + +[slycat-feed-server] +access-log: "/var/log/slycat/feed-server-access.log" +access-log-count: 100 +access-log-size: 10000000 +error-log: "/var/log/slycat/feed-server-error.log" +error-log-count: 100 +error-log-size: 10000000 +socket-host: "127.0.0.1" +socket-port: 8093 + +[slycat-web-server] +access-log: "/var/log/slycat/web-server-access.log" +access-log-count: 100 +access-log-size: 10000000 +allowed-markings: ["", "faculty", "airmail"] +authentication: {"plugin":"slycat-standard-authentication", "kwargs":{"realm":"Slycat", "rules":[]}} +autoreload: True +data-store: "/var/lib/slycat/data-store" +directory: {"plugin":"identity", "kwargs":{"domain":"example.com"}} +error-log: "/var/log/slycat/web-server-error.log" +error-log-count: 100 +error-log-size: 10000000 +password-check: {"plugin": "slycat-identity-password-check"} +plugins: [ "plugins", "plugins/slycat-bookmark-demo", "plugins/slycat-cca", "plugins/slycat-generic-model", "plugins/slycat-hello-world", "plugins/slycat-linear-regression-demo", "plugins/slycat-matrix-demo-model", "plugins/slycat-model-wizards", "plugins/slycat-page-demo", "plugins/slycat-parameter-image", "plugins/slycat-parameter-image-plus-model", "plugins/slycat-project-wizards", "plugins/slycat-timeseries-model", "plugins/slycat-tracer-image", "plugins/slycat-stl-model", "plugins/slycat-remap-wizard"] +projects-redirect: "/projects" +remote-hosts: [{ "hostnames": ["localhost", "127.0.0.1"], "agent": {"command":"/home/slycat/install/conda/bin/python /home/slycat/src/slycat/agent/slycat-agent.py"}}] +remote-session-timeout: datetime.timedelta(minutes=15) +server-root: "/" +show-tracebacks: True +socket-host: "127.0.0.1" +socket-port: 8092 +support-email: {"address":"nobody@example.com", "subject":"Slycat Support Request"} +error-email: {"address":"nobody@example.com", "subject":"[Slycat][SERVER]"} +thread-pool: 100 +upload-session-timeout: datetime.timedelta(minutes=15) +upload-store: "/var/lib/slycat/upload-store"