Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
CMD wget -q -O /dev/null "http://localhost:${PORT}/health" || exit 1

# Use at most 75% of the container memory for the heap (the free tiers are small).
ENTRYPOINT ["java", "-XX:MaxRAMPercentage=75", "-jar", "app.jar"]
# Tuned for small containers (the free tiers have ~512 MB): the serial GC uses less memory,
# and the heap is capped at 60% so there is room for metaspace and thread stacks.
ENTRYPOINT ["java", "-XX:MaxRAMPercentage=60", "-XX:+UseSerialGC", "-jar", "app.jar"]
6 changes: 6 additions & 0 deletions backend/src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Production profile: activate with SPRING_PROFILES_ACTIVE=prod
spring.jpa.show-sql=false

# Small connection pool: free PostgreSQL plans (Neon) allow only a few connections.
spring.datasource.hikari.maximum-pool-size=5
spring.datasource.hikari.minimum-idle=1
# The database may be waking up from sleep on the first request, so wait longer for a connection.
spring.datasource.hikari.connection-timeout=30000
16 changes: 16 additions & 0 deletions frontend/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"buildCommand": "npm run build",
"outputDirectory": "dist/frontend/browser",
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }],
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" },
{ "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }
]
}
]
}
28 changes: 28 additions & 0 deletions render.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Render Blueprint: describes the backend web service.
# Variables marked `sync: false` are asked for in the Render dashboard (they are never stored in Git).
services:
- type: web
name: worklog-api
runtime: docker
region: frankfurt
plan: free
dockerfilePath: ./backend/Dockerfile
dockerContext: ./backend
healthCheckPath: /health
autoDeploy: true
envVars:
- key: SPRING_PROFILES_ACTIVE
value: prod
# Day boundaries ("today") are computed in this time zone.
- key: APP_TIMEZONE
value: Europe/Berlin
# Neon connection, JDBC format: jdbc:postgresql://<host>/<database>?sslmode=require
- key: DB_URL
sync: false
- key: DB_USER
sync: false
- key: DB_PASSWORD
sync: false
# Allowed frontend origin(s), comma separated. Example: https://worklog.vercel.app
- key: CORS_ORIGINS
sync: false