adage/adage/config-template.py
# This file contains all deploy-time configuration parameters, including
# passwords. DO NOT check in your changes when deploying! The deployment
# scripts (see fabfile.adage-server.pull) will extract just the section needed
# for deployment and upload that to the server.
#
# To find all paramaters you need to specify, search on regex: <config[^>]*>
# and replace with values tailored to your deployment.
import random
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
REPO_ROOT = os.path.dirname(BASE_DIR)
# AWS credentials and configuration
AWS_DEPLOY = {
'aws_access_key_id': '<config-secret>',
'aws_secret_access_key': '<config-secret>',
'region_name': 'us-east-1',
# 'dbmaster' holds credentials for the RDS instance used on AWS
'dbmaster': {
# Database user with CREATE DATABASE & ROLE privileges.
# These are used to bootstrap a new database as specified in
# CONFIG['databases']['default']
'NAME': 'adage_db',
'USER': 'adage_db',
'PASSWORD': '<config-secret>',
'HOST': '<configure>',
'PORT': '5432',
},
'ec2_params': {
'ImageId': 'ami-4f680658', # Ubuntu 16.04
'MinCount': 1, 'MaxCount': 1,
'KeyName': '<configure>',
'SecurityGroups': ['<configure>'],
'InstanceType': 't2.small',
},
'host_conn': {
# this user needs sudo privilege
# root user privs are used to create a new user
# for hosting code as specified in OS_CONFIG
'host': '<configure>', # <-- our elastic IP address
'user': 'ubuntu',
'keyfile': '<configure>',
},
'deploy': {
# this key grants access to source code
'keyfile': '<configure>',
'keyfile_pub': '<configure>'
}
}
# configure the user account that will host the source code and build output
OS_CONFIG = {
'user': '<configure:default=adage>',
'host': None, # must be supplied at runtime!
'home_dir': '/home/<configure:default=adage>/',
'keyfile': '<configure>', # local file: used to login
'keyfile_pub': '<configure>' # local file: added to authorized_keys
}
# data for bootstrapping the database and testing
DATA_CONFIG = {
'data_dir': os.path.join(OS_CONFIG['home_dir'], 'adage-server', 'data'),
}
DATA_CONFIG.update({
'annotation_file': os.path.join(
DATA_CONFIG['data_dir'], 'PseudomonasAnnotation.tsv'),
'activity_file': os.path.join(
DATA_CONFIG['data_dir'], 'sample_signature_activity.txt'),
'pao1_genes_url': 'ftp://ftp.ncbi.nih.gov/gene/DATA/GENE_INFO/Archaea_Bacteria/Pseudomonas_aeruginosa_PAO1.gene_info.gz', # noqa
'pao1_genes_file': os.path.join(
DATA_CONFIG['data_dir'], 'Pseudomonas_aeruginosa_PAO1.gene_info'),
'gene_history_url': 'ftp://ftp.ncbi.nih.gov/gene/DATA/gene_history.gz',
'gene_history_file': os.path.join(DATA_CONFIG['data_dir'], 'gene_history'),
'gene_network_file': os.path.join(
DATA_CONFIG['data_dir'], 'gene_gene_network_cutoff_0.2.txt.gz'),
'signature_gene_network_file': os.path.join(
DATA_CONFIG['data_dir'], 'signature_gene_network.txt'),
'gene_sample_expr_file': os.path.join(
DATA_CONFIG['data_dir'], 'all-pseudomonas-gene-normalized.pcl')
})
# deployment server credentials and configuration (for AWS)
AWS_CONFIG = {
# Set up some parameters for deployment
'os': OS_CONFIG,
'repo': 'git@github.com:greenelab/adage-server.git',
'data': DATA_CONFIG,
'host_conn': AWS_DEPLOY['host_conn'],
'virt_env': OS_CONFIG['home_dir'] + '.virtualenvs/adage',
'django_dir': os.path.join(OS_CONFIG['home_dir'],
'adage-server', 'adage'),
'django_super': '<configure:desc=superuser>',
'django_email': '<configure:desc=superuser_email>',
'interface_dir': os.path.join(
OS_CONFIG['home_dir'], 'adage-server', 'interface'),
'dbmaster': AWS_DEPLOY['dbmaster'],
# The following keys are all that are needed for runtime use:
# django_key, databases, haystack,
# tribe_{id, secret, redirect_uri, scope, login_redirect, logout_redirect}
'django_key': '<config-secret>',
'databases': {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
# database name and user cannot have upper case letters
'NAME': '<configure>',
'USER': '<configure>',
'PASSWORD': '<config-secret>',
'HOST': AWS_DEPLOY['dbmaster']['HOST'],
'PORT': AWS_DEPLOY['dbmaster']['PORT'],
}
},
'haystack': {
'default': {
'ENGINE': 'adage.search_backend.CustomElasticsearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
}
},
'ga_code': '<google-analytics-code>', # Google Analytics code
# configure the following section to enable sign-in via Tribe's OAuth2
'tribe_id': '<configure:ClientIDHere>',
'tribe_secret': '<config-secret:ClientSecretHere>',
'tribe_redirect_uri': '<configure:http://example.com/tribe_client/get_token>', # noqa
'tribe_scope': 'write',
'tribe_login_redirect': '/#/home',
'tribe_logout_redirect': '/#/home',
'public_geneset_folder': os.path.join(
OS_CONFIG['home_dir'], 'adage-server', 'data')
}
# development server deployment credentials and configuration (maybe on VMware)
DEV_CONFIG = AWS_CONFIG.copy()
DEV_CONFIG.update({
'repo': '<configure>',
'dbmaster': {
# database user with CREATE DATABASE & ROLE privs
# these are used to bootstrap a new database as
# specified in CONFIG['databases']['default']
'NAME': '<configure>',
'USER': '<configure>',
'PASSWORD': '<config-secret>',
'HOST': '<configure>',
'PORT': '5432',
},
'host_conn': { # this user needs sudo privilege
'host': '<configure>',
'user': '<configure:default=ubuntu>',
'keyfile': '<configure>',
},
'databases': {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
# database name and user cannot have upper case letters
'NAME': '<configure>',
'USER': '<configure>',
'PASSWORD': '<config-secret>',
'HOST': '<configure>',
'PORT': '5432',
}
},
})
# Configuration for CI services
CI_CONFIG = AWS_CONFIG.copy()
CI_CONFIG.update({
'django_dir': os.path.join(REPO_ROOT, 'adage'),
'django_key': str(random.randint(0, 1000000)),
'interface_dir': os.path.join(REPO_ROOT, 'interface'),
'data': {
'data_dir': os.path.join(REPO_ROOT, 'data'),
'annotation_file': os.path.join(
REPO_ROOT, 'data', 'PseudomonasAnnotation.tsv')
}
})
CIRCLECI_CONFIG = CI_CONFIG.copy()
CIRCLECI_CONFIG.update({
'databases': {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'circleci_test',
'USER': 'ubuntu',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '5432'
}
},
})
DOCKER_DEV = CIRCLECI_CONFIG.copy()
DOCKER_DEV.update({
'databases': {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'docker_adage',
'USER': 'docker_adage',
'PASSWORD': 'password123',
'HOST': 'db',
'PORT': '5432'
}
},
'haystack': {
'default': {
'ENGINE': 'adage.search_backend.CustomElasticsearchEngine',
'URL': 'elasticsearch',
'INDEX_NAME': 'haystack',
}
},
# Tribe-client settings - the folder where pickled genesets will
# be stored.
'public_geneset_folder': '../data/'
})
# now that each config is defined, specify which one to use
CONFIG = AWS_CONFIG