/biocloudcentral

Easily launch CloudMan and CloudBioLinux clusters with no manual configuration

Primary LanguageCSS

Cloud Launch

Easily launch Galaxy, CloudMan, and CloudBioLinux platforms without any configuration. You can use this app directly on biocloudcentral.org or run it locally - either way, it takes about 2 minutes to go from nothing to a configured cluster-in-the-cloud and a scalable analysis platform on top of cloud resources.

Installing locally

This Django application can be run locally, on a dedicated server or deployed on Heroku. To run locally or on a dedicated server, start by installing Python and virtualenv. Then, build a virtualenv and install the dependencies:

$ mkdir cl; cd cl
$ virtualenv .
$ source bin/activate
$ git clone https://github.com/galaxyproject/cloudlaunch.git
$ cd cloudlaunch
$ pip install -r requirements.txt

Next, you need to make a database available. For local development and deployment, SQLite will suffice. To use it, simply copy file biocloudcentral/settings_local.py.sample to biocloudcentral/settings_local.py and proceed with the database migrations step below:

$ cp biocloudcentral/settings_local.py.sample biocloudcentral/settings_local.py
$ mkdir biocloudcentral/db

Applying database migrations

Finally, apply the database migrations, and, optionally, preload your database with the details about AWS instances. When prompted, there is no requirement to create a super-user account when asked. However, it may be desirable to be able to log into the Admin side of the app:

$ python biocloudcentral/manage.py syncdb
$ python biocloudcentral/manage.py migrate biocloudcentral
$ python biocloudcentral/manage.py migrate djcelery
$ python biocloudcentral/manage.py migrate kombu.transport.django
$ python biocloudcentral/manage.py loaddata biocloudcentral/aws_db_data.json

Running locally

Simply run:

$ honcho -f ProcfileHoncho start

The application will be available on port 5000 (127.0.0.1:5000).

Alternatively, you start the web server and the Celery workers in two separate tabs (or screen sessions):

$ python biocloudcentral/manage.py runserver
$ python biocloudcentral/manage.py celeryd --concurrency 2 --loglevel=info

In this case, the application will be available on localhost on port 8000 (http://127.0.0.1:8000).

Deploying to Heroku

An instance of this app available at biocloudcentral.org is hosted on Heroku. You can do the same by registering and deploying the app under your own account. To get started, add heroku as a remote repository:

$ git remote add heroku git@heroku.com:biocloudcentral.git

Then, automatically push to Heroku for live deployment:

$ git push heroku master

If the database needs migration, run:

$ heroku run python biocloudcentral/manage.py migrate

Configuring on a dedicated production server

  • Launch a Ubuntu 14.04 instance or a VM

  • Install necessary system packages:

      $ sudo apt-get -y install python-virtualenv git postgresql libpq-dev postgresql-server-dev-all python-dev nginx
    
  • Clone Cloud Launch into a local directory (e.g., /srv/cloudlaunch) as system user launch and install the required libraries:

      $ sudo mkdir -p /srv/cloudlaunch
      $ sudo chown launch:launch /srv/cloudlaunch
      $ cd /srv/cloudlaunch
      $ virtualenv .cl
      $ source .cl/bin/activate
      $ git clone https://github.com/galaxyproject/cloudlaunch.git
      $ cd cloudlaunch
      $ pip install -r requirements.txt
    
  • Configure a PostgreSQL server with a database. Note that the following commands use launch as the database owner. If you prefer to use a different user, change it in both commands:

      $ sudo su postgres -c "psql --port 5432 -c \"CREATE ROLE launch LOGIN CREATEDB PASSWORD 'password_to_change'\""
      $ sudo su launch -c "createdb --username launch --port 5432 cloudlaunch"
    
  • Update settings in biocloudcentral/settings.py to match your server settings:

    • Edit the database settings to point to the installed Postgres DB. These must match the username, port, and password from the previous two commands. Delete or comment out any other DATABASE fields in the file.

        DATABASES = {
            'default': {
                'ENGINE': 'django.db.backends.postgresql_psycopg2',
                'NAME': 'cloudlaunch',
                'USER': 'launch',
                'PASSWORD': 'password_to_change',
                'HOST': 'localhost',
                'PORT': '5432',
            }
        }
      
    • Set DEBUG to False

    • Set admin users

    • Set REDIRECT_BASE to None

    • Set STATIC_ROOT to /srv/cloudlaunch/media (and create that dir, as launch user)

    • Set SESSION_ENGINE to django.contrib.sessions.backends.db

    • Change SECRET_KEY

  • Apply database migrations as per above section

  • Collect all static files into a single directory by running:

      $ cd /cl/cloudlaunch/cloudlaunch
      $ python biocloudcentral/manage.py collectstatic  # (type ``yes`` when prompted
      about rewriting existing files)
    
  • Create an empty log file that can be edited by the launch user

      $ sudo touch /var/log/cl_server.log
      $ sudo chown launch:launch /var/log/cl_server.log
    
  • Copy Upstart files (cl.conf and cl_celery.conf) to /etc/init

      $ sudo cp cl.conf cl_celery.conf /etc/init/.
    
  • Configure nginx:

    • If it exists, delete default site from /etc/nginx/sites-enabled (or update it as necessary)

        $ sudo rm /etc/nginx/sites-enabled/default
      
    • Copy the nginx config file from the Cloud Launch repo

        $ sudo cp cl_nginx.conf /etc/nginx/sites-available/
      
    • Create the following symlink

        $ sudo ln -s /etc/nginx/sites-available/cl_nginx.conf /etc/nginx/sites-enabled/cl
      
    • Optionally update the number of worker threads in /etc/nginx/nginx.conf

    • Test the nginx configuration with sudo nginx -t

    • Start sudo service nginx start or reload nginx: sudo nginx -s reload

  • Start the app services via Upstart:

      $ sudo service cl start
      $ sudo service cl_celery start
    
  • The app is now available at https://server.ip.address/. The Admin part of the app is available at https://server.ip.address/admin/.

LICENSE

The code is freely available under the MIT license.