blob: a6a72c546fb87f0c7f1cf63571e234d5022ade7b [file] [log] [blame]
Scott Baker752f4182015-09-28 17:16:22 -07001FROM ubuntu:14.04.2
2MAINTAINER Andy Bavier <acb@cs.princeton.edu>
3
4# 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
Andy Bavier793a3482015-10-05 17:01:26 -04007# until there is a fix
8RUN ln -s -f /bin/true /usr/bin/chfn
Scott Baker752f4182015-09-28 17:16:22 -07009# XXX End workaround
10
11# Install.
12RUN apt-get update && apt-get install -y \
13 git \
14 postgresql \
15 python-psycopg2 \
16 graphviz \
17 graphviz-dev \
18 libxslt1.1 \
19 libxslt1-dev \
20 python-pip \
21 tar \
22 gcc \
23 python-httplib2 \
24 geoip-database \
25 libgeoip1 \
Andy Bavier793a3482015-10-05 17:01:26 -040026 wget \
27 curl \
Scott Baker752f4182015-09-28 17:16:22 -070028 python-dev \
Andy Bavier793a3482015-10-05 17:01:26 -040029 libyaml-dev \
30 pkg-config \
Jeremy Mowery841f4502015-12-04 11:51:41 -070031 python-pycurl \
32 openvpn
Scott Baker752f4182015-09-28 17:16:22 -070033
34RUN pip install django==1.7
35RUN pip install djangorestframework==2.4.4
36RUN pip install markdown # Markdown support for the browseable API.
37RUN pip install pyyaml # YAML content-type support.
Andy Bavierc3218b62016-01-08 10:42:00 -050038RUN pip install django-filter==0.11.0 # Filtering support
Scott Baker752f4182015-09-28 17:16:22 -070039RUN pip install lxml # XML manipulation library
40RUN pip install netaddr # IP Addr library
41RUN pip install pytz
42RUN pip install django-timezones
43RUN pip install requests
44RUN pip install django-crispy-forms
45RUN pip install django-geoposition
46RUN pip install django-extensions
Matteo Scandolo2d2484f2015-11-10 17:13:04 +010047RUN pip install django-suit==0.3a1
Scott Baker752f4182015-09-28 17:16:22 -070048RUN pip install django-bitfield
49RUN pip install django-ipware
50RUN pip install django-encrypted-fields
51RUN pip install python-keyczar
Scott Baker7372c2b2015-10-21 15:59:40 -070052RUN pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
Scott Baker752f4182015-09-28 17:16:22 -070053RUN pip install dnslib
54
55RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-keystoneclient
56RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-novaclient
57RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-neutronclient
58RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-glanceclient
59RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-ceilometerclient
60
61RUN pip install django_rest_swagger
62
63RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-setuptools
Scott Baker752f4182015-09-28 17:16:22 -070064RUN easy_install python_gflags
65RUN easy_install --upgrade httplib2
66RUN easy_install google_api_python_client
Andy Bavier793a3482015-10-05 17:01:26 -040067RUN easy_install httplib2.ca_certs_locater
Scott Baker752f4182015-09-28 17:16:22 -070068
69# Install custom Ansible
70RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-crypto
71RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-yaml
72RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-client
73RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-paramiko
74RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-jinja2
75RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-httplib2
76RUN git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible
77RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras
78RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras
79RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core
80RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core
81ADD ansible-hosts /etc/ansible/hosts
82
83ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
84
85# For Observer
86RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum
87RUN cd /tmp/fofum; python setup.py install
88RUN rm -rf /tmp/fofum
89
90RUN mkdir -p /usr/local/share /bin
91ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/
92RUN tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/
93RUN rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2
94RUN ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs
95RUN ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs
96
97# Supervisor
98RUN DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor
99ADD observer.conf /etc/supervisor/conf.d/
100
Andy Bavier793a3482015-10-05 17:01:26 -0400101# Get XOS
Scott Baker752f4182015-09-28 17:16:22 -0700102ADD xos /opt/xos
103
104# Initscript is broken in Ubuntu
105#ADD observer-initscript /etc/init.d/xosobserver
106
Scott Baker171c23b2016-01-14 09:27:28 -0800107RUN chmod +x /opt/xos/tools/xos-manage
108RUN /opt/xos/tools/xos-manage genkeys
Scott Baker752f4182015-09-28 17:16:22 -0700109
110# Workaround for AUFS issue
111# https://github.com/docker/docker/issues/783#issuecomment-56013588
112RUN 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
113
114# Set postgres password to match default value in settings.py
115RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';"
116
117# Turn DEBUG on so that devel server will serve static files
118# (not necessary if --insecure is passed to 'manage.py runserver')
119# RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/xos/settings.py
120
121# Cruft to workaround problems with migrations, should go away...
Scott Baker171c23b2016-01-14 09:27:28 -0800122RUN /opt/xos/tools/xos-manage remigrate
Scott Baker752f4182015-09-28 17:16:22 -0700123
124# git clone uses cached copy, doesn't pick up latest
125RUN git -C /opt/ansible pull
126RUN git -C /opt/ansible/lib/ansible/modules/core pull
127RUN git -C /opt/ansible/v2/ansible/modules/core pull
128
129# install Tosca engine
130RUN apt-get install -y m4
131RUN pip install python-dateutil
132RUN bash /opt/xos/tosca/install_tosca.sh
133
Jeremy Mowery3b1caba2016-02-02 23:53:50 -0700134# for OpenVPN
135RUN mkdir -p /opt/openvpn
136RUN git clone https://github.com/OpenVPN/easy-rsa.git /opt/openvpn
137RUN git -C /opt/openvpn pull origin master
138RUN cp /opt/xos/services/vpn/vars /opt/openvpn/vars
139RUN source /opt/openvpn/vars
140RUN /opt/openvpn/clean-all
141RUN /opt/openvpn/build-ca --batch
142RUN /opt/openvpn/build-key-server --batch server
Jeremy Moweryfd081292016-02-07 17:07:55 -0700143RUN /opt/openvpn/build-dh
144RUN chmod 777 /opt/openvpn/keys/server.key
145RUN chmod 777 /opt/openvpn/keys/dh2048.pem
Jeremy Mowery3b1caba2016-02-02 23:53:50 -0700146
Scott Baker752f4182015-09-28 17:16:22 -0700147EXPOSE 8000
148
149# Set environment variables.
150ENV HOME /root
151
152# Define working directory.
153WORKDIR /root
154
155# Define default command.
156#CMD ["/bin/bash"]
Scott Baker57594332016-01-14 09:30:37 -0800157#CMD /opt/xos/tools/docker_start_xos