Skip to content

Commit

Permalink
feat: änderungen für deployment zu heroku
Browse files Browse the repository at this point in the history
specify python version for heroku
update gunicorn conf for heroku
feat: add release file to do all the stuff
fix: webpack for heroku
feat: statisfiles via whitenoise for heroku
fix: downgrade elasticsearch to make it work with more clients
see:
https://stackoverflow.com/questions/68762774/elasticsearchunsupportedproducterror-the-client-noticed-that-the-server-is-no
  • Loading branch information
milafrerichs committed Aug 3, 2023
1 parent 5116764 commit da40cfa
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 149 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: gunicorn --config etc/gunicorn.conf.py meine_stadt_transparent.wsgi:application
release: ./manage.py migrate --no-input
release: ./etc/release.sh
5 changes: 4 additions & 1 deletion etc/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os

# The settings can be overwritten by mounting a differnt file into the docker container
access_logfile = "-"
bind = ":8000"
port = os.getenv('PORT', '8000')
bind = f"0.0.0.0:{port}"
capture_output = True
log_file = "-"
timeout = 60
Expand Down
2 changes: 2 additions & 0 deletions etc/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python ./manage.py compilemessages -l de -l en
python ./manage.py migrate --no-input
2 changes: 1 addition & 1 deletion meine_stadt_transparent/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
# https://docs.djangoproject.com/en/1.11/howto/static-files/

STATIC_URL = "/static/"
STATIC_ROOT = env.str("STATIC_ROOT", os.path.join(BASE_DIR, "static/"))
STATIC_ROOT = env.str("STATIC_ROOT", os.path.join(BASE_DIR, "staticfiles/"))

STATICFILES_DIRS = (
os.path.join(BASE_DIR, "mainapp/assets"),
Expand Down
1 change: 1 addition & 0 deletions meine_stadt_transparent/settings/nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"mainapp.functions.inject_accept_language.inject_accept_language",
"django.middleware.common.CommonMiddleware",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build:prod": "NODE_ENV=production webpack --config ./etc/webpack.config.prod.js",
"build:email": "mjml mainapp/assets/email/user-alert.mjml -o mainapp/templates/email/user-alert.html",
"watch": "NODE_ENV=dev webpack --config etc/webpack.config.dev.js --watch",
"watch:email": "mjml -w mainapp/assets/email/user-alert.mjml -o mainapp/templates/email/user-alert.html"
"watch:email": "mjml -w mainapp/assets/email/user-alert.mjml -o mainapp/templates/email/user-alert.html",
"heroku-postbuild": "./node_modules/.bin/webpack --config ./etc/webpack.config.prod.js"
},
"author": "Konstantin Schütze, Tobias Hößl",
"license": "MIT",
Expand Down
253 changes: 110 additions & 143 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.8"
python = "3.9.17"
Django = ">=4.1.1,<4.2.0"
PyPDF2 = { version = "^3.0.0", extras = ["crypto"] }
Wand = "^0.6.0"
Expand All @@ -32,7 +32,7 @@ django-simple-history = "^3.0"
django-webpack-loader = "1.8.0"
django-widget-tweaks = "^1.4"
django_csp = "^3.4"
elasticsearch = "7.17.9"
elasticsearch = "<7.14.0"
elasticsearch-dsl = "^7.3"
geoextract = "^0.3.1"
geopy = "^2.0.0"
Expand All @@ -52,6 +52,7 @@ sentry-sdk = "^1.0.0"
splinter = "~0.19"
tqdm = "^4.29"
wagtail = "~4.2.1"
whitenoise = "~6.5.0"

[tool.poetry.dev-dependencies]
black = { version = "^23.3.0", extras = ["d"] }
Expand Down

0 comments on commit da40cfa

Please sign in to comment.