home:
image: debian:wheezy
volumes:
- - ./examples/sandbox:/home/telemeta
+ - ./examples/sandbox:/home/sandbox
command: /bin/true
db:
- log
environment:
- MYSQL_ROOT_PASSWORD=mysecretpassword
- - MYSQL_DATABASE=telemeta
+ - MYSQL_DATABASE=sandbox
- MYSQL_USER=root
- MYSQL_PASSWORD=mysecretpassword
expose:
- "5672"
-worker:
- build: .
- volumes_from:
- - home
- command: /bin/sh /opt/Telemeta/examples/deploy/celery_app.sh
- links:
- - rabbitmq
- - db
-
app:
build: .
volumes:
links:
- rabbitmq
- db
- - worker
+
+worker:
+ build: .
+ volumes_from:
+ - app
+ command: /bin/sh /opt/Telemeta/examples/deploy/celery_app.sh
+ links:
+ - rabbitmq
+ - db
+ - app
nginx:
image: nginx
#!/bin/sh
# paths
-app_dir='/opt/Telemeta/'
-sandbox_dir='/home/telemeta/'
-manage=$sandbox_dir'manage.py'
+app='/opt/Telemeta/'
+sandbox='/home/sandbox/'
+manage=$sandbox'manage.py'
+wsgi=$sandbox'wsgi.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/Telemeta/'
-sandbox_dir='/home/telemeta/'
-manage=$sandbox_dir'manage.py'
-wsgi=$sandbox_dir'wsgi.py'
-app_static_dir=$app_dir'telemeta/static/'
+app='/opt/Telemeta/'
+static=$app'telemeta/static/'
+sandbox='/home/sandbox/'
+manage=$sandbox'manage.py'
+wsgi=$sandbox'wsgi.py'
+
+sh $app/examples/deploy/wait.sh
# django init
python $manage syncdb --noinput
pip install watchdog
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
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': 'mysecretpassword', # Not used with sqlite3.
- 'NAME': 'telemeta',
+ 'NAME': 'sandbox',
'HOST': 'db', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '3306', # Set to empty string for default. Not used with sqlite3.
}
--- /dev/null
+from optparse import make_option
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+from django.contrib.auth.models import User
+from django.template.defaultfilters import slugify
+
+import os
+import timeside.core
+from timeside.server.models import *
+from timeside.core.tools.test_samples import generateSamples
+
+
+class Command(BaseCommand):
+ help = "Setup and run a boilerplate for testing"
+ cleanup = True
+
+ def processor_cleanup(self):
+ for processor in Processor.objects.all():
+ processor.delete()
+
+ def result_cleanup(self):
+ for result in Result.objects.all():
+ result.delete()
+
+ def handle(self, *args, **options):
+ presets = []
+ blacklist =['decoder', 'live', 'gain']
+ processors = timeside.core.processor.processors(timeside.core.api.IProcessor)
+ for proc in processors:
+ trig = True
+ for black in blacklist:
+ if black in proc.id():
+ trig = False
+ if trig:
+ processor, c = Processor.objects.get_or_create(pid=proc.id())
+ preset, c = Preset.objects.get_or_create(processor=processor, parameters='{}')
+ presets.append(preset)
+
+ media_dir = 'items' + os.sep + 'tests'
+ samples_dir = settings.MEDIA_ROOT + media_dir
+ samples = generateSamples(samples_dir=samples_dir)
+ selection, c = Selection.objects.get_or_create(title='Tests')
+
+ for sample in samples.iteritems():
+ filename, path = sample
+ title = os.path.splitext(filename)[0]
+ path = media_dir + os.sep + filename
+ item, c = Item.objects.get_or_create(title=title, file=path)
+ if not item in selection.items.all():
+ selection.items.add(item)
+ if self.cleanup:
+ for result in item.results.all():
+ result.delete()
+
+ experience, c = Experience.objects.get_or_create(title='All')
+ for preset in presets:
+ if not preset in experience.presets.all():
+ experience.presets.add(preset)
+
+ task = Task(experience=experience, selection=selection)
+ task.status_setter(2)