blob: b722a3cd86c125df25b2741a578468e08f15b4ba [file] [log] [blame]
S.Çağlar Onur525bb722015-02-23 11:11:12 -05001FROM ubuntu:14.04.2
Andy Baviere4b346e2015-02-06 16:39:06 -05002MAINTAINER Andy Bavier <acb@cs.princeton.edu>
3
Tony Mack4b572182015-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 Baviere4b346e2015-02-06 16:39:06 -050011# Install.
12RUN apt-get update
Andy Bavier58be41f2015-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
Andy Baviere4b346e2015-02-06 16:39:06 -050026
27RUN pip install django==1.7
28RUN pip install djangorestframework==2.4.4
29RUN pip install markdown # Markdown support for the browseable API.
30RUN pip install pyyaml # YAML content-type support.
31RUN pip install django-filter # Filtering support
32RUN pip install lxml # XML manipulation library
33RUN pip install netaddr # IP Addr library
34RUN pip install pytz
35RUN pip install django-timezones
36RUN pip install requests
37RUN pip install django-crispy-forms
38RUN pip install django-geoposition
39RUN pip install django-extensions
40RUN pip install django-suit
Andy Baviere4b346e2015-02-06 16:39:06 -050041RUN pip install django-bitfield
42RUN pip install django-ipware
43RUN pip install django-encrypted-fields
44RUN pip install python-keyczar
45
Andy Bavier58be41f2015-02-10 16:37:33 -050046RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-keystoneclient
47RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-novaclient
48RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-neutronclient
49RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-glanceclient
50RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-ceilometerclient
Andy Baviere4b346e2015-02-06 16:39:06 -050051
52RUN pip install django_rest_swagger
53
Andy Bavier58be41f2015-02-10 16:37:33 -050054RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-setuptools
Andy Baviere4b346e2015-02-06 16:39:06 -050055RUN easy_install django_evolution
56RUN easy_install python_gflags
57RUN easy_install google_api_python_client
58
Andy Bavier18476e42015-02-11 17:07:36 -050059# Install custom Ansible
60RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-crypto
61RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-yaml
62RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-client
63RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-paramiko
64RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-jinja2
65RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-httplib2
66RUN git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible
67RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras
68RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras
69RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core
70RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core
Andy Baviere4b346e2015-02-06 16:39:06 -050071ADD ansible-hosts /etc/ansible/hosts
72
73ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
74
Andy Bavier4373b952015-02-10 14:01:07 -050075# For Observer
76RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum
77RUN cd /tmp/fofum; python setup.py install
S.Çağlar Onur525bb722015-02-23 11:11:12 -050078RUN rm -rf /tmp/fofum
Andy Bavier4373b952015-02-10 14:01:07 -050079
S.Çağlar Onur57311842015-02-12 11:55:19 -050080RUN mkdir -p /usr/local/share /bin
81ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/
S.Çağlar Onur6093d3e2015-02-12 12:02:10 -050082RUN tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/
S.Çağlar Onur57311842015-02-12 11:55:19 -050083RUN rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2
84RUN ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs
85RUN ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs
86
Andy Bavier1a7245f2015-04-24 10:52:27 -040087# Supervisor
88RUN DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor
89ADD observer.conf /etc/supervisor/conf.d/
90
Andy Baviere4b346e2015-02-06 16:39:06 -050091# Get XOS
Scott Baker7ff86d82015-02-18 22:30:22 -080092ADD xos /opt/xos
Andy Baviere4b346e2015-02-06 16:39:06 -050093
Scott Bakerae14d872015-02-19 13:33:58 -080094# Initscript is broken in Ubuntu
95#ADD observer-initscript /etc/init.d/xosobserver
Andy Baviere4b346e2015-02-06 16:39:06 -050096
97RUN chmod +x /opt/xos/scripts/opencloud
98RUN /opt/xos/scripts/opencloud genkeys
99
Andy Bavierda975a02015-03-13 14:01:47 -0400100# Workaround for AUFS issue
101# https://github.com/docker/docker/issues/783#issuecomment-56013588
102RUN 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
103
Andy Baviere4b346e2015-02-06 16:39:06 -0500104# Set postgres password to match default value in settings.py
105RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';"
106
107# Turn DEBUG on so that devel server will serve static files
S.Çağlar Onur8bcaf6d2015-02-12 11:42:20 -0500108RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/xos/settings.py
Andy Baviere4b346e2015-02-06 16:39:06 -0500109
110# Cruft to workaround problems with migrations, should go away...
Scott Bakerb353ffe2015-02-18 16:50:48 -0800111RUN /opt/xos/scripts/opencloud remigrate
Andy Baviere4b346e2015-02-06 16:39:06 -0500112
Andy Bavier1a7245f2015-04-24 10:52:27 -0400113# git clone uses cached copy, doesn't pick up latest
114RUN git -C /opt/ansible pull
115
Andy Baviere4b346e2015-02-06 16:39:06 -0500116EXPOSE 8000
117
118# Set environment variables.
119ENV HOME /root
120
121# Define working directory.
122WORKDIR /root
123
124# Define default command.
Andy Bavierbab59782015-03-13 14:52:52 -0400125#CMD ["/bin/bash"]
Andy Bavier1a7245f2015-04-24 10:52:27 -0400126CMD 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