Flask/Connexion based web application providing a hackspace status website and JSON frontend for spaceAPI.
- Mastodon (API permissions: read:accounts, write:statuses)
- Matrix
- Application not usable in multiprocess environment (gunicorn will work in threading mode)
Endpoint | Description |
---|---|
/ | rendered template from templates/home.html |
/status.json | Hackspace API JSON file |
/status-minimal.json | JSON file with state and state icon |
/static/{images,js,css}/{filename} | Files from static folder |
Endpoint | Description | Example |
---|---|---|
/api/v1/status | Set status Temperature Sensor could also be added. |
{ "sensors": { "people_now_present": [{ "value": 0, "names": [] }] }, "state": { "open": false, "lastchange": 1612387891, "message": "No devices connected" } } |
/api/v1/sensors/temperature | Set temperature sensors |
{ "sensors": { "temperature": [ { "value": 12.81, "unit": "°C", "location": "Hackspace" }, { "value": -6.44, "unit": "°C", "location": "Outside" } ] } } |
- git
- python3 (>=3.7, tested with 3.11)
- python3-venv
- see requirements.txt
- wheel
You should install this application using a dedicated user.
After your installation spacestatus-server serves on port 5000 on all interfaces. Configure your preferred http proxy (apache, nginx, traefik, ...) to allow access via http/https.
-
Install system requirements
sudo apt-get update sudo apt-get install python3-venv git
-
Create spacestatus user
sudo useradd --comment "Spacestatus" --create-home --user-group spacestatus
-
Change to spacestatus user
sudo su - spacestatus
-
Clone repository
git clone https://github.com/Bytespeicher/spacestatus-server
-
Initialize virtual environment
python3 -m venv virtualenv3
-
Install python requirements in virtual environment
. virtualenv3/bin/activate pip3 install wheel pip3 install -r spacestatus-server/requirements.txt pip3 install gunicorn deactivate
-
Copy example configuration files
cd ~/spacestatus-server cp config/config.example.yaml config/config.yaml cp config/apidata/status.example.org.json config/apidata/status.your-domain.org.json
-
Adjust configuration file config/config.yaml
-
Adjust space api json file config/apidata/status.your-domain.org.json
-
Copy systemd unit file
sudo cp /home/spacestatus/spacestatus-server/contrib/spacestatus-server.service /etc/systemd/system/spacestatus-server.service
-
Adapt /etc/systemd/system/spacestatus-server.service if service should not listen on all interfaces
-
Reload systemd daemon to reload unit file and start and enable service
sudo systemctl daemon-reload sudo systemctl enable spacestatus-server.service --now
-
Change to spacestatus user
sudo su - spacestatus
-
Update repository
cd spacestatus-server git pull
-
Update virtual environment
cd python3 -m venv --upgrade virtualenv3
-
Update python requirements in virtual environment
cd . virtualenv3/bin/activate pip3 install --upgrade wheel pip3 install --upgrade -r spacestatus-server/requirements.txt pip3 install --upgrade gunicorn deactivate
-
Adjust configuration file config/config.yaml
-
Restart systemd daemon
sudo systemctl restart spacestatus-server.service