blob: 51eeba339140ff938cbd8a13b3d279f33006592b [file] [log] [blame]
Tony Mack9f797af2015-09-30 16:02:26 +00001FROM ubuntu:14.04.2
2MAINTAINER Andy Bavier <acb@cs.princeton.edu>
3
4# Set environment variables.
5ENV HOME /root
Tony Mack9f797af2015-09-30 16:02:26 +00006
7# XXX Workaround for docker bug:
8# https://github.com/docker/docker/issues/6345
9# Kernel 3.15 breaks docker, uss the line below as a workaround
10# until there is a fix
11RUN ln -s -f /bin/true /usr/bin/chfn
12# XXX End workaround
13
14# Install.
15RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
Tony Mack68a6ca52015-10-26 17:23:12 -040016 curl \
Tony Mack9f797af2015-09-30 16:02:26 +000017 git \
Tony Mack68a6ca52015-10-26 17:23:12 -040018 geoip-database \
Tony Mack9f797af2015-09-30 16:02:26 +000019 graphviz \
20 graphviz-dev \
Tony Mack68a6ca52015-10-26 17:23:12 -040021 libgeoip1 \
Tony Mack9f797af2015-09-30 16:02:26 +000022 libxslt1.1 \
23 libxslt1-dev \
Tony Mack9f797af2015-09-30 16:02:26 +000024 libyaml-dev \
Tony Mack68a6ca52015-10-26 17:23:12 -040025 nginx \
26 openssh-client \
27 python-dev \
Tony Mack9f797af2015-09-30 16:02:26 +000028 pkg-config \
Tony Mack68a6ca52015-10-26 17:23:12 -040029 postgresql \
Tony Mackca8c2232015-10-08 20:19:11 +000030 python-crypto \
31 python-httplib2>=0.9.1 \
Tony Mack9f797af2015-09-30 16:02:26 +000032 python-jinja2 \
33 python-paramiko \
34 python-pip \
35 python-psycopg2 \
36 python-pycurl \
37 python-setuptools \
38 python-yaml \
39 python-keystoneclient \
40 python-novaclient \
41 python-neutronclient \
42 python-glanceclient \
Tony Mack68a6ca52015-10-26 17:23:12 -040043 python-ceilometerclient \
44 supervisor \
45 tar \
46 wget
Tony Mack9f797af2015-09-30 16:02:26 +000047
48RUN pip install \
Tony Mackca8c2232015-10-08 20:19:11 +000049 django==1.7 \
Tony Mack9f797af2015-09-30 16:02:26 +000050 djangorestframework==2.4.4 \
51 markdown \
52 pyyaml \
53 django-filter \
54 lxml \
55 netaddr \
56 pytz \
57 django-timezones \
58 requests \
59 django-crispy-forms \
60 django-geoposition \
61 django-extensions \
62 django-suit \
63 django-bitfield \
64 django-ipware \
65 django-encrypted-fields \
66 django_rest_swagger \
67 python-keyczar \
68 pygraphviz \
Tony Mack68a6ca52015-10-26 17:23:12 -040069 dnslib \
70 uwsgi
Tony Mack9f797af2015-09-30 16:02:26 +000071
Tony Mackca8c2232015-10-08 20:19:11 +000072RUN easy_install --upgrade httplib2
73
Tony Mack9f797af2015-09-30 16:02:26 +000074RUN easy_install \
Tony Mackca8c2232015-10-08 20:19:11 +000075 django_evolution \
Tony Mack9f797af2015-09-30 16:02:26 +000076 python_gflags \
77 google_api_python_client \
78 httplib2.ca_certs_locater
79
Tony Mack9f797af2015-09-30 16:02:26 +000080
81# Install custom Ansible
82RUN git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible
83RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras
84RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras
85RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core
86RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core
Tony Mack68a6ca52015-10-26 17:23:12 -040087# git clone uses cached copy, doesn't pick up latest
88RUN git -C /opt/ansible pull
89RUN git -C /opt/ansible/lib/ansible/modules/core pull
90RUN git -C /opt/ansible/v2/ansible/modules/core pull
Tony Mack9f797af2015-09-30 16:02:26 +000091ADD ansible-hosts /etc/ansible/hosts
92
Tony Mack9f797af2015-09-30 16:02:26 +000093
94# For Observer
Tony Mack68a6ca52015-10-26 17:23:12 -040095ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
Tony Mack9f797af2015-09-30 16:02:26 +000096RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum
97RUN cd /tmp/fofum; python setup.py install
98RUN rm -rf /tmp/fofum
99
100RUN mkdir -p /usr/local/share /bin
101ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/
102RUN tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/
103RUN rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2
104RUN ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs
105RUN ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs
106
Tony Mack9f797af2015-09-30 16:02:26 +0000107# Get XOS
Tony Mack16a7c792015-10-12 20:16:08 +0000108RUN git clone git://github.com/open-cloud/xos.git /tmp/xos && mv /tmp/xos/xos /opt/
Tony Mack9f797af2015-09-30 16:02:26 +0000109
Tony Mack9f797af2015-09-30 16:02:26 +0000110RUN chmod +x /opt/xos/scripts/opencloud
Tony Mack68a6ca52015-10-26 17:23:12 -0400111
Tony Mack9f797af2015-09-30 16:02:26 +0000112RUN /opt/xos/scripts/opencloud genkeys
113
114# Workaround for AUFS issue
115# https://github.com/docker/docker/issues/783#issuecomment-56013588
116RUN mkdir /etc/ssl/private-copy; mv /etc/ssl/private/* /etc/ssl/private-copy/; rm -r /etc/ssl/private; mv /etc/ssl/private-copy /etc/ssl/private; chmod -R 0700 /etc/ssl/private; chown -R postgres /etc/ssl/private
117
118# Set postgres password to match default value in settings.py
119RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';"
120
121# Turn DEBUG on so that devel server will serve static files
122# (not necessary if --insecure is passed to 'manage.py runserver')
123# RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/xos/settings.py
124
125# Cruft to workaround problems with migrations, should go away...
126RUN /opt/xos/scripts/opencloud remigrate
127
Tony Mack9f797af2015-09-30 16:02:26 +0000128
129# install Tosca engine
130RUN apt-get install -y m4
131RUN pip install python-dateutil
132RUN bash /opt/xos/tosca/install_tosca.sh
Tony Mack9f797af2015-09-30 16:02:26 +0000133
Tony Mack68a6ca52015-10-26 17:23:12 -0400134# configure nginx
135RUN cp /opt/xos/nginx/xos.conf /etc/nginx/sites-enabled/
136
137# Supervisor configuration
Tony Mackcfaa0fd2015-10-26 17:41:18 -0400138RUN cp /opt/xos/configurations/opencloud/supervisord.conf /etc/supervisor/conf.d/xos-all.conf
Tony Mack68a6ca52015-10-26 17:23:12 -0400139
Tony Mack9f797af2015-09-30 16:02:26 +0000140EXPOSE 8000
141
Tony Mack9f797af2015-09-30 16:02:26 +0000142# Define default command.
Tony Mack68a6ca52015-10-26 17:23:12 -0400143CMD /usr/bin/supervisord -c /etc/supervisor/conf.d/xos-all.conf