Skip to content
bri25yu edited this page Nov 29, 2022 · 22 revisions

Quick links

If you are new to development, check out the Git tutorial.

If you are new to web development, check out the HTML and CSS tutorials.

If you are new to Django, check out the Django tutorial.

If you are new to hknweb, check out the Layout section and the Contribution Procedure page.

If you are maintaining hknweb, check out the Deployment and Production maintenance sections and the Miscellaneous page.

For more information, contact [email protected].

Layout

Where can I find what I'm looking for?

Path Description
.github/workflows Github actions config
config General non-python hknweb config files
keyrings/live GPG keyring, for authorizing access to encrypted secrets (Production Server Only)
LICENSE Legal license: open source, enforced by law
bbtest.txt.gpg blackbox test file
fabfile.py Fabric deployment scripts
manage.py Django task runner
pyproject.toml Project maintenance config
run The production run script

Production maintenance

Here are a few handy commands for maintainers:

# SSH into prod
ssh [email protected]

# cd into hknweb production
cd hknweb/prod/current

# Activate prod environment
conda activate hknweb-prod

# Open a Django shell
python manage.py shell

# Open a Django direct SQL database interface
python manage.py dbshell

Deployment

Our deployment pipeline deploys from compserv/master to OCF servers using fabfile.py.

# Activate our dev environment
conda activate hknweb-dev

# Depending on your ssh setup, this may or may not work for you:
HKNWEB_MODE="prod" fab deploy

# If your SSH key to the apphost requires a password to unlock:
HKNWEB_MODE="prod" fab --prompt-for-passphrase deploy

# If you have no SSH key to the apphost (shame on you), and require password authentication:
HKNWEB_MODE="prod" fab --prompt-for-login-password deploy

Rollback to Past Version

HKNWEB_MODE="prod" fab rollback --release <Timestamp of Folder>

where the <Timestamp of Folder> is the timestamp folder you want to rollback to in ~/hknweb/prod/releases/ (you don't need the full path, just the name of the specific folder inside the "releases" folder).

Credits

The documentation on this wiki is largely written by @jameszhu and @ochan1. Thanks for their efforts at making compserv renewable!

Clone this wiki locally