Skip to content

Commit 9578a16

Browse files
committed
add autodeploy
1 parent 773afbc commit 9578a16

File tree

738 files changed

+118
-19414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

738 files changed

+118
-19414
lines changed

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: python manage.py collectstatic --no-input; python manage.py migrate; gunicorn app.wsgi --log-file -

README.md

+1

app.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Silverback",
3+
"description": "A Status and Incident Communication Tool",
4+
"repository": "https://github.com/silverbackhq/silverback",
5+
"website": "https://github.com/silverbackhq",
6+
"logo": "https://silverbackhq.org/logo.png",
7+
"keywords": ["silverback", "silverbackhq", "status-page", "incident-management", "chatops", "statuspage", "application-monitoring", "cachet"],
8+
"success_url": "/",
9+
"env": {
10+
"APP_ENVIRONMENT": "heroku",
11+
"DISABLE_COLLECTSTATIC": "0",
12+
"APP_DEBUG": "false",
13+
"DB_CONNECTION": "sqlite",
14+
"DB_HOST": "127.0.0.1",
15+
"DB_PORT": "3306",
16+
"DB_DATABASE": "silverback",
17+
"DB_USERNAME": "root",
18+
"DB_PASSWORD": "secret",
19+
"ALLOWED_HOSTS": "*",
20+
"SECRET_KEY": {
21+
"description": "A secret key for verifying the integrity of signed cookies.",
22+
"generator": "secret"
23+
}
24+
},
25+
"addons": [{
26+
"plan": "heroku-postgresql",
27+
"options": {
28+
"version": "9.5"
29+
}
30+
}]
31+
}

app/settings/basic.py

+20-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# Standard Library
1313
import os
1414
import time
15+
import os.path
1516

1617
# Third Party Library
1718
from dotenv import load_dotenv
@@ -21,7 +22,11 @@
2122
from app.settings.info import APP_ROOT
2223

2324

24-
load_dotenv(dotenv_path=os.path.join(APP_ROOT, ".env"))
25+
if os.getenv("APP_ENVIRONMENT", "") != "heroku":
26+
if os.path.exists(os.path.join(APP_ROOT, ".env")):
27+
load_dotenv(dotenv_path=os.path.join(APP_ROOT, ".env"))
28+
else:
29+
load_dotenv(dotenv_path=os.path.join(APP_ROOT, ".env.example"))
2530

2631
# Quick-start development settings - unsuitable for production
2732
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
@@ -55,6 +60,7 @@
5560
'django.contrib.auth.middleware.AuthenticationMiddleware',
5661
'django.contrib.messages.middleware.MessageMiddleware',
5762
'django.middleware.clickjacking.XFrameOptionsMiddleware',
63+
'whitenoise.middleware.WhiteNoiseMiddleware',
5864
'app.middleware.correlation.Correlation',
5965
'app.middleware.api_funnel.APIFunnel',
6066
'app.middleware.web_funnel.WebFunnel',
@@ -132,13 +138,22 @@
132138
'HOST': os.getenv("DB_HOST"),
133139
'PORT': os.getenv("DB_PORT"),
134140
}
141+
142+
elif os.getenv("DB_CONNECTION") == "postgresql":
143+
default_db = {
144+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
145+
'NAME': os.getenv("DB_DATABASE"),
146+
'USER': os.getenv("DB_USERNAME"),
147+
'PASSWORD': os.getenv("DB_PASSWORD"),
148+
'HOST': os.getenv("DB_HOST"),
149+
'PORT': os.getenv("DB_PORT"),
150+
}
135151
else:
136152
default_db = {
137153
'ENGINE': 'django.db.backends.sqlite3',
138154
'NAME': os.path.join(APP_ROOT + "/storage/database/", 'db.sqlite3')
139155
}
140156

141-
142157
DATABASES = {
143158
'default': default_db
144159
}
@@ -254,9 +269,9 @@
254269
# https://docs.djangoproject.com/en/2.0/howto/static-files/
255270
STATIC_URL = '/static/'
256271

257-
STATICFILES_DIRS = [
258-
APP_ROOT + STATIC_URL
259-
]
272+
STATIC_ROOT = APP_ROOT + STATIC_URL
273+
274+
STATICFILES_DIRS = [APP_ROOT + "/assets"]
260275

261276
LOCALE_PATHS = [
262277
APP_ROOT + "/translation/"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)