home:
image: debian:wheezy
volumes:
- - ./examples/sandbox:/home/timeside
+ - ./examples/sandbox:/home/sandbox
command: /bin/true
db:
- log
environment:
- MYSQL_ROOT_PASSWORD=mysecretpassword
- - MYSQL_DATABASE=timeside
+ - MYSQL_DATABASE=sandbox
- MYSQL_USER=root
- MYSQL_PASSWORD=mysecretpassword
expose:
- "5672"
-worker:
- build: .
- volumes_from:
- - home
- command: /bin/sh /opt/TimeSide/examples/deploy/celery_app.sh
- links:
- - rabbitmq
- - db
-
app:
build: .
volumes:
links:
- rabbitmq
- db
- - worker
+
+worker:
+ build: .
+ volumes_from:
+ - app
+ command: /bin/sh /opt/TimeSide/examples/deploy/celery_app.sh
+ links:
+ - rabbitmq
+ - db
+ - app
nginx:
image: nginx
#!/bin/sh
# paths
-app_dir='/opt/TimeSide/'
-sandbox_dir='/home/timeside/'
-manage=$sandbox_dir'manage.py'
+app='/opt/TimeSide/'
+sandbox='/home/sandbox/'
+manage=$sandbox'manage.py'
-python $manage syncdb --noinput
-python $manage migrate --noinput
-python $manage collectstatic --noinput
-python $manage timeside-create-admin-user
+sh $app/examples/deploy/wait.sh
# Starting celery worker with the --autoreload option will enable the worker to watch for file system changes
# This is an experimental feature intended for use in development only
#!/bin/sh
# paths
-app_dir='/opt/TimeSide/'
-sandbox_dir='/home/timeside/'
-manage=$sandbox_dir'manage.py'
-wsgi=$sandbox_dir'wsgi.py'
-app_static_dir=$app_dir'timeside/player/static/'
+app='/opt/TimeSide/'
+static=$app'timeside/static/'
+sandbox='/home/sandbox/'
+manage=$sandbox'manage.py'
+wsgi=$sandbox'wsgi.py'
-# Copy Sandbox in /home/timeside
-# this is not needed for TimeSide but for Timeside-diadems
-# cp -uR /opt/TimeSide/examples/sandbox/* /home/timeside/
-
-# install staging modules
-pip install mysql
+sh $app/examples/deploy/wait.sh
# django init
python $manage syncdb --noinput
# static files auto update
watchmedo shell-command --patterns="*.js;*.css" --recursive \
- --command='python '$manage' collectstatic --noinput' $app_static_dir &
+ --command='python '$manage' collectstatic --noinput' $static &
# app start
-uwsgi --socket :8000 --wsgi-file $wsgi --chdir $sandbox_dir --master --processes 4 --threads 2 --py-autoreload 3
+uwsgi --socket :8000 --wsgi-file $wsgi --chdir $sandbox --master --processes 4 --threads 2 --py-autoreload 3
--- /dev/null
+#!/bin/sh
+
+apt-get install -y --force-yes netcat
+
+set -e
+
+host=$(env | grep _TCP_ADDR | cut -d = -f 2)
+port=$(env | grep _TCP_PORT | cut -d = -f 2)
+
+echo -n "waiting for TCP connection to $host:$port..."
+
+while ! nc -w 1 $host $port 2>/dev/null
+do
+ echo -n .
+ sleep 1
+done
+
+echo 'ok'
\ No newline at end of file