Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 1 | FROM ubuntu:14.04.2 |
| 2 | MAINTAINER Andy Bavier <acb@cs.princeton.edu> |
| 3 | |
| 4 | # Set environment variables. |
| 5 | ENV HOME /root |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 6 | |
| 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 |
| 11 | RUN ln -s -f /bin/true /usr/bin/chfn |
| 12 | # XXX End workaround |
| 13 | |
| 14 | # Install. |
| 15 | RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \ |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 16 | curl \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 17 | git \ |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 18 | geoip-database \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 19 | graphviz \ |
| 20 | graphviz-dev \ |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 21 | libgeoip1 \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 22 | libxslt1.1 \ |
| 23 | libxslt1-dev \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 24 | libyaml-dev \ |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 25 | nginx \ |
| 26 | openssh-client \ |
| 27 | python-dev \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 28 | pkg-config \ |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 29 | postgresql \ |
Tony Mack | ca8c223 | 2015-10-08 20:19:11 +0000 | [diff] [blame] | 30 | python-crypto \ |
| 31 | python-httplib2>=0.9.1 \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 32 | 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 Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 43 | python-ceilometerclient \ |
| 44 | supervisor \ |
| 45 | tar \ |
| 46 | wget |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 47 | |
| 48 | RUN pip install \ |
Tony Mack | ca8c223 | 2015-10-08 20:19:11 +0000 | [diff] [blame] | 49 | django==1.7 \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 50 | 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 Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 69 | dnslib \ |
| 70 | uwsgi |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 71 | |
Tony Mack | ca8c223 | 2015-10-08 20:19:11 +0000 | [diff] [blame] | 72 | RUN easy_install --upgrade httplib2 |
| 73 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 74 | RUN easy_install \ |
Tony Mack | ca8c223 | 2015-10-08 20:19:11 +0000 | [diff] [blame] | 75 | django_evolution \ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 76 | python_gflags \ |
| 77 | google_api_python_client \ |
| 78 | httplib2.ca_certs_locater |
| 79 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 80 | |
| 81 | # Install custom Ansible |
| 82 | RUN git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible |
| 83 | RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras |
| 84 | RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras |
| 85 | RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core |
| 86 | RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 87 | # git clone uses cached copy, doesn't pick up latest |
| 88 | RUN git -C /opt/ansible pull |
| 89 | RUN git -C /opt/ansible/lib/ansible/modules/core pull |
| 90 | RUN git -C /opt/ansible/v2/ansible/modules/core pull |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 91 | ADD ansible-hosts /etc/ansible/hosts |
| 92 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 93 | |
| 94 | # For Observer |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 95 | ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 96 | RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum |
| 97 | RUN cd /tmp/fofum; python setup.py install |
| 98 | RUN rm -rf /tmp/fofum |
| 99 | |
| 100 | RUN mkdir -p /usr/local/share /bin |
| 101 | ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/ |
| 102 | RUN tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/ |
| 103 | RUN rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 |
| 104 | RUN ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs |
| 105 | RUN ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs |
| 106 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 107 | # Get XOS |
Tony Mack | 16a7c79 | 2015-10-12 20:16:08 +0000 | [diff] [blame] | 108 | RUN git clone git://github.com/open-cloud/xos.git /tmp/xos && mv /tmp/xos/xos /opt/ |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 109 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 110 | RUN chmod +x /opt/xos/scripts/opencloud |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 111 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 112 | RUN /opt/xos/scripts/opencloud genkeys |
| 113 | |
| 114 | # Workaround for AUFS issue |
| 115 | # https://github.com/docker/docker/issues/783#issuecomment-56013588 |
| 116 | RUN 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 |
| 119 | RUN 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... |
| 126 | RUN /opt/xos/scripts/opencloud remigrate |
| 127 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 128 | |
| 129 | # install Tosca engine |
| 130 | RUN apt-get install -y m4 |
| 131 | RUN pip install python-dateutil |
| 132 | RUN bash /opt/xos/tosca/install_tosca.sh |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 133 | |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 134 | # configure nginx |
| 135 | RUN cp /opt/xos/nginx/xos.conf /etc/nginx/sites-enabled/ |
| 136 | |
| 137 | # Supervisor configuration |
Tony Mack | cfaa0fd | 2015-10-26 17:41:18 -0400 | [diff] [blame^] | 138 | RUN cp /opt/xos/configurations/opencloud/supervisord.conf /etc/supervisor/conf.d/xos-all.conf |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 139 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 140 | EXPOSE 8000 |
| 141 | |
Tony Mack | 9f797af | 2015-09-30 16:02:26 +0000 | [diff] [blame] | 142 | # Define default command. |
Tony Mack | 68a6ca5 | 2015-10-26 17:23:12 -0400 | [diff] [blame] | 143 | CMD /usr/bin/supervisord -c /etc/supervisor/conf.d/xos-all.conf |