--- a/.hgignore Fri Nov 07 16:33:06 2014 +0100
+++ b/.hgignore Mon Nov 10 11:46:27 2014 +0100
@@ -5,32 +5,18 @@
syntax: regexp
^web/.htaccess$
-
-syntax: regexp
^web/static/site$
\.DS_Store
-syntax: regexp
^virtualenv/web/project-boot\.py$
-syntax: regexp
^web/index/.*$
-
-syntax: regexp
^virtualenv/res/src/south$
-syntax: regexp
\.sh$
-syntax: regexp
^web/hdalab/config\.py$
-syntax: regexp
+^web/hdalab/\.htaccess$
^web/hdalab/\.htaccess$
-syntax: regexp
-^web/hdalab/\.htaccess$
-syntax: regexp
^\.settings$
-syntax: regexp
^run$
-syntax: regexp
^src/hdabo/config\.py$
-syntax: regexp
^web/static/media/thumbnails/renkan/renkan_default_icon\.png\.100x100_q85\.png$
-syntax: regexp
-^src/hdalab/config\.py$
\ No newline at end of file
+^src/hdalab/config\.py$
+^sbin/sync/config\.py$
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbin/sync/config.py.tmpl Mon Nov 10 11:46:27 2014 +0100
@@ -0,0 +1,65 @@
+from fabric.api import env
+from random import choice
+
+env.hosts = ['iri@web.iri.centrepompidou.fr']
+
+env.web_group = 'www-data'
+env.folders = ['log', 'static/media']
+
+env.repos = {
+ 'ldt': {'repo':"/Users/ymh/dev/workspace/platform", 'src_root':'src/ldt'},
+ 'renkanmanager': {'repo':"/Users/ymh/dev/workspace/renkan", 'src_root':'server/python/django'},
+}
+env.base_export_path = "~/tmp"
+env.export_prefix = "hdalab"
+
+env.remote_path = {
+ 'web':"/iridata/www/iri-research/lab/hdalab/",
+ 'src':"/Users/ymh/dev/tmp/testfab/src",
+ 'virtualenv':"/iridata/virtualenv/hdalab2",
+ 'build_export':"/iridata/users/iri/tmp/build",
+ 'venv_export':"/iridata/users/iri/tmp/venv",
+}
+
+env.platform_web_module = "hdalab"
+env.remote_baseline_venv = "/iridata/virtualenv/baseline2.7"
+
+env.rsync_filters = {
+ 'src' : [
+ "P .htpasswd",
+ "P .htaccess",
+ "P hdalab/config.py",
+ ],
+ 'web': [
+ "+ core",
+ "P .htpasswd",
+ "P .htaccess",
+ "P robots.txt",
+ "P env/***",
+ "P log/***",
+ "P index/***",
+ "P static/media/***",
+ "P crossdomain.xml",
+ ],
+ 'venv': [
+ "+ core",
+ ]
+}
+env.web_relaunch_cmd = "supervisorctl restart hdalab2"
+
+
+env.config = {
+ 'web': {
+ 'base_url': "/hdalab/",
+ 'web_url': 'http://labs.iri-research.org',
+ 'db_engine':'postgresql_psycopg2',
+ 'db_name':'hdalab',
+ 'db_user': 'iriuser',
+ 'db_password': '',
+ 'db_host': 'sql.iri.centrepompidou.fr',
+ 'db_port': 5432,
+ 'log_file' : env.remote_path['web'] + '/log/log.txt',
+ 'secret_key' : ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]),
+ },
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbin/sync/fabfile.py Mon Nov 10 11:46:27 2014 +0100
@@ -0,0 +1,91 @@
+import imp
+import os.path
+
+from fablib import (export_version, do_sync_web, create_config,
+ clean_export_folder, do_sync_comp, sync_install_build, do_create_virtualenv,
+ clean_rsync_folder, rsync_export, get_comp_versions_dict, SyncComp,
+ do_relaunch_server)
+from fabric.api import task, env
+from fabric.colors import green
+from fabric.tasks import execute
+
+import config # @UnusedImport
+
+
+@task
+def relaunch_server(do_collectstatic=True, do_syncdb=True, do_check_folder_access=True):
+ print("Relaunch server")
+ do_relaunch_server(do_collectstatic, do_syncdb, env.get('check_folder_access',do_check_folder_access))
+
+@task
+def sync_web(version):
+ print(green("sync web with version %s" % version))
+ export_path = export_version(web=version)
+ export_path_full = os.path.join(export_path,'web')
+ do_sync_web(version, export_path_full)
+ create_config(export_path_full)
+ clean_export_folder(export_path)
+ relaunch_server()
+
+@task
+def update_lib(version, package):
+ print(green("update %s with version %s" % (package,version)))
+ export_path = export_version(web=version)
+ export_path_full = os.path.join(export_path,'web')
+ lib_path = os.path.join(export_path_full, "virtualenv", "res", "lib")
+
+ f, pathname, description = imp.find_module("patch", [lib_path])
+ imp.load_module("patch", f, pathname, description)
+ f, pathname, description = imp.find_module("lib_create_env", [lib_path])
+ lib_create_env = imp.load_module("lib_create_env", f, pathname, description)
+
+ package_path_full = os.path.join(export_path_full, "virtualenv", "res", "src", lib_create_env.URLS[package]['local'])
+
+ sync_install_build(package_path_full)
+ clean_export_folder(export_path)
+ relaunch_server()
+
+@task
+def sync_platform(version):
+ print(green("sync hdalab with version web %s" % (version)))
+ export_path = export_version(web=version)
+
+ export_path_web = os.path.join(export_path,'web')
+ do_sync_web(version, export_path_web)
+
+ comp_versions = get_comp_versions_dict(export_path_web)
+
+ for key in [k for k in env.repos if k != 'web']:
+ export_path_key = export_version(**{key: comp_versions[key]})
+ export_path_comp = os.path.join(export_path_key, key)
+ do_sync_comp(key, export_path_comp)
+ clean_export_folder(export_path_key)
+
+ create_config(export_path_web)
+ clean_export_folder(export_path)
+ relaunch_server()
+
+@task
+def create_virtualenv(version, add_dep='no'):
+ print(green("create virtualenv with version %s" % version))
+ export_path = export_version(web=version)
+ export_path_web = os.path.join(export_path,'web')
+ venv_remote_export_path = ""
+ try:
+ virtualenv_path = os.path.join(export_path_web, "virtualenv")
+
+ venv_remote_export_path = os.path.join(env.remote_path['venv_export'], env.export_prefix, version,"virtualenv")
+ rsync_export(virtualenv_path, venv_remote_export_path, env.rsync_filters['venv'])
+ do_create_virtualenv(venv_remote_export_path, env.remote_path['virtualenv'])
+
+ if add_dep and add_dep.lower()[0] == 'y':
+ for sync_name in [key for key in env.repos if key != 'web']:
+ execute("sync_"+sync_name, version)
+ finally:
+ clean_export_folder(export_path)
+ if venv_remote_export_path:
+ clean_rsync_folder(venv_remote_export_path)
+
+
+for sync_name in [key for key in env.repos if key != 'web']:
+ globals()[sync_name] = SyncComp(sync_name)
--- a/sbin/sync/sync_hdalab Fri Nov 07 16:33:06 2014 +0100
+++ b/sbin/sync/sync_hdalab Mon Nov 10 11:46:27 2014 +0100
@@ -9,7 +9,7 @@
#text2unix ~/tmp/hdalab_V$1
if [ -d ~/tmp/hdalab_V$1 ]; then
- cat <<EOT | rsync -Cvrlz --delete --filter=". -" ~/tmp/hdalab_V$1/web/ iri@web.iri.centrepompidou.fr:/iridata/www/iri-research/hdalab/
+ cat <<EOT | rsync -Cvrlz --delete --filter=". -" ~/tmp/hdalab_V$1/web/ iri@web.iri.centrepompidou.fr:/iridata/www/iri-research/labs/hdalab/
+ core
P .htpasswd
P hdalab/config.py
@@ -26,5 +26,5 @@
rm -fr ~/tmp/hdalab_V$1;
fi
-ssh iri@web.iri.centrepompidou.fr "export PYTHONPATH=/iridata/www/iri-research/hdalab && source /iridata/virtualenv/hdalab/bin/activate && cd /iridata/www/iri-research/hdalab/hdalab && django-admin.py collectstatic --noinput"
+ssh iri@web.iri.centrepompidou.fr "export PYTHONPATH=/iridata/www/iri-research/labs/hdalab && source /iridata/virtualenv/hdalab2/bin/activate && cd /iridata/www/iri-research/labs/hdalab/hdalab && django-admin.py collectstatic --noinput"
ssh iri@web.iri.centrepompidou.fr sudo apache2ctl restart
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hdalab/requirement.txt Mon Nov 10 11:46:27 2014 +0100
@@ -0,0 +1,1 @@
+renkanmanager (==0.8.0)
\ No newline at end of file