Headcount is a web application for RIT's
Software Engineering department that allows labbies to
take headcounts in the team rooms and the Co-Lab. It is built using Python 3,
Flask, and uWSGI. It's also designed to work on OpenBSD with Reyk Floeter's
httpd
by default.
Installation instructions are only provided for OpenBSD. It is just a uWSGI app, so installing it should be easy on other platforms.
- Create the user
_headcount
and group_headcount
. Set_headcount
's home directory to/usr/local/_headcount
- Install:
python%3.6
py3-pip
py3-virtualenv
xmlsec
- Change to the user
_headcount
- Create a Python virtualenv in
/usr/local/_headcount
. It should be calledhc-venv
. Activate the virtualenv. - Use
pip
to install therequirements.txt
file. - Clone github.com/pallets/flask.git
and run
setup.py install
. This is necessary because, for whatever reason, the Flask frompip
has a heart attack if you try the next command. cd
back to/usr/local/_headcount/Headcount/src
and initialize the application's database by executingFLASK_APP=headcount.py flask initdb
.- Add the primary administrator's username to the database by executing
FLASK_APP=headcount.py flask add_admin $ADMIN_NAME
- Change back to
root
- Copy
config/headcount.rc
to/etc/rc.d/headcount
- Edit /etc/rc.conf.local to add
headcount_flags="/usr/local/_headcount/Headcount/config/headcount-uwsgi.ini"
andpkg_scripts="httpd headcount"
Here is a suggested httpd
configuration:
ext_addr="egress"
server "headcount.se.rit.edu" {
listen on $ext_addr port 80
location "/.well-known/acme-challenge/*" {
root "/acme"
root strip 2
}
location "/*" {
block return 301 "https://$SERVER_NAME$REQUEST_URI"
}
}
server "headcount.se.rit.edu" {
listen on $ext_addr tls port 443
tls certificate "/etc/ssl/acme/headcount.se.rit.edu.fullchain.pem"
tls key "/etc/ssl/acme/private/headcount.se.rit.edu.key"
location "/" {
block return 301 "https://$SERVER_NAME/index"
}
location "/*" {
fastcgi socket "/run/headcount.sock"
}
}
To update installed versions of pip
packages, switch into the virtualenv
and call pip install --upgrade -r requirements.txt
.
Enjoy!