Update frontend config; remove bash config
diff --git a/xos/configurations/bash/Dockerfile.bash b/xos/configurations/bash/Dockerfile.bash
deleted file mode 100644
index fc7177b..0000000
--- a/xos/configurations/bash/Dockerfile.bash
+++ /dev/null
@@ -1,13 +0,0 @@
-RUN mkdir -p /root/setup
-ADD xos/configurations/common/admin-openrc.sh /root/setup/
-ADD xos/configurations/common/controller_settings /root/setup/
-ADD xos/configurations/common/flat_net_name /root/setup/
-ADD xos/configurations/common/nodes.yaml /opt/xos/configurations/commmon/
-ADD xos/configurations/common/id_rsa.pub /root/setup/padmin_public_key
-ADD xos/configurations/common/node_key.pub /root/setup/node_key.pub
-ADD xos/configurations/common/node_key /root/setup/node_key
-ADD xos/configurations/common/ceilometer_url /root/setup/ceilometer_url
-
-CMD /usr/bin/make -C /opt/xos/configurations/bash -f Makefile.inside; /bin/bash
-
-#CMD ["/bin/bash"]
diff --git a/xos/configurations/bash/Makefile b/xos/configurations/bash/Makefile
deleted file mode 100644
index a668a55..0000000
--- a/xos/configurations/bash/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-MYIP:=$(shell hostname -i)
-
-test: common_cloudlab
- rm ../../xos_configuration/*
- cp ../common/xos_common_config ../../xos_configuration/
- cat ../common/Dockerfile.common Dockerfile.bash > Dockerfile
- cd ../../..; sudo docker build -t xos -f xos/configurations/bash/Dockerfile .
- sudo docker run -i --tty --add-host="ctl:$(MYIP)" -p 9999:8000 xos
-
-common_cloudlab:
- make -C ../common -f Makefile.cloudlab
diff --git a/xos/configurations/bash/Makefile.inside b/xos/configurations/bash/Makefile.inside
deleted file mode 100644
index 4ec8328..0000000
--- a/xos/configurations/bash/Makefile.inside
+++ /dev/null
@@ -1,7 +0,0 @@
-all: setup_xos
-
-setup_xos:
- bash /opt/xos/scripts/docker_setup_xos
- python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/fixtures.yaml
- python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/base.yaml
- python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/nodes.yaml
diff --git a/xos/configurations/bash/README b/xos/configurations/bash/README
deleted file mode 100644
index 83322a0..0000000
--- a/xos/configurations/bash/README
+++ /dev/null
@@ -1,5 +0,0 @@
-This configuration launches XOS on Cloudlab, leaving the user in an interactive bash session.
-
-The django UI is not started automatically. To start it, execute the following commands from the bash session:
- cd /opt/xos
- scripts/opencloud runserver
diff --git a/xos/configurations/frontend/Dockerfile.frontend b/xos/configurations/frontend/Dockerfile.frontend
deleted file mode 100644
index 8372fbf..0000000
--- a/xos/configurations/frontend/Dockerfile.frontend
+++ /dev/null
@@ -1,13 +0,0 @@
-
-###############################################################################
-########################## START FRONTEND TASKS ###############################
-###############################################################################
-
-RUN mkdir -p /root/setup
-
-RUN echo "autostart=false" >> /etc/supervisor/conf.d/observer.conf
-
-# TODO
-# - Enter /opt/xos/core/xoslib and run npm install
-
-CMD /usr/bin/make -C /opt/xos/configurations/frontend -f Makefile.inside
diff --git a/xos/configurations/frontend/Makefile b/xos/configurations/frontend/Makefile
index e30877a..b058798 100644
--- a/xos/configurations/frontend/Makefile
+++ b/xos/configurations/frontend/Makefile
@@ -1,37 +1,23 @@
MYIP:=$(shell hostname -i)
-RUNNING_CONTAINER=$(shell sudo docker ps|grep "xos"|awk '{print $$NF}')
-LAST_CONTAINER=$(shell sudo docker ps -l -q)
-XOS_FOLDER=$(shell pwd)
-
-all: frontend
+RUNNING_CONTAINER=$(shell sudo docker ps|grep "xos_1"|awk '{print $$NF}')
frontend:
- rm ../../xos_configuration/*
sudo apt-get -y install httpie
- cat ../common/Dockerfile.common Dockerfile.frontend > Dockerfile
- cp ../common/xos_common_config ../../xos_configuration/
- cd ../../..; sudo docker build -t xos -f xos/configurations/frontend/Dockerfile .
- sudo docker run -v $(XOS_FOLDER)/../../core/xoslib:/opt/xos/core/xoslib -p 9999:8000 --add-host="0.0.0.0:127.0.0.1" xos
+ sudo docker-compose up -d
bash ../common/wait_for_xos.sh
- echo $(RUNNING_CONTAINER)
-
-interactive:
- rm ../../xos_configuration/*
- cat ../common/Dockerfile.common Dockerfile.frontend > Dockerfile
- cp ../common/xos_common_config ../../xos_configuration/
- #cp ../cord/xos_cord_config ../../xos_configuration/
- cd ../../..; sudo docker build -t xos -f xos/configurations/frontend/Dockerfile .
- echo "Inside the container run: /usr/bin/make -C /opt/xos/configurations/frontend -f Makefile.inside"
- sudo docker run -it -v $(shell pwd)/../..:/opt/xos -p 9999:8000 --add-host="0.0.0.0:127.0.0.1" xos
+ sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/sample.yaml
stop:
- sudo docker stop $(RUNNING_CONTAINER)
-
-start:
- sudo docker start $(LAST_CONTAINER)
+ sudo docker-compose stop
showlogs:
- sudo docker logs $(LAST_CONTAINER)
+ sudo docker-compose logs
+
+rm: stop
+ sudo docker-compose rm
+
+ps:
+ sudo docker-compose ps
enter:
sudo docker exec -t -i $(RUNNING_CONTAINER) bash
diff --git a/xos/configurations/frontend/Makefile.inside b/xos/configurations/frontend/Makefile.inside
deleted file mode 100644
index 48046b2..0000000
--- a/xos/configurations/frontend/Makefile.inside
+++ /dev/null
@@ -1,12 +0,0 @@
-all: setup_xos run_develserver
-
-setup_xos:
- chmod +x /opt/xos/scripts/opencloud;
- /opt/xos/scripts/opencloud genkeys;
-# /opt/xos/scripts/opencloud remigrate;
- bash /opt/xos/tosca/install_tosca.sh;
- bash /opt/xos/scripts/docker_setup_xos
- python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/sample.yaml
-
-run_develserver:
- cd /opt/xos; python manage.py runserver 0.0.0.0:8000 --insecure
diff --git a/xos/configurations/frontend/README.md b/xos/configurations/frontend/README.md
index db3c99f..355ce0c 100644
--- a/xos/configurations/frontend/README.md
+++ b/xos/configurations/frontend/README.md
@@ -1,11 +1,7 @@
# XOS UI Development
-This configuration launches an XOS container on Cloudlab that runs the XOS develserver. The container is left running
-in the backgorund.
-
-The observer is not started, and there is no openstack backend connected for XOS.
-
-This configuration is intended for developing the XOS GUI.
+This configuration launches the XOS GUI and database in separate containers
+using docker-compose. The Synchronizer is not started and there is no openstack backend connected for XOS. This configuration is intended for developing the XOS GUI.
## Getting Started
@@ -14,15 +10,18 @@
You'll be able to visit XOS at `0.0.0.0:9000` and the `xos/core/xoslib` folder is shared with the container. This means that any update to that folder is automatically reported in the container.
->If you need to work on the Django application there is an alternative command to setup your config. Using `make interactive` instead of `make` an interactive container will be set up and the whole `xos` folder is shared.
->
-> _NOTE: once the container has started, be sure to isse `CMD /usr/bin/make -C /opt/xos/configurations/frontend -f Makefile.inside` command. Please be carefull and do not commit migrations, private keys or other autogenerated files.
+If you need to work on the Django application itself, comment out the "sleep" command
+for the `xos` container in docker-compose.yml and run `make`. Once the containers are
+up then type `make enter` to enter the running container.
+
+> _NOTE:
+> Please be careful and do not commit migrations, private keys or other autogenerated files._
### Docker Helpers
-Stop the container: `make stop`
+Stop the containers: `make stop`
-Restart (without rebuilding): `make start`
+Restart the containers: `make stop; make start`
Open a container shell: `make enter`
@@ -48,6 +47,5 @@
This project is following [Google JavaScript Style Guide](https://google.github.io/styleguide/javascriptguide.xml). To contribute please install [Eslint](http://eslint.org/) in your editor and run `npm run eslint` before commit.
-> _NOTE_
+> _NOTE_:
> Many of the already present file were not Style compliant. Linting for them has been disabled as it was to time consuming fix all of them. If **you are going to work** on that files, please **start fixing style issues**, and then **remove the `/* eslint-disable */`** comment
-
diff --git a/xos/configurations/frontend/docker-compose.yml b/xos/configurations/frontend/docker-compose.yml
new file mode 100644
index 0000000..2779deb
--- /dev/null
+++ b/xos/configurations/frontend/docker-compose.yml
@@ -0,0 +1,23 @@
+xos_db:
+ image: xosproject/xos-postgres
+ expose:
+ - "5432"
+
+# FUTURE
+#xos_swarm_synchronizer:
+# image: xosproject/xos-swarm-synchronizer
+# labels:
+# org.xosproject.kind: synchronizer
+# org.xosproject.target: swarm
+
+xos:
+ image: xosproject/xos
+ command: python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
+ #command: sleep 86400 # For interactive session
+ ports:
+ - "9999:8000"
+ links:
+ - xos_db
+ volumes:
+ - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+ - ../../core/xoslib:/opt/xos/core/xoslib:ro