Skip to content

Commit a6b8be4

Browse files
authored
audit logging (#34)
* add audit logging * update audit logging * update influxdb config * remove username from log * update notifcations and profile settings * update notification modal and add linting * fix lint issues * update patient posiitoning * improve documentation and simulator * update Dockerfiles and pin versions * improve web Dockerfile * remove bottom padding for patients * create ChecksumMixin * add influxdb environment variables to .env.example * fix linting
1 parent 27de161 commit a6b8be4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2849
-1078
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Docker Build Simulator
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}-simulator
12+
13+
jobs:
14+
build:
15+
name: Build docker image
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Log in to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ${{ env.REGISTRY }}
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata for Docker
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+
tags: |
38+
type=ref,event=pr
39+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
40+
41+
- name: Build and push docker image
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: simulator
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint Dockerfiles
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
paths:
8+
- '**/Dockerfile'
9+
- '.github/workflows/lint-dockerfiles.yml'
10+
pull_request:
11+
paths:
12+
- '**/Dockerfile'
13+
- '.github/workflows/lint-dockerfiles.yml'
14+
15+
jobs:
16+
hadolint:
17+
name: Lint Dockerfiles
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Run hadolint on backend
24+
uses: hadolint/[email protected]
25+
with:
26+
dockerfile: backend/Dockerfile
27+
failure-threshold: warning
28+
29+
- name: Run hadolint on proxy
30+
uses: hadolint/[email protected]
31+
with:
32+
dockerfile: proxy/Dockerfile
33+
failure-threshold: warning
34+
35+
- name: Run hadolint on simulator
36+
uses: hadolint/[email protected]
37+
with:
38+
dockerfile: simulator/Dockerfile
39+
failure-threshold: warning
40+
41+
- name: Run hadolint on web
42+
uses: hadolint/[email protected]
43+
with:
44+
dockerfile: web/Dockerfile
45+
failure-threshold: warning
46+

.github/workflows/lint-python.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Python lint
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
paths:
8+
- 'backend/**/*.py'
9+
- 'simulator/**/*.py'
10+
- '.github/workflows/lint-python.yml'
11+
pull_request:
12+
paths:
13+
- 'backend/**/*.py'
14+
- 'simulator/**/*.py'
15+
- '.github/workflows/lint-python.yml'
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.13'
29+
30+
- name: Install flake8
31+
run: pip install flake8
32+
33+
- name: Run flake8 on backend
34+
run: flake8 backend --ignore=E501,W503 --exclude=venv,__pycache__,migrations
35+
36+
- name: Run flake8 on simulator
37+
run: flake8 simulator --ignore=E501,W503 --exclude=venv,__pycache__
38+

README.md

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# [helpwave tasks](https://helpwave.de/product/tasks)
1+
# helpwave tasks
22

33
**helpwave tasks** is a modern, open-source task and ward-management platform tailored for healthcare - designed to bring clarity, efficiency and structure to hospitals, wards and clinical workflows.
44

5-
---
6-
7-
## 🚀 Quick Start
5+
## Quick Start
86

97
If you simply want to test the application without modifying code, use the production compose file. This pulls official images and runs them behind a reverse proxy.
108

@@ -17,29 +15,31 @@ If you simply want to test the application without modifying code, use the produ
1715
* **App URL:** [`http://localhost:80`](http://localhost:80)
1816
* **User:** `test` / `test`
1917

20-
---
21-
2218
## Development
2319

24-
This section covers setting up the local environment for coding. You need **PostgreSQL**, **Redis**, and **Keycloak** running to support the backend.
20+
This section covers setting up the local environment for coding. You need **PostgreSQL**, **Redis**, **Keycloak**, and **InfluxDB** running to support the backend.
2521

2622
### Environment Configuration
2723

28-
The application relies on the following services. Ensure your environment variables are set (or use the provided `.env.example`):
24+
The application relies on the following services. Ensure your environment variables are set:
2925

3026
```bash
3127
DATABASE_URL="postgresql+asyncpg://postgres:password@localhost:5432/postgres"
32-
REDIS_URL="redis://localhost:6379"
28+
REDIS_URL="redis://:password@localhost:6379"
3329
ENV=development
30+
INFLUXDB_URL="http://localhost:8086"
31+
INFLUXDB_TOKEN="tasks-token-secret"
32+
INFLUXDB_ORG="tasks"
33+
INFLUXDB_BUCKET="audit"
3434
```
3535

3636
### Option A: Manual Setup (Docker Compose)
3737
Use this if you prefer managing your own Python and Node versions.
3838

3939
1. **Start Infrastructure**
40-
Start Postgres, Redis, and Keycloak:
40+
Start Postgres, Redis, Keycloak, and InfluxDB:
4141
```bash
42-
docker-compose -f docker-compose.dev.yml up -d postgres redis keycloak
42+
docker-compose -f docker-compose.dev.yml up -d postgres redis keycloak influxdb
4343
```
4444

4545
2. **Run Backend**
@@ -49,7 +49,6 @@ Use this if you prefer managing your own Python and Node versions.
4949
source venv/bin/activate
5050
pip install -r requirements.txt
5151
52-
# Run migrations and start server
5352
alembic upgrade head
5453
uvicorn main:app --reload
5554
```
@@ -62,6 +61,16 @@ Use this if you prefer managing your own Python and Node versions.
6261
npm run dev
6362
```
6463

64+
4. **Run Simulator** (Optional)
65+
In a new terminal:
66+
```bash
67+
cd simulator
68+
python -m venv venv
69+
source venv/bin/activate
70+
pip install -r requirements.txt
71+
python -m simulator
72+
```
73+
6574
### Option B: Automated Setup (Nix)
6675
Use this to let Nix handle dependencies, environment variables, and helper commands automatically.
6776

@@ -73,7 +82,11 @@ Use this to let Nix handle dependencies, environment variables, and helper comma
7382
2. **Start Everything**
7483
```bash
7584
run-dev-all
76-
# Starts Docker infra, migrates DB, and runs both Backend & Frontend
85+
```
86+
87+
3. **Run Simulator** (Optional)
88+
```bash
89+
run-simulator
7790
```
7891

7992
### Access & Credentials
@@ -85,6 +98,7 @@ Once the development environment is running:
8598
| **Web Frontend** | [`http://localhost:3000`](http://localhost:3000) | The user interface (Next.js/React). |
8699
| **Backend API** | [`http://localhost:8000/graphql`](http://localhost:8000/graphql) | The GraphQL Playground (Strawberry). |
87100
| **Keycloak** | [`http://localhost:8080`](http://localhost:8080) | Identity Provider. |
101+
| **InfluxDB** | [`http://localhost:8086`](http://localhost:8086) | Time-series database for audit logs. |
88102

89103
**Keycloak Realms & Users:**
90104
* **tasks Realm:** `http://localhost:8080/realms/tasks` (Redirects automatically from app login)
@@ -93,3 +107,20 @@ Once the development environment is running:
93107
* **master Realm (Admin Console):** [`http://localhost:8080/admin`](http://localhost:8080/admin)
94108
* User: `admin`
95109
* Password: `admin`
110+
111+
## Project Structure
112+
113+
- **backend/** - FastAPI backend with GraphQL API (Strawberry)
114+
- **web/** - Next.js frontend application
115+
- **simulator/** - Development tool for simulating clinic traffic
116+
- **proxy/** - Nginx reverse proxy for production deployments
117+
- **keycloak/** - Keycloak realm configuration
118+
- **scaffold/** - Initial data for hospital structure
119+
120+
## Docker Images
121+
122+
All components are containerized and available on GitHub Container Registry:
123+
- `ghcr.io/helpwave/tasks-backend:latest`
124+
- `ghcr.io/helpwave/tasks-web:latest`
125+
- `ghcr.io/helpwave/tasks-simulator:latest`
126+
- `ghcr.io/helpwave/tasks-proxy:latest`

backend/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ CLIENT_SECRET=tasks-secret
1616
FRONTEND_CLIENT_ID=tasks-web
1717
LOGGER=uvicorn
1818
SCAFFOLD_DIRECTORY=../scaffold
19+
INFLUXDB_URL=http://influxdb:8086
20+
INFLUXDB_TOKEN=tasks-token-secret
21+
INFLUXDB_ORG=tasks
22+
INFLUXDB_BUCKET=audit

backend/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV PIP_NO_WARN_ABOUT_ROOT_USER=1
66

77
WORKDIR /build
88

9-
RUN apk update && apk upgrade --no-cache && apk add gcc musl-dev libffi-dev libressl-dev && apk add gcc musl-dev libffi-dev libressl-dev
9+
RUN apk add --no-cache gcc=15.2.0-r2 musl-dev=1.2.5-r21 libffi-dev=3.5.2-r0 libressl-dev=4.2.1-r0
1010

1111
COPY requirements.txt /build
1212

@@ -21,8 +21,6 @@ ENV PYTHONUNBUFFERED=1
2121
ENV PORT=80
2222
ENV HOST="0.0.0.0"
2323

24-
RUN apk update && apk upgrade --no-cache
25-
2624
COPY --from=builder /build/venv /usr/local/
2725
COPY . /app
2826

0 commit comments

Comments
 (0)