blob: 45de0dfe7c152637fceec0cfb5524f3df7fea99f [file] [log] [blame]
S.Çağlar Onur89d0ce72015-02-23 11:11:12 -05001FROM ubuntu:14.04.2
Andy Bavier37044342015-02-06 16:39:06 -05002MAINTAINER Andy Bavier <acb@cs.princeton.edu>
3
Tony Mack4faa5f92015-02-10 16:47:12 -05004# XXX Workaround for docker bug:
5# https://github.com/docker/docker/issues/6345
6# Kernel 3.15 breaks docker, uss the line below as a workaround
7# until there is a fix
8RUN ln -s -f /bin/true /usr/bin/chfn
9# XXX End workaround
10
Andy Bavier37044342015-02-06 16:39:06 -050011# Install.
12RUN apt-get update
Andy Bavier4578ae72015-02-10 16:37:33 -050013RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git
14RUN DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql
15RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-psycopg2
16RUN DEBIAN_FRONTEND=noninteractive apt-get install -y graphviz graphviz-dev
17RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libxslt1.1 libxslt1-dev
18RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip
19RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tar
20RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc
21RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-httplib2
22RUN DEBIAN_FRONTEND=noninteractive apt-get install -y geoip-database libgeoip1
23RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget
24RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-dev
25RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libyaml-dev
Scott Baker8251e7b2015-04-27 17:06:51 -070026RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config
Scott Baker0df68552015-05-18 09:25:15 -070027RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pycurl
Andy Bavier37044342015-02-06 16:39:06 -050028
29RUN pip install django==1.7
30RUN pip install djangorestframework==2.4.4
31RUN pip install markdown # Markdown support for the browseable API.
32RUN pip install pyyaml # YAML content-type support.
33RUN pip install django-filter # Filtering support
34RUN pip install lxml # XML manipulation library
35RUN pip install netaddr # IP Addr library
36RUN pip install pytz
37RUN pip install django-timezones
38RUN pip install requests
39RUN pip install django-crispy-forms
40RUN pip install django-geoposition
41RUN pip install django-extensions
42RUN pip install django-suit
Andy Bavier37044342015-02-06 16:39:06 -050043RUN pip install django-bitfield
44RUN pip install django-ipware
45RUN pip install django-encrypted-fields
46RUN pip install python-keyczar
Scott Baker8251e7b2015-04-27 17:06:51 -070047RUN pip install pygraphviz
Scott Baker0df68552015-05-18 09:25:15 -070048RUN pip install dnslib
Andy Bavier37044342015-02-06 16:39:06 -050049
Andy Bavier4578ae72015-02-10 16:37:33 -050050RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-keystoneclient
51RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-novaclient
52RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-neutronclient
53RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-glanceclient
54RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-ceilometerclient
Andy Bavier37044342015-02-06 16:39:06 -050055
56RUN pip install django_rest_swagger
57
Andy Bavier4578ae72015-02-10 16:37:33 -050058RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-setuptools
Andy Bavier37044342015-02-06 16:39:06 -050059RUN easy_install django_evolution
60RUN easy_install python_gflags
61RUN easy_install google_api_python_client
62
Andy Baviercabca602015-02-11 17:07:36 -050063# Install custom Ansible
64RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-crypto
65RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-yaml
66RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-client
67RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-paramiko
68RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-jinja2
69RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-httplib2
70RUN git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible
71RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras
72RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras
73RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core
74RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core
Andy Bavier37044342015-02-06 16:39:06 -050075ADD ansible-hosts /etc/ansible/hosts
76
77ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
78
Andy Bavierea979652015-02-10 14:01:07 -050079# For Observer
80RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum
81RUN cd /tmp/fofum; python setup.py install
S.Çağlar Onur89d0ce72015-02-23 11:11:12 -050082RUN rm -rf /tmp/fofum
Andy Bavierea979652015-02-10 14:01:07 -050083
S.Çağlar Onurd30d6352015-02-12 11:55:19 -050084RUN mkdir -p /usr/local/share /bin
85ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/
S.Çağlar Onurafb88a52015-02-12 12:02:10 -050086RUN tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/
S.Çağlar Onurd30d6352015-02-12 11:55:19 -050087RUN rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2
88RUN ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs
89RUN ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs
90
Andy Bavier6d23fcb2015-04-24 10:52:27 -040091# Supervisor
92RUN DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor
93ADD observer.conf /etc/supervisor/conf.d/
94
Andy Bavier37044342015-02-06 16:39:06 -050095# Get XOS
Scott Baker29397412015-02-18 22:30:22 -080096ADD xos /opt/xos
Andy Bavier37044342015-02-06 16:39:06 -050097
Scott Baker1c36afb2015-02-19 13:33:58 -080098# Initscript is broken in Ubuntu
99#ADD observer-initscript /etc/init.d/xosobserver
Andy Bavier37044342015-02-06 16:39:06 -0500100
101RUN chmod +x /opt/xos/scripts/opencloud
102RUN /opt/xos/scripts/opencloud genkeys
103
Andy Bavierdfcc6e02015-03-13 14:01:47 -0400104# Workaround for AUFS issue
105# https://github.com/docker/docker/issues/783#issuecomment-56013588
106RUN 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
107
Andy Bavier37044342015-02-06 16:39:06 -0500108# Set postgres password to match default value in settings.py
109RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';"
110
111# Turn DEBUG on so that devel server will serve static files
S.Çağlar Onur29c1f632015-02-12 11:42:20 -0500112RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/xos/settings.py
Andy Bavier37044342015-02-06 16:39:06 -0500113
114# Cruft to workaround problems with migrations, should go away...
Scott Baker6ada9252015-02-18 16:50:48 -0800115RUN /opt/xos/scripts/opencloud remigrate
Andy Bavier37044342015-02-06 16:39:06 -0500116
Andy Bavier6d23fcb2015-04-24 10:52:27 -0400117# git clone uses cached copy, doesn't pick up latest
118RUN git -C /opt/ansible pull
119
Andy Bavier37044342015-02-06 16:39:06 -0500120EXPOSE 8000
121
122# Set environment variables.
123ENV HOME /root
124
125# Define working directory.
126WORKDIR /root
127
128# Define default command.
Andy Bavierc3f91702015-03-13 14:52:52 -0400129#CMD ["/bin/bash"]
Andy Bavier6d23fcb2015-04-24 10:52:27 -0400130CMD service postgresql start; service supervisor start; cd /opt/xos; PUBLIC_HOSTNAME=`./xos-config.py get server_hostname $HOSTNAME`; python manage.py runserver $PUBLIC_HOSTNAME:8000