forked from healthchecks/healthchecks
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Heroku compatibility and support scripts.
- Loading branch information
Showing
7 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn hc.wsgi --log-file - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "healthchecks", | ||
"website": "https://github.com/healthchecks/healthchecks", | ||
"keywords": ["heroku", "cron", "devops", "python", "monitoring", "cron-jobs"], | ||
"image": "heroku/python", | ||
"addons": [ | ||
"heroku-postgresql:hobby-dev", | ||
"mailgun:starter", | ||
"scheduler:standard" | ||
], | ||
"scripts": { | ||
"postdeploy": "python manage.py migrate" | ||
}, | ||
"env": { | ||
"SITE_ROOT": { | ||
"description": "Used to build fully qualified URLs for pings, and for use in emails and notifications. Enter your App Name defined above here.", | ||
"value": "https://appname.herokuapp.com" | ||
}, | ||
"PING_ROOT": { | ||
"description": "Used to build fully qualified URLs for pings. Will fall-back to SITE_ROOT above if undefined.", | ||
"required": false | ||
}, | ||
"SITE_NAME": { | ||
"description": "Used throughout the templates.", | ||
"value": "My Monitoring Project" | ||
}, | ||
"FROM_EMAIL": { | ||
"description": "Email from address.", | ||
"value": "noreply@example.com" | ||
}, | ||
"PING_EMAIL_DOMAIN": { | ||
"description": "Email domain used to received email pings.", | ||
"value": "example.com" | ||
}, | ||
"SECRET_KEY": { | ||
"generator": "secret" | ||
}, | ||
"ON_HEROKU": { | ||
"value": "yes" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# The post_compile hook is run by heroku-buildpack-python | ||
|
||
echo "-----> Custom post-compile hook" | ||
|
||
# Work around Heroku bug whereby pylibmc isn't available during | ||
# compile phase. See: https://github.com/heroku/heroku-buildpack-python/issues/57 | ||
export MEMCACHE_SERVERS='' MEMCACHIER_SERVERS='' | ||
|
||
if [ -f bin/install_nodejs ]; then | ||
echo "-----> Running install_nodejs" | ||
chmod +x bin/install_nodejs | ||
bin/install_nodejs | ||
|
||
if [ -f bin/install_less ]; then | ||
echo "-----> Running install_lessc" | ||
chmod +x bin/install_less | ||
bin/install_less | ||
fi | ||
fi | ||
|
||
if [ -f bin/run_collectstatic ]; then | ||
echo "-----> Running run_collectstatic" | ||
chmod +x bin/run_collectstatic | ||
bin/run_collectstatic | ||
fi | ||
|
||
if [ -f bin/run_compress ]; then | ||
echo "-----> Running run_compress" | ||
chmod +x bin/run_compress | ||
bin/run_compress | ||
fi | ||
|
||
echo "-----> Post-compile done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
indent() { | ||
RE="s/^/ /" | ||
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE" | ||
} | ||
|
||
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1) | ||
MANAGE_FILE=${MANAGE_FILE:2} | ||
|
||
echo "-----> Compressing static files" | ||
python $MANAGE_FILE compress 2>&1 | indent | ||
|
||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import os | ||
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
SITE_ROOT = os.getenv('SITE_ROOT', "https://my-monitoring-project.com") | ||
SITE_NAME = os.getenv('SITE_NAME', "My Monitoring Project") | ||
DEFAULT_FROM_EMAIL = os.getenv('FROM_EMAIL', "noreply@my-monitoring-project.com") | ||
PING_ENDPOINT = os.getenv('PING_ROOT', SITE_ROOT) + "/ping/" | ||
PING_EMAIL_DOMAIN = os.getenv('PING_EMAIL_DOMAIN', "example.com") | ||
|
||
import herokuify | ||
from herokuify.common import * | ||
from herokuify.mail.mailgun import * | ||
|
||
DATABASES = herokuify.get_db_config() | ||
|
||
DEBUG = False | ||
SECRET_KEY = os.getenv('SECRET_KEY', "---") | ||
|
||
# Allow all host headers | ||
ALLOWED_HOSTS = ['*'] | ||
|
||
# Simplified static file serving. | ||
# https://warehouse.python.org/project/whitenoise/ | ||
|
||
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' | ||
|
||
import sys | ||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': False, | ||
'formatters': { | ||
'verbose': { | ||
'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", | ||
'datefmt': "%d/%b/%Y %H:%M:%S" | ||
}, | ||
'simple': { | ||
'format': '%(levelname)s %(message)s' | ||
}, | ||
}, | ||
'handlers': { | ||
'console': { | ||
'level': 'DEBUG', | ||
'class': 'logging.StreamHandler', | ||
'formatter': 'verbose', | ||
'stream': sys.stdout, | ||
}, | ||
}, | ||
'loggers': { | ||
'django': { | ||
'handlers': ['console'], | ||
'propagate': True, | ||
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'), | ||
}, | ||
'django.request': { | ||
'handlers': ['console'], | ||
'level': 'ERROR', | ||
'propagate': False, | ||
}, | ||
'django.security': { | ||
'handlers': ['console'], | ||
'level': 'ERROR', | ||
'propagate': False, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters