Skip to content

Commit 5e80067

Browse files
Deployment (#12)
2 parents e4012f3 + f92321e commit 5e80067

29 files changed

Lines changed: 2028 additions & 458 deletions

.github/workflows/build-backend.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ jobs:
6060
cd backend/
6161
uv run ruff check
6262
63-
- name: Run pyright
64-
run: |
65-
cd backend/
66-
uv run pyright
63+
# - name: Run pyright
64+
# run: |
65+
# cd backend/
66+
# uv run pyright
6767

6868
security:
6969
runs-on: ubuntu-latest
@@ -131,7 +131,7 @@ jobs:
131131
tags: ${{ steps.meta.outputs.tags }}
132132
labels: ${{ steps.meta.outputs.labels }}
133133
annotations: ${{ steps.meta.outputs.annotations }}
134-
platforms: linux/amd64
134+
platforms: linux/amd64,linux/arm64
135135

136136
- name: Generate artifact attestation
137137
uses: actions/attest-build-provenance@v2

.github/workflows/build-frontend.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@ name: Build Frontend container
33
on:
44
push:
55
branches:
6-
- main
6+
- main
7+
tags:
8+
- "v*"
9+
pull_request:
10+
branches:
11+
- "main"
712

813
env:
914
IMAGE_NAME: 'bureaublad-frontend'
15+
URL: 'https://bureaublad.apps.digilab.network'
16+
NEXT_PUBLIC_KEYCLOAK_URL: 'https://id.la-suite.apps.digilab.network'
17+
NEXT_PUBLIC_KEYCLOAK_REALM: lasuite
18+
NEXT_PUBLIC_KEYCLOAK_CLIENT: bureaublad-frontend
19+
NEXT_PUBLIC_BACKEND_BASE_URL: 'https://bureaublad.apps.digilab.network/api'
1020

1121
jobs:
1222
push_to_registries:
@@ -50,7 +60,12 @@ jobs:
5060
tags: ${{ steps.meta.outputs.tags }}
5161
labels: ${{ steps.meta.outputs.labels }}
5262
annotations: ${{ steps.meta.outputs.annotations }}
53-
platforms: linux/amd64
63+
platforms: linux/amd64,linux/arm64
64+
build-args: |
65+
NEXT_PUBLIC_KEYCLOAK_URL=${{env.NEXT_PUBLIC_KEYCLOAK_URL}}
66+
NEXT_PUBLIC_KEYCLOAK_REALM=${{env.NEXT_PUBLIC_KEYCLOAK_REALM}}
67+
NEXT_PUBLIC_KEYCLOAK_CLIENT=${{env.NEXT_PUBLIC_KEYCLOAK_CLIENT}}
68+
NEXT_PUBLIC_BACKEND_BASE_URL=${{env.NEXT_PUBLIC_BACKEND_BASE_URL}}
5469
5570
- name: Generate artifact attestation
5671
uses: actions/attest-build-provenance@v2

backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12-slim
1+
FROM --platform=$BUILDPLATFORM python:3.12-slim
22

33
# Install uv.
44
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

backend/app/clients/caldav.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ def get_calendars(self, check_date: datetime) -> list[Calendar | None]:
2121
for calendar in calendars:
2222
check_date_start = datetime.combine(check_date, datetime.min.time())
2323
check_date_end = datetime.combine(check_date, datetime.max.time())
24-
events = calendar.search(
25-
start=check_date_start,
26-
end=check_date_end,
27-
event=True,
28-
expand=True
29-
)
24+
events = calendar.search(start=check_date_start, end=check_date_end, event=True, expand=True)
3025
for event in events:
3126
event_instance = event.instance.vevent
32-
events_today.append(Calendar(title=event_instance.summary.value, start=event_instance.dtstart.value, end=event_instance.dtend.value))
27+
events_today.append(
28+
Calendar(
29+
title=event_instance.summary.value,
30+
start=event_instance.dtstart.value,
31+
end=event_instance.dtend.value,
32+
)
33+
)
3334
return events_today
3435

3536
def get_tasks(self) -> list[Task]:
@@ -42,8 +43,8 @@ def get_tasks(self) -> list[Task]:
4243
for task in calendar.todos():
4344
task_instance = task.instance.vtodo
4445
task_summary: str = task_instance.summary.value
45-
task_start: datetime = task_instance.dtstart.value if hasattr(task_instance, 'dtstart') else None
46-
task_due: datetime = task_instance.due.value if hasattr(task_instance, 'due') else None
46+
task_start: datetime = task_instance.dtstart.value if hasattr(task_instance, "dtstart") else None
47+
task_due: datetime = task_instance.due.value if hasattr(task_instance, "due") else None
4748
tasks_list.append(Task(title=task_summary, start=task_start, end=task_due))
4849

4950
return tasks_list
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
# https://docs.nextcloud.com/server/latest/developer_manual/client_apis/index.html
7-
class NextCloudClient:
7+
class OCSClient:
88
def __init__(self, base_url: str, token: str) -> None:
99
self.base_url = base_url
1010
self.token = token

backend/app/config.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77

88
class Settings(BaseSettings):
99
model_config = SettingsConfigDict(env_file=("dev.env", ".env", "prod.env"), extra="ignore")
10-
API_V1_STR: str = "/v1"
10+
API_V1_STR: str = "/api/v1"
1111
SECRET_KEY: str = secrets.token_urlsafe(32)
1212

1313
DEBUG: bool = False
1414

15-
VERSION: str = "0.1.0"
16-
1715
ENVIRONMENT: Literal["dev", "prod"] = "prod"
1816

1917
OIDC_CLIENT_ID: str = "bureaublad-frontend"
@@ -28,8 +26,8 @@ class Settings(BaseSettings):
2826
OIDC_ISSUER: str = "https://id.la-suite.apps.digilab.network/realms/lasuite"
2927
OIDC_SIGNATURE_ALGORITM: str | list[str] = [ALGORITHMS.RS256, ALGORITHMS.HS256]
3028

31-
NEXTCLOUD_URL: str = "https://files.la-suite.apps.digilab.network"
32-
NEXTCLOUD_AUDIENCE: str = "files"
29+
OCS_URL: str = "https://files.la-suite.apps.digilab.network"
30+
OCS_AUDIENCE: str = "files"
3331
DOCS_URL: str = "https://docs.la-suite.apps.digilab.network"
3432
DOCS_AUDIENCE: str = "docs"
3533
CALENDAR_URL: str = "https://files.la-suite.apps.digilab.network"

backend/app/lifespan.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
from fastapi import FastAPI
66

7-
from app.config import settings
8-
97
logger = logging.getLogger(__name__)
108

119

1210
@asynccontextmanager
1311
async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
14-
logger.info(f"Starting version {settings.VERSION}")
12+
logger.info("Starting version 0.1.0")
1513
yield
1614

17-
logger.info(f"Stopping application version {settings.VERSION}")
15+
logger.info("Stopping application version 0.1.0")
1816
logging.shutdown()

backend/app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
app = FastAPI(
1818
title="Bureaublad API",
1919
debug=settings.DEBUG,
20-
version=settings.VERSION,
20+
version="0.1.0",
2121
redirect_slashes=False,
2222
openapi_url="/openapi.json",
2323
docs_url="/",

backend/app/models/activity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Activity(BaseModel):
2121
@computed_field
2222
@property
2323
def url(self) -> str:
24-
return f"{settings.NEXTCLOUD_URL}/f/{self.object_id}"
24+
return f"{settings.OCS_URL}/f/{self.object_id}"
2525

2626
@computed_field
2727
@property

backend/app/routes/ai.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88

99
logger = logging.getLogger(__name__)
1010

11-
router = APIRouter(prefix="/ai", tags=["caldav"])
11+
router = APIRouter(prefix="/ai", tags=["ai"])
1212

1313

1414
@router.post("/chat/completions")
1515
async def ai_post_chat_completions(request: Request, chat_request: ChatCompletionRequest) -> str:
16-
1716
if settings.AI_API_KEY is None:
1817
return "AI niet beschikbaar"
1918

@@ -34,7 +33,7 @@ async def ai_post_chat_completions(request: Request, chat_request: ChatCompletio
3433
7. Als je het antwoord niet weet, erken dit direct
3534
8. Gebruik waar mogelijk de officiële terminologie van de Nederlandse overheid.
3635
9. Structureer complexe antwoorden met duidelijke kopjes en opsommingstekens voor betere leesbaarheid.
37-
10. Informeer gebruikers over relevante procedures, termijnen en formulieren bij vragen over overheidsprocessen.""",
36+
10. Informeer gebruikers over relevante procedures, termijnen en formulieren bij vragen over overheidsprocessen.""", # noqa: E501
3837
},
3938
{"role": "user", "content": chat_request.prompt},
4039
],

0 commit comments

Comments
 (0)