diff --git a/codalab/config/templates/freetds.conf b/codalab/config/templates/freetds.conf index 7d7ace0a1..511f1cb2e 100644 --- a/codalab/config/templates/freetds.conf +++ b/codalab/config/templates/freetds.conf @@ -1,10 +1,10 @@ [global] - tds version = 8.0 + tds version = 7.1 character set = UTF-8 [{{DB_SERVER}}] port = {{DB_PORT}} - tds version = 8.0 + tds version = 7.1 character set = UTF-8 host = {{DB_HOST}} encryption = required diff --git a/codalab/config/templates/odbc.ini b/codalab/config/templates/odbc.ini index eff887bdd..f07b71ed7 100644 --- a/codalab/config/templates/odbc.ini +++ b/codalab/config/templates/odbc.ini @@ -9,5 +9,5 @@ Database = {{DB_NAME}} UID = {{DB_USER}} PWD = {{DB_PASSWORD}} Port = {{DB_PORT}} -TDS_Version = 8.0 +TDS_Version = 7.1 diff --git a/codalab/config/templates/odbcinst.ini b/codalab/config/templates/odbcinst.ini index d64454142..c247b90be 100644 --- a/codalab/config/templates/odbcinst.ini +++ b/codalab/config/templates/odbcinst.ini @@ -1,5 +1,5 @@ [ODBC] -Trace = Yes +Trace = No TraceFile = /tmp/odbc-{{DB_NAME}}.log [FreeTDS] diff --git a/codalab/fabfile.py b/codalab/fabfile.py index 204649e8c..15206bae6 100644 --- a/codalab/fabfile.py +++ b/codalab/fabfile.py @@ -7,32 +7,51 @@ VENV_PATH = os.path.join(THIS_DIR,'venv') THIS_SETTINGS_DIR = os.path.join(THIS_DIR,'codalab','settings') +env.conf.DEPLOY_USER = 'wwwuser' +env.conf.DEPLOY_PATH = 'codalab_src' + def env_setup(config=env.CONFIG,settings_module='codalab.settings'): + if config is None: + sys.path.append('.') os.environ['DJANGO_CONFIGURATION'] = config - os.environ["DJANGO_SETTINGS_MODULE"]= settings_module + os.environ["DJANGO_SETTINGS_MODULE"] = settings_module + from fabric.contrib import django from configurations import importer importer.install() - from fabric.contrib import django + django.settings_module(settings_module) - from django.conf import settings + from django.conf import settings as django_settings - #env.roledefs = settings.DEPLOY_ROLES - env.django_settings = settings -env_setup() + env.roledefs = django_settings.DEPLOY_ROLES + env.django_settings = django_settings @task -def local(): +def local(**kwargs): env.run = lrun - + env_setup(**kwargs) + @task -def remote(): +def remote(**kwargs): env.run = run + env_setup(**kwargs) @task -def bootstrap_on_linux(): +def clone_repo(repo_url='https://github.com/codalab/codalab.git',path=env.conf.DEPLOY_PATH): + env.run('git clone %s %s' % (repo_url, path)) + +@task +def provision(config='Dev'): + clone_repo() + with cd(env.conf.DEPLOY_PATH): + sudo('/bin/bash codalab/scripts/provision %s' % env.conf.DEPLOY_USER) + sudo('python manage.py config_gen --configuration=%s' % config, + user=env.conf.DEPLOY_USER) + +@task +def bootstrap(): make_virtualenv(path='venv', system_site_packages=False) with virtualenv('venv'): run('pip install --upgrade pip') diff --git a/codalab/runserver b/codalab/runserver index b867092aa..83531ba3c 100755 --- a/codalab/runserver +++ b/codalab/runserver @@ -1,7 +1,12 @@ #!/bin/bash +THIS_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +pushd `pwd` > /dev/null +cd $THIS_DIR + source ./config/generated/startup_env.sh echo " .... " echo "$DJANGO_CONFIGURATION Configuration" echo " .... " -python manage.py runserver $1 $2 \ No newline at end of file +/bin/bash manage runserver "$@" +popd diff --git a/codalab/scripts/provision b/codalab/scripts/provision deleted file mode 100644 index dc9b0d96b..000000000 --- a/codalab/scripts/provision +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -## This will eventually be a bit more configurable - -THIS_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -pushd `pwd` > /dev/null -cd $THIS_DIR - -U=$1 - -if [[ "$U" == "" ]] ; then - echo "Specify user" - exit 1 -fi -if ! id -u "$U" > /dev/null; then - sudo useradd -m -s /bin/bash $U - sudo passwd $U - exit 1 -fi - -echo "Installing codalab dependency meta-package..." -sudo dpkg -i *.deb > /dev/null && \ -sudo apt-get -f install > /dev/null && \ -echo "Updaing some user permissions..." && \ -sudo chgrp -R www-data /var/log/nginx /var/lib/nginx && \ -sudo chmod -R g+rw /var/log/nginx /var/lib/nginx && \ -sudo usermod -a -G www-data $U - - diff --git a/codalab/scripts/ubuntu/provision b/codalab/scripts/ubuntu/provision index dc9b0d96b..9a4c0950c 100755 --- a/codalab/scripts/ubuntu/provision +++ b/codalab/scripts/ubuntu/provision @@ -3,27 +3,27 @@ ## This will eventually be a bit more configurable THIS_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -pushd `pwd` > /dev/null +pushd `pwd` 2>&1 > /dev/null cd $THIS_DIR U=$1 -if [[ "$U" == "" ]] ; then - echo "Specify user" - exit 1 -fi -if ! id -u "$U" > /dev/null; then - sudo useradd -m -s /bin/bash $U - sudo passwd $U +if [[ $U =~ [a-zA-Z0-9][\-\_a-zA-Z0-9]+[a-zA-Z0-9] ]] ; then + if ! id -u "$U" 2>&1 > /dev/null; then + echo "User will be added." + sudo useradd -m -s /bin/bash $U + sudo passwd $U + fi +else + echo "User not specified or username has bad characters" exit 1 fi echo "Installing codalab dependency meta-package..." sudo dpkg -i *.deb > /dev/null && \ sudo apt-get -f install > /dev/null && \ -echo "Updaing some user permissions..." && \ +echo "Updaing some group permissions..." && \ sudo chgrp -R www-data /var/log/nginx /var/lib/nginx && \ sudo chmod -R g+rw /var/log/nginx /var/lib/nginx && \ sudo usermod -a -G www-data $U - - +popd > /dev/null