Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • commul/oetzit
1 result
Show changes
Commits on Source (74)
Showing
with 2585 additions and 698 deletions
minio_data
postgres_data
.gitsecret/keys/random_seed
!*.secret
backend/k8s/overlays/stg/*.secrets.env
backend/k8s/overlays/prd/*.secrets.env
k8s/base/dockerconfigjson.secret.yaml
k8s/overlays/stg/*.secret.env
k8s/overlays/prd/*.secret.env
butler
butler.zip
......@@ -9,4 +13,3 @@ butler.zip
libc7zip.so
Makefile.env
kubeconfig.yml
......@@ -13,8 +13,6 @@ stages:
.node-job: &node-job
image: node:16-alpine
# tags:
# - shared
only:
- pushes
......@@ -68,9 +66,9 @@ app-tagger-job:
GIT_STRATEGY: clone
GIT_DEPTH: 0
script:
- APP_VERSION=$(git describe --tags)
- echo Detected app version ${APP_VERSION}
- echo "APP_VERSION=$APP_VERSION" >> build.env
- GIT_DESCRIPTOR=$(git describe --tags --always)
- echo Detected app version ${GIT_DESCRIPTOR}
- echo "APP_VERSION=${GIT_DESCRIPTOR#v}" >> build.env
artifacts:
reports:
dotenv: build.env
......@@ -216,9 +214,6 @@ stg-be-build-job:
.fe-deploy-job:
image: alpine:latest
stage: deploy
# tags:
# - shared
# - commul # NOTE: we used to require commul because extended seccomp policies are needed
before_script:
- ./ci/install-butler-on-alpine.sh
script:
......@@ -264,18 +259,11 @@ stg-fe-deploy-job:
#--[ Backend ]------------------------------------------------------------------
.be-deploy-job:
image: alpine:latest
stage: deploy
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE/backend
before_script:
- ./ci/install-kubectl-on-alpine.sh
script:
- kubectl set image deployment/${K8S_DEPLOYMENT} oetzit=${IMAGE_NAME}:${APP_VERSION} --namespace=${K8S_NAMESPACE}
prd-be-deploy-job:
extends: .be-deploy-job
stage: deploy
image:
name: bitnami/kubectl:latest
entrypoint: [""]
needs:
- app-tagger-job
- job: prd-be-build-job
......@@ -283,15 +271,21 @@ prd-be-deploy-job:
environment:
name: production/backend
deployment_tier: production
url: https://kommul.eurac.edu/oetzit
variables:
K8S_NAMESPACE: kommul
K8S_DEPLOYMENT: oetzit-webserver-deployment
url: https://lt.eurac.edu/oetzit/backend/
script: >-
kubectl set image
deployment/webserver-deployment
webserver=re.eurac.edu/${CI_PROJECT_PATH}/backend:${APP_VERSION}
--namespace=prd-oetzit
--kubeconfig=${PRD_KUBECONFIG}
only:
- tags
stg-be-deploy-job:
extends: .be-deploy-job
stage: deploy
image:
name: bitnami/kubectl:latest
entrypoint: [""]
needs:
- app-tagger-job
- job: stg-be-build-job
......@@ -299,9 +293,12 @@ stg-be-deploy-job:
environment:
name: staging/backend
deployment_tier: staging
url: https://kommul-dev.eurac.edu/oetzit
variables:
K8S_NAMESPACE: kommul-dev
K8S_DEPLOYMENT: oetzit-webserver-deployment
url: https://lt-dev.eurac.edu/oetzit/backend/
script: >-
kubectl set image
deployment/webserver-deployment
webserver=re.eurac.edu/${CI_PROJECT_PATH}/backend:${APP_VERSION}
--namespace=stg-oetzit
--kubeconfig=${STG_KUBECONFIG}
only:
- development
backend/k8s/overlays/stg/database.secrets.env:20315cecd8ffc0b934acfdd6fc7b5c8761a9f7324f61b22df655e9897f97df62
backend/k8s/overlays/prd/database.secrets.env:21029ab07d6110a9bfc1b641bb921c7cd6344a4894f87033a79bc9b1955644df
Makefile.env
kubeconfig.yml
backend/k8s/overlays/prd/dashboard.secrets.env
backend/k8s/overlays/stg/dashboard.secrets.env
Makefile.env:89a8042a354f14d5a7ba195dfb83a825d16beb30a4c4deea4260c25dcb410e7f
k8s/base/dockerconfigjson.secret.yaml:0e55595cd51cf962335cabd2161ba30048c62653445ea0dc2977cba9c62e3caa
k8s/overlays/stg/dashboard.secret.env:843914b560755e5c838ff8c8ce04be22bcd48aa27c80ae235f8d5bdcd04dcd2a
k8s/overlays/stg/database.secret.env:2123b16a96497067d950300624cb44fd3983333e2fb4ed72499a276014cd9478
k8s/overlays/stg/storage.secret.env:b2a28a4630941ff626e6056b602dc1dbeb14caddf441b08557dbf5e5507a49c7
k8s/overlays/prd/dashboard.secret.env:e6a6e1c9f4176b20768133b08afdda90cb9ce6c06a630a2c83c74b769c6f7a47
k8s/overlays/prd/database.secret.env:7f193f8194b521b1f1c6f9f2d149e578eee62c984252e902499c7c48eb710cab
k8s/overlays/prd/storage.secret.env:442fae2ddfc5c21eeed0cceea22f2b7c6d1062982ea3497867fbfca89b9eb80c
......@@ -7,6 +7,117 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.11.0] - 2022-11-16
### Changed
- Rebrand "Rewards" as "Register".
- Remove responsivity and hardcode sizes to bound load on old devices.
## [1.10.6] - 2022-10-04
### Fixed
- Delegate word API requests to scene in order to avoid scrambled events after game over.
- Spawner scene activity gates.
- Game over cleanup procedure.
## [1.10.5] - 2022-09-28
### Added
- Implement improved logging.
### Fixed
- Change hud check from activity to visibility.
- Clean up timers and tweens on game over.
## [1.10.4] - 2022-09-28
### Fixed
- Ensure `beDevice` is initialized before flashing rewards button.
## [1.10.3] - 2022-09-28
### Fixed
- Extend HUD inactivity checks.
## [1.10.2] - 2022-09-27
### Fixed
- Implement fallback storage for users disabling cookies.
- Switch (gradually) from `sessionStorage` to `localStorage`.
## [1.10.1] - 2022-09-27
### Fixed
- Crash occurring when changing/submitting input concurrently to game over.
## [1.10.0] - 2022-09-21
### Added
- Rewards: rephrase to improve clarity.
- Rewards: button flashes if email is missing
- Rewards: added links to forms.
## [1.9.1] - 2022-09-20
### Fixed
- Clean up TS checking in frontend.
## [1.9.0] - 2022-09-14
### Added
- Whip up competition dashboard.
## [1.8.1] - 2022-09-05
### Fixed
- Repair sample link in workshop leaderboard.
## [1.8.0] - 2022-09-05
### Added
- Add a leaderboard view to backoffice for usage in workshops.
## [1.7.0] - 2022-08-30
### Added
- Add status markers on dashboard distributions list.
- Add OCR confidence on dashboard distributions list.
## [1.6.0] - 2022-07-18
### Added
- Improved statisticts on dashboard (including entropy scores).
## [1.5.0] - 2022-06-21
### Added
- Implemented scraping/seeding script to fill database with transcriptions from Quack.
- Implemented scraping/seeding script to fill storage with images from Quack.
- MinIO setup for object storage in local development environment and k8s manifests.
### Changed
- Images are now fetched from object storage instead of database (via API).
- Clean up tag generation in CI/CD.
- Improve setup for local development.
- `word_id` is now a padded string instead of a number.
## [1.4.1] - 2022-05-30
### Fixed
......@@ -264,18 +375,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- POC by [Giovanni Moretti](https://www.giovannimoretti.it/).
[unreleased]: https://gitlab.inf.unibz.it/commul/oetzit/compare/1.4.1...development
[1.4.1]: https://gitlab.inf.unibz.it/commul/oetzit/compare/1.4.0...1.4.1
[1.4.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/1.3.0...1.4.0
[1.3.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/1.2.0...1.3.0
[1.2.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/1.1.0...1.2.0
[1.1.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/1.0.0...1.1.0
[1.0.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.7.0...1.0.0
[0.7.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.6.0...0.7.0
[0.6.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.5.0...0.6.0
[0.5.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.4.0...0.5.0
[0.4.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.3.0...0.4.0
[0.3.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.2.0...0.3.0
[0.2.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.1.0...0.2.0
[0.1.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/0.0.1...0.1.0
[unreleased]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.11.0...development
[1.10.6]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.10.6...v1.11.0
[1.10.6]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.10.5...v1.10.6
[1.10.5]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.10.4...v1.10.5
[1.10.4]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.10.3...v1.10.4
[1.10.3]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.10.2...v1.10.3
[1.10.2]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.10.1...v1.10.2
[1.10.1]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.10.0...v1.10.1
[1.10.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.9.1...v1.10.0
[1.9.1]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.9.0...v1.9.1
[1.9.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.8.1...v1.9.0
[1.8.1]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.7.0...v1.8.1
[1.8.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.7.0...v1.8.0
[1.7.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.6.0...v1.7.0
[1.6.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.5.0...v1.6.0
[1.5.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.4.1...v1.5.0
[1.4.1]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.4.0...v1.4.1
[1.4.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.3.0...v1.4.0
[1.3.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.2.0...v1.3.0
[1.2.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.1.0...v1.2.0
[1.1.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v1.0.0...v1.1.0
[1.0.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.7.0...v1.0.0
[0.7.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.6.0...v0.7.0
[0.6.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.5.0...v0.6.0
[0.5.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.4.0...v0.5.0
[0.4.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.3.0...v0.4.0
[0.3.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.2.0...v0.3.0
[0.2.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.1.0...v0.2.0
[0.1.0]: https://gitlab.inf.unibz.it/commul/oetzit/compare/v0.0.1...v0.1.0
[0.0.1]: https://gitlab.inf.unibz.it/commul/oetzit/tree/v0.0.1
File added
# Ötzit!
This is an Ötzi-themed typing webgame; its name is:
This is an Ötzi-themed typing webgame.
Its name is
- "**Ötzit!**" (human readable)
- "`oetzit`" (machine readable)
- spelled "**Ötzit!**" for humans,
- normalized as "`oetzit`" for machines,
- abbreviated as "`Ö!`" in logotypes.
## Backend
## Table of contents
- [Ötzit!](#ötzit)
- [Table of contents](#table-of-contents)
- [Quickstart](#quickstart)
- [Overview](#overview)
- [Backend](#backend)
- [Frontend](#frontend)
- [Seeding](#seeding)
- [Database](#database)
- [Storage](#storage)
- [Dumping](#dumping)
- [Database](#database-1)
- [K8s: deployment](#k8s-deployment)
## Quickstart
The backend is a `fastify` webserver exposing some APIs.
**NOTE:** Docker is (the only) prerequisite.
To spin it up for development,
This will let you run everything locally in ~5m:
```bash
cd backend
npm install
npm exec knex migrate:latest
npm exec knex seed:run
PORT=8080 npm run serve
docker-compose up -d
docker-compose run --rm cli
> npm exec knex migrate:latest
> PAGE_FILTER=ARBEI_19190109_001 npm exec knex seed:run
# now go to http://localhost:9001, log in as `minioadmin`/`minioadmin` and create a PUBLIC bucket named `words`
> PAGE_FILTER=ARBEI_19190109_001 npm exec ts-node src/quack/os_seeder.ts
> exit
docker-compose logs --follow
```
The webserver will be abailable at `http://localhost:8080`.
Now you can:
### Deployment
- go to http://localhost:1234 to play game
- go to http://localhost:8080 and log in as `admin`/`admin` to use the dashboard
- go to http://localhost:8080/api/doc to inspect API docs
- go to http://localhost:9001 and log in as `minioadmin`/`minioadmin` to inspect the storage
**NOTE:** currently we have `k8s 1.10.11` on cluster. This causes quite a few problems in reproducing the environment easily, mostly due to the fact that `1.10.11` schemas aren't around anymore and early versions of `minikube` are not easy to get.
You'll have to read the rest to figure out wth is going on.
### `dev`
## Overview
First you get the latest `minikube` up and running:
A working `oetzit` instance is composed of:
```bash
winget install minikibe
minikube start
- a `frontend` exposing the actual game interface to the user;
- a `backend` serving the `frontend` with APIs and exposing an administrative dashboard to the user;
- a relational database serving the `backend` (we're using PostgreSQL);
- an object storage serving the `frontend` (we're using MinIO).
Here is a dependency graph of the components:
```mermaid
flowchart LR;
F([Ö! frontend])-->B([Ö! backend])
B-->DB[PostgreSQL];
F-->OS[MinIO];
DB-.-OS;
```
Then you build the backend image and push it to the runtime cache of `minikube`:
Note that PostgreSQL and MinIO are not strictly dependent, but should be seeded together to guarantee the consistency of data.
This repo contains
- `/frontend/`: the code for the `frontend`
- `/backend/`: the code for the `backend`
- `/docker-compose.yml`: a Docker Compose blueprint to run all components (except `frontend`) in development;
- `/k8s/`: a collection of Kubernetes manifests to provision the architecture for staging and production;
- `/itch/`: the contents for the Itch.io page where the `frontend` is deployed;
- `/.gitlab-ci.yml`: the configuration file for out GitLab instance providing continuous builds and deployment.
## Backend
The `backend` is a webserver written in JS using `Fastify`.
It exposes some APIs for the `frontend` and an administrative dashboard with some statistics for the users.
It requires PostgreSQL to run, so for development it's better to use the provided Docker Compose blueprint:
```bash
docker build -t oetzit:latest backend/
minikube image load oetzit:latest
docker-compose up
```
Finally you apply the `dev` manifest and open a tunnel:
The webserver will then be available at `http://localhost:8080`.
You can spin up a `cli` container to run commands directly:
```bash
minikube kubectl -- apply -k backend/k8s/overlays/dev/
docker-compose run --rm cli
# do your thing in the container's shell
```
For your sanity, remember to open a tunnel and ensure the `ingress` is enabled:
## Frontend
The `frontend` is a webgame written in JS using Phaser.
To spin it up for development, install Node.js and
```bash
minikube addons enable ingress
minikube tunnel
cd frontend
npm install
npm run serve
```
That's it!
The webgame will be abailable at `http://localhost:1234`.
#### Tentatively reproducing the cluster
Since it's packaged with Parcel, it'll take care of most things automatically.
Our current cluster has `k8s 1.10.11`.
Note that to work properly it needs the `backend` (and MinIO) -- that's taken care of by the provided Docker Compose blueprint, see the [Backend](#backend) section.
The earliest `minikube` available via `choco` reaches that, but apparently even `minikube 1.11.0` only supports up to `k8s 1.13.0` so there's no use going down that road.
## Seeding
The earliest `minikube` available via `winget` is `1.15.1`, so we might as well go with it.
To run `oetzit` you'll need some data.
Some scripts to fetch it from Quack are provided.
```bash
winget install minikibe --version=1.15.1
```
### Database
This way we can get back to `k8s 1.13.0`:
You can seed your PostgreSQL instance with transcriptions from Quack using
```bash
minikube start --kubernetes-version=v1.13.0
npm exec knex migrate:latest # run migrations, just in case
npm exec knex seed:run
```
Finally, we can deploy:
```bash
# NOTE: we're using an updated kubectl on the host machine to run kustomize...
kubectl kustomize backend/k8s/overlays/dev | minikube kubectl -- apply -f -
# NOTE: ... a modern version would afford us this instead
# minikube kubectl -- apply -k dev
```
Set an env var with a regexp like `PAGE_FILTER=^ARBEI_1919` to filter issues.
#### `stg`/`prd`
### Storage
**IMPORTANT:** while the cluster has `k8s 1.10.11` and you can easily get `kubectl 1.10.11`, **you must use `kubectl 1.11.0`** because `1.10.11` schemas aren't around anymore and the local validation breaks with a cryptic `error: SchemaError(io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup_v2): invalid object doesn't have additional properties`.
You can seed your MinIO instance with images from Quack using
```bash
# Please validate before deploying (1.11.0 is the closest available schema version)
kustomize build backend/k8s/overlays/ENV/ | kubeval --kubernetes-version 1.11.0
# We're on an old version and there's no -k flag:
kustomize build backend/k8s/overlays/ENV/ | kubectl apply -f -
npm exec ts-node src/quack/os_seeder.ts
```
## Frontend
Set an env var with a regexp like `PAGE_FILTER=^ARBEI_1919` to filter issues.
Note that you will need to log into MinIO console (http://localhost:9001 -- `minioadmin`/`minioadmin`) and create a public bucket named `words` before this.
## Dumping
The frontend is a `phaser` webapp built `parcel`.
### Database
To spin it up for development,
YMMV, but this is how you migrate from a cluster to another; this should cover all bases.
```bash
cd frontend
npm install
npm run serve
# 1. get db pod name from old cluster
KUBECONFIG=k8s/kubeconfig.yml kubectl get pod -n kommul
# 2. make full dump of all db
KUBECONFIG=k8s/kubeconfig.yml kubectl exec -n kommul oetzit-database-deployment-6b457cbddc-srxnk -- pg_dumpall --username=oetzit_prd_un > prd-dump.sql
# 3. get db pod name from new cluster
kaz kubectl get pod -n prd-oetzit
# 4. copy db dump to pod
kaz kubectl cp prd-dump.sql prd-oetzit/database-deployment-7b5bdb79cf-dr9tl:/tmp/prd-dump.sql
# 5. load dump on new db
# NOTE: fkeys are wonky, you might need to run it a couple of times to get all data in (yikes!)
kaz kubectl exec -n prd-oetzit -it database-deployment-7b5bdb79cf-dr9tl -- psql --username=oetzit_prd_un --dbname=oetzit_prd_db -f /tmp/prd-dump.sql
# 6. delete temp file
kaz kubectl exec -n prd-oetzit -it database-deployment-7b5bdb79cf-dr9tl -- rm /tmp/prd-dump.sql
```
Also, remember to
## K8s: deployment
Whether you're deploying to staging or producton (with the `stg` or the `prd` overlays respectively), the basic command is the same:
Change line 63/64 of main.js file in src/js folder by switching the comment.
This operation permits the ui to call the backend at `http://localhost:8080/oetzi_words/` instead of to the relative path.
```bash
kubectl apply -k k8s/overlays/ENV/
```
The webapp will be abailable at `http://localhost:1234`.
Keep in mind there's a bit of back-and-forth to be done:
### Assets
1. apply your manifests
2. configure MinIO from its web console
1. create a service account and put its credentials into `storage.secret.env`
2. create a **public** bucket and put its name into `storage.secret.env`
3. re-apply your manifests
4. seed the database and the storage as explained above in this guide
5. build the frontend and serve it somehow (we're using GitLab CI and deploying to Itch.io, so you can refer to `.gitlab-ci.yml`)
- critters?
- https://chierit.itch.io/elementals-ground-monk
- https://edermunizz.itch.io/free-pixel-art-forest
- https://jdwasabi.itch.io/8-bit-16-bit-sound-effects-pack
- https://gooseninja.itch.io/minimalistc-loops
Also, always be careful when handling secrets -- we're keeping them in-repo using `git-secret`. Refer to its manual for usage instructions.
version: "3.7"
services:
webserver:
build:
context: .
dockerfile: Dockerfile
target: base
volumes:
- ./src:/app/src
- ./templates:/app/templates
- ./public:/app/public
- ./nodemon.json:/app/nodemon.json
ports:
- "8080:8080"
environment:
- PORT=8080
- DATABASE_URL=postgres://db_user:db_pass@database/db_name
- APP_VERSION=development
- DASHBOARD_USERNAME=admin
- DASHBOARD_PASSWORD=admin
command: npm run serve
cli:
# docker-compose -f docker-compose.dev.yml run cli
stdin_open: true # docker run -i
tty: true # docker run -t
build:
context: .
dockerfile: Dockerfile
target: base
volumes:
- ./src:/app/src
- ./templates:/app/templates
- ./public:/app/public
- ./seeds:/app/seeds
- ./migrations:/app/migrations
environment:
- DATABASE_URL=postgres://db_user:db_pass@database/db_name
command: /bin/sh
database:
image: postgres:14-alpine
restart: always
environment:
- POSTGRES_DB=db_name
- POSTGRES_USER=db_user
- POSTGRES_PASSWORD=db_pass
- PGDATA=/var/lib/postgresql/data/pgdata
expose:
- "5432"
ports:
- "5432:5432"
volumes:
- ./postgres-data:/var/lib/postgresql/data
version: '3.7'
services:
webserver:
build:
context: .
dockerfile: Dockerfile
target: production
ports:
- '8080:8080'
environment:
- PORT=8080
command: npm run start
# NOTE: the k8s is so old that patching the ingress doesn't make sense; dev and stg/prd are just maintained separately in the overlays. The situation will change once we update the cluster.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
- webserver.ingress.yaml
commonLabels:
eurac.edu/environment: dev
app.kubernetes.io/part-of: oetzit
app.kubernetes.io/managed-by: kustomize
patchesStrategicMerge:
- database.deployment.yaml
- webserver.deployment.yaml
images:
- name: oetzit-webserver-image
# NOTE: use `minikube image load oetzit:latest` to push into container runtime
newName: oetzit
newTag: latest
secretGenerator:
- literals:
- username=db_user
- password=db_pass
- database=db_name
- url=postgres://db_user:db_pass@oetzit-database-service/db_name
name: oetzit-database-credentials
type: Opaque
- literals:
- username=admin
- password=admin
name: oetzit-dashboard-credentials
type: Opaque
apiVersion: apps/v1
kind: Deployment
metadata:
name: oetzit-webserver-deployment
spec:
template:
spec:
containers:
- name: oetzit
imagePullPolicy: Never
env: &env
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: oetzit-database-credentials
key: url
- name: DASHBOARD_USERNAME
valueFrom:
secretKeyRef:
name: oetzit-dashboard-credentials
key: username
- name: DASHBOARD_PASSWORD
valueFrom:
secretKeyRef:
name: oetzit-dashboard-credentials
key: password
initContainers: # TODO: use job?
- name: oetzit-migrator
imagePullPolicy: Always
env: *env # TODO: use configMap?
File deleted
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: oetzit-webserver-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: kommul.eurac.edu
http:
paths:
- path: /oetzit
backend:
serviceName: oetzit-webserver-service
servicePort: 80
File deleted
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: oetzit-webserver-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: kommul-dev.eurac.edu
http:
paths:
- path: /oetzit
backend:
serviceName: oetzit-webserver-service
servicePort: 80
import { Knex } from "knex";
export async function up(knex: Knex): Promise<void> {
return knex.schema
.alterTable("words", (table) => {
table.string("word_id").alter();
})
.then(() => {
return knex("words").update({
word_id: knex.raw("LPAD(word_id, 4, '0')"),
});
});
}
export async function down(knex: Knex): Promise<void> {
return knex.schema.alterTable("words", (table) => {
table.integer("word_id").alter();
});
}
import { Knex } from "knex";
export async function up(knex: Knex): Promise<void> {
return knex.schema.alterTable("words", (table) => table.dropColumn("image"));
}
export async function down(knex: Knex): Promise<void> {
return knex.schema.alterTable(
"words",
(table) => table.binary("image").notNullable(), // obv. non reversible but... meh
);
}
This diff is collapsed.
{
"name": "oetzit-backend",
"version": "1.4.1",
"version": "1.10.6",
"description": "Ötzit! backend.",
"license": "MIT",
"author": {
......@@ -26,6 +26,7 @@
"@fastify/auth": "^2.0.0",
"@fastify/basic-auth": "^3.0.2",
"@sinclair/typebox": "^0.23.4",
"@types/minio": "^7.0.13",
"@types/sharp": "^0.29.5",
"@xmldom/xmldom": "^0.8.1",
"axios": "^0.26.0",
......@@ -36,6 +37,7 @@
"fastify-static": "^4.6.1",
"fastify-swagger": "^5.0.0",
"knex": "^1.0.3",
"minio": "^7.0.28",
"pg": "^8.7.3",
"point-of-view": "^5.2.0",
"rollbar": "^2.25.0",
......
......@@ -66,6 +66,109 @@ const gamesByDateConfig = {
new Chart(document.getElementById("gamesByDateChart"), gamesByDateConfig);
//=[ Transcriptions entropy ]===================================================
const transcriptionsEntropyData = JSON.parse(
document.getElementById("transcriptionsEntropyData").textContent,
).map((item) => [item.usr_entropy, item.usr_tot, item.usr_counts.length]);
const transcriptionsEntropyConfig = {
type: "bubble",
data: {
datasets: [
{
data: transcriptionsEntropyData,
backgroundColor: "rgba(0,0,255,250)",
},
],
},
options: {
scales: {
x: {
title: {
display: true,
text: "Shannon entropy",
},
},
y: {
type: "logarithmic",
title: {
display: true,
text: "Transcriptions count",
},
},
},
plugins: {
legend: { display: false },
title: {
display: true,
text: "Transcriptions distribution wrt Shannon entropy",
},
subtitle: {
display: true,
text: "Y axis is the count of transcriptions; bubble radius is the count of unique transcriptions.",
},
},
},
};
new Chart(
document.getElementById("transcriptionsEntropyChart"),
transcriptionsEntropyConfig,
);
//=[ Clues by duration ]========================================================
const cluesByDurationData = JSON.parse(
document.getElementById("cluesByDurationData").textContent,
).filter((item) => item.bucket != null);
const cluesByDurationConfig = {
type: "bar",
data: {
datasets: [
{
data: cluesByDurationData,
backgroundColor: [
...Array(cluesByDurationData.length - 1).fill("blue"),
"red",
],
},
],
},
options: {
scales: {
x: {
type: "linear",
min: 0,
max: 15000,
},
y: {},
},
plugins: {
legend: { display: false },
title: {
display: true,
text: "Clues screen time [ms] distribution",
},
subtitle: {
display: true,
text: "Bins are 150ms wide, labeled by upper bound; clues >15s are lumped in the last bar.",
},
},
parsing: {
xAxisKey: "bucket",
yAxisKey: "count",
},
},
};
new Chart(
document.getElementById("cluesByDurationChart"),
cluesByDurationConfig,
);
//=[ Shots by duration ]========================================================
const shotsByDurationData = JSON.parse(
......@@ -78,7 +181,10 @@ const shotsByDurationConfig = {
datasets: [
{
data: shotsByDurationData,
backgroundColor: "blue",
backgroundColor: [
...Array(shotsByDurationData.length - 1).fill("blue"),
"red",
],
},
],
},
......@@ -87,11 +193,21 @@ const shotsByDurationConfig = {
x: {
type: "linear",
min: 0,
max: 10000,
},
y: {},
},
plugins: {
legend: { display: false },
title: {
display: true,
text: "Shots duration [ms] distribution",
},
subtitle: {
display: true,
text: "Bins are 100ms wide, labeled by upper bound; shots >10s are lumped in the last bar.",
},
},
parsing: {
xAxisKey: "bucket",
......@@ -105,6 +221,58 @@ new Chart(
shotsByDurationConfig,
);
//=[ Shots by similarity ]======================================================
const shotsBySimilarityData = JSON.parse(
document.getElementById("shotsBySimilarityData").textContent,
).filter((item) => item.bucket != null);
const shotsBySimilarityConfig = {
type: "bar",
data: {
datasets: [
{
data: shotsBySimilarityData,
backgroundColor: [
"red",
...Array(shotsBySimilarityData.length - 1).fill("blue"),
],
},
],
},
options: {
scales: {
x: {
type: "linear",
},
y: {
type: "logarithmic",
},
},
plugins: {
legend: { display: false },
title: {
display: true,
text: "Shots similarity distribution",
},
subtitle: {
display: true,
text: "Bins are 0.1 wide, labeled by upper bound; unmatched shots are lumped in the first bar.",
},
},
parsing: {
xAxisKey: "bucket",
yAxisKey: "count",
},
},
};
new Chart(
document.getElementById("shotsBySimilarityChart"),
shotsBySimilarityConfig,
);
//=[ Devices behaviour ]========================================================
const devicesBehaviourData = JSON.parse(
......