Skip to content

Commit

Permalink
Update deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-ni committed Sep 16, 2023
1 parent 7118ac2 commit a164a97
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 29 deletions.
1 change: 1 addition & 0 deletions config/deploy/prod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"deploy": {
"branch": "modernization",
"name": "prod",
"user": "hkn",
"host": "apphost.ocf.berkeley.edu",
Expand Down
1 change: 1 addition & 0 deletions config/systemd/hknweb.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Type=simple
Restart=always
PIDFile=/home/h/hk/hkn/hknweb/prod/current/gunicorn.pid
WorkingDirectory=/home/h/hk/hkn/hknweb/prod/current
Environment="HKNWEB_MODE=prod"
ExecStart=/home/h/hk/hkn/hknweb/prod/current/run
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
12 changes: 10 additions & 2 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TODO: Refactor or replace this file. It's kinda overengineered and fabric
# is terribly documented

import json
import os
import posixpath
Expand Down Expand Up @@ -100,12 +103,17 @@ def update(c: Connection):
print("-- Updating dependencies")
c.run("poetry install")

# Can't figure out how to properly set an env var with fabric
# so leaving them at the starts of the commands for now

print("-- Running migrations")
c.run("poetry run python manage.py migrate")
c.run(f"HKNWEB_MODE={hknweb_mode} poetry run python manage.py migrate")

if c.deploy.run_collectstatic:
print("-- Collecting static files")
c.run("poetry run python manage.py collectstatic --noinput")
c.run(
f"HKNWEB_MODE={hknweb_mode} poetry run python manage.py collectstatic --noinput"
)
else:
print("-- Skipping collecting static files")

Expand Down
150 changes: 124 additions & 26 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pillow = "^8.4.0"
django-markdownx = "^4.0.2"
bleach = "^4.1.0"
gunicorn = "^19.9.0"
fabric = "^2.6.0"
fabric = "^3.2.2"
social-auth-app-django = "^4.0.0"
django-autocomplete-light = "^3.9.4"
djangorestframework = "^3.11.0"
Expand Down

0 comments on commit a164a97

Please sign in to comment.