From: Bryan Bonvallet Date: Thu, 15 May 2014 03:07:48 +0000 (-0400) Subject: beginning heroku documentation X-Git-Tag: release-20150131~61 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=db8d1c8073b9204460d2606774f5f56f2482e01b;p=oweals%2Fkarmaworld.git beginning heroku documentation --- diff --git a/.env.example b/.env.example index 294407a..78d7bf2 100644 --- a/.env.example +++ b/.env.example @@ -1,19 +1,24 @@ -DATABASE_URL= -GOOGLE_CLIENT_SECRETS= -GOOGLE_USER= -GOOGLE_SERVICE_KEY_BASE64= -FILEPICKER_API_KEY= -FILEPCIKER_SECRET= -INDEXDEN_PRIVATE_URL= -INDEXDEN_INDEX= -DEFAULT_FILE_STORAGE= -AWS_ACCESS_KEY_ID= -AWS_SECRET_ACCESS_KEY= -AWS_STORAGE_BUCKET_NAME= -CLOUDFRONT_URL= -CLOUDFRONT_DOMAIN= -TWITTER_CONSUMER_KEY= -TWITTER_CONSUMER_SECRET= -TWITTER_ACCESS_TOKEN_KEY= -TWITTER_ACCESS_TOKEN_SECRET= -MTURK_HOST= +DATABASE_URL='postgres://:@:/' + +GOOGLE_CLIENT_SECRETS='{"web": {"json": "goes here"} }' +GOOGLE_USER='GoogleApps@Email.Address' +GOOGLE_SERVICE_KEY_BASE64='Base64EncodedP12FileContentsGoHere' + +FILEPICKER_API_KEY='NonSeNsEAscIi' +FILEPICKER_SECRET='MORENONSENSEASCII' + +INDEXDEN_PRIVATE_URL='https://:@.api.indexden.com' +INDEXDEN_INDEX='index_name' + +DEFAULT_FILE_STORAGE='storages.backends.s3boto.S3BotoStorage' +AWS_ACCESS_KEY_ID='ASCIINONSENSE' +AWS_SECRET_ACCESS_KEY='AlphaNumerics+OtherCharacters' +AWS_STORAGE_BUCKET_NAME='bucket_name' +CLOUDFRONT_URL='' +CLOUDFRONT_DOMAIN='' +MTURK_HOST='' + +TWITTER_CONSUMER_KEY='' +TWITTER_CONSUMER_SECRET='' +TWITTER_ACCESS_TOKEN_KEY='' +TWITTER_ACCESS_TOKEN_SECRET='' diff --git a/README.heroku b/README.heroku new file mode 100644 index 0000000..562cf9e --- /dev/null +++ b/README.heroku @@ -0,0 +1,18 @@ +Checkout the karmanotes repository locally. + +Create Heroku app from either the web interface or the CLI. See Heroku documentation for more information. + +From the settings page for the Heroku app, find the Git URL and copy it. + +Install the Heroku CLI. Make sure to configure the Heroku CLI tool with `heroku login`. + +In the karmanotes repository: +`git remote add my-heroku-dev git@heroku.com:.git` + +Create a Heroku database either from the web interface or the CLI. Look for the Dev Plan (its free). Once created, keep track of its connection settings for the configuration step. + +Configure the application by copying `${project_root}/.env.example` to `${project_root}/.env` and edit it appropriately for all external dependencies. + +Push the configuration to Heroku by running the handy script. `python export_env_to_heroku.py` + +Push the app to Heroku with git. `git push my-heroku-dev master` diff --git a/export_env_to_heroku.py b/export_env_to_heroku.py new file mode 100644 index 0000000..2f91065 --- /dev/null +++ b/export_env_to_heroku.py @@ -0,0 +1,19 @@ +import subprocess + +def export_env(filename='.env'): + data=['heroku', 'config:set'] + with open(filename, 'r') as config: + for line in config.readlines(): + # ignore whitespace padding + line.strip() + tmp = line.split('=') + # further ignore whitespace padding that was around the = + tmp = map(str.strip, tmp) + # check for nonempty variable and content + if len(tmp) == 2 and len(tmp[0]) and len(tmp[1]): + data.append('{0}={1}'.format(*tmp)) + return subprocess.check_call(data) + +if __name__ == '__main__': + import sys + sys.exit(export_env('.env.example'))