Merge branch 'master' of github.com:open-cloud/xos
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..774220d
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,94 @@
+FROM ubuntu:14.04.1
+MAINTAINER Andy Bavier <acb@cs.princeton.edu>
+
+# Install.
+RUN apt-get update
+RUN apt-get install -y git
+RUN apt-get install -y postgresql
+RUN apt-get install -y python-psycopg2
+RUN apt-get install -y graphviz graphviz-dev
+RUN apt-get install -y libxslt1.1 libxslt1-dev
+RUN apt-get install -y python-pip
+RUN apt-get install -y tar
+RUN apt-get install -y gcc
+RUN apt-get install -y python-httplib2
+RUN apt-get install -y geoip-database libgeoip1
+RUN apt-get install -y wget
+RUN apt-get install -y python-dev
+
+RUN pip install django==1.7
+RUN pip install djangorestframework==2.4.4
+RUN pip install markdown # Markdown support for the browseable API.
+RUN pip install pyyaml # YAML content-type support.
+RUN pip install django-filter # Filtering support
+RUN pip install lxml # XML manipulation library
+RUN pip install netaddr # IP Addr library
+RUN pip install pytz
+RUN pip install django-timezones
+RUN pip install requests
+RUN pip install django-crispy-forms
+RUN pip install django-geoposition
+RUN pip install django-extensions
+RUN pip install django-suit
+RUN pip install django-evolution
+RUN pip install django-bitfield
+RUN pip install django-ipware
+RUN pip install django-encrypted-fields
+RUN pip install python-keyczar
+
+RUN apt-get install -y python-keystoneclient
+RUN apt-get install -y python-novaclient
+RUN apt-get install -y python-neutronclient
+RUN apt-get install -y python-glanceclient
+RUN apt-get install -y python-ceilometerclient
+
+RUN pip install django_rest_swagger
+
+RUN apt-get install -y python-setuptools
+RUN easy_install django_evolution
+RUN easy_install python_gflags
+RUN easy_install google_api_python_client
+
+# Set up latest Ansible
+# Need to add our patches too
+RUN apt-get install -y ansible
+# RUN git clone --recursive git://github.com/ansible/ansible.git /opt/ansible
+ADD ansible-hosts /etc/ansible/hosts
+
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
+
+# Get XOS
+ADD planetstack /opt/xos
+
+ADD observer-initscript /etc/init.d/plstackobserver
+
+RUN chmod +x /opt/xos/scripts/opencloud
+RUN /opt/xos/scripts/opencloud genkeys
+
+# Set postgres password to match default value in settings.py
+RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';"
+
+# Turn DEBUG on so that devel server will serve static files
+RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/planetstack/settings.py
+
+# Cruft to workaround problems with migrations, should go away...
+RUN /opt/xos/scripts/opencloud dropdb
+RUN rm -rf /opt/xos/*/migrations
+RUN cd /opt/xos; python ./manage.py makemigrations core
+RUN cd /opt/xos; python ./manage.py makemigrations hpc
+RUN cd /opt/xos; python ./manage.py makemigrations requestrouter
+RUN cd /opt/xos; python ./manage.py makemigrations syndicate_storage
+RUN cd /opt/xos; python ./manage.py makemigrations servcomp
+
+RUN /opt/xos/scripts/opencloud initdb
+
+EXPOSE 8000
+
+# Set environment variables.
+ENV HOME /root
+
+# Define working directory.
+WORKDIR /root
+
+# Define default command.
+CMD ["/bin/bash"]
diff --git a/README.Docker b/README.Docker
new file mode 100644
index 0000000..5ce5806
--- /dev/null
+++ b/README.Docker
@@ -0,0 +1,25 @@
+The Dockerfile in this directory will build a Docker image for running
+XOS using the Django development server. It copies whatever files are
+in the local repository into the image. Here's how to do it:
+
+1. Currently planetstack/core/fixtures/initial_data.json is broken!
+ Overwrite this file with a working fixture, e.g., by dumping
+ portal.opencloud.us's database:
+
+ $ sudo /opt/xos/scripts/opencloud dumpdata
+
+2. $ docker build -t xos .
+
+3. $ docker run -t -i -p 8000:8000 xos
+
+4. Now you will have a bash prompt as root inside the XOS container.
+ Start up XOS:
+
+ # /opt/xos/scripts/opencloud runserver
+
+You can access the XOS login at http:<server>:8000, where <server> is
+the name of the server running Docker.
+
+STILL TO DO
+-----------
+* Test Observer
diff --git a/ansible-hosts b/ansible-hosts
new file mode 100644
index 0000000..0dd74f1
--- /dev/null
+++ b/ansible-hosts
@@ -0,0 +1,2 @@
+[localhost]
+127.0.0.1
diff --git a/planetstack/scripts/opencloud b/planetstack/scripts/opencloud
index a0be07c..d460312 100755
--- a/planetstack/scripts/opencloud
+++ b/planetstack/scripts/opencloud
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
if [ -z "$1" ]; then
echo usage: $0 "[initdb | createdb | dropdb | syncdb | runserver | resetdb | dumpdata]"
@@ -24,9 +24,8 @@
return
fi
- /sbin/service postgresql initdb
- /sbin/service postgresql start
- /sbin/chkconfig postgresql on
+ service postgresql initdb
+ service postgresql start
netstat -nl | grep -i ":5432 "
if [[ $? != 0 ]]; then
@@ -66,6 +65,7 @@
pkill -f "python.*runserver"
}
function runserver {
+ ensure_postgres_running
PUBLIC_HOSTNAME=`$XOS_DIR/xos-config.py get server_hostname $HOSTNAME`
echo "Starting XOS Service on $PUBLIC_HOSTNAME:8000"
python manage.py runserver $PUBLIC_HOSTNAME:8000 --insecure&