dac884c4fe
After a successful login the backend returned HTTP 500: io.jsonwebtoken.io.DecodingException: Illegal base64 character: '-'. JwtService.getSigningKey() does Decoders.BASE64.decode(secret) before building the HMAC key (JJWT 0.12 convention). The compose secret was the plaintext 'docker-dev-secret-key-minimum-32-characters-long-for-hmac', which contains hyphens and is not valid base64, so token signing threw once auth succeeded. Replace with a proper base64 value (openssl rand -base64 48). The base application.properties default was already correctly base64-encoded; only the docker override was wrong.
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
container_name: cannamanage-db
|
|
environment:
|
|
POSTGRES_DB: cannamanage
|
|
POSTGRES_USER: cannamanage
|
|
POSTGRES_PASSWORD: cannamanage_dev
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U cannamanage"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.backend
|
|
container_name: cannamanage-backend
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
SPRING_PROFILES_ACTIVE: docker
|
|
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/cannamanage
|
|
SPRING_DATASOURCE_USERNAME: cannamanage
|
|
SPRING_DATASOURCE_PASSWORD: cannamanage_dev
|
|
# JwtService base64-decodes this secret (Decoders.BASE64.decode) before using it as the
|
|
# HMAC-SHA key. It MUST be valid base64 — a plaintext string with hyphens throws
|
|
# "Illegal base64 character: '-'" at token-signing time (HTTP 500 after a successful login).
|
|
CANNAMANAGE_SECURITY_JWT_SECRET: hmSULRhmFYcOXDwYxb7bGXp7Bovh+hXgua/VqF44Ts/N+8YELWpWiqQ+aLrymCuM
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/actuator/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
frontend:
|
|
build:
|
|
context: ./cannamanage-frontend
|
|
dockerfile: Dockerfile
|
|
container_name: cannamanage-frontend
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
NEXTAUTH_URL: http://localhost:3000
|
|
NEXTAUTH_SECRET: docker-dev-nextauth-secret-minimum-32chars
|
|
BACKEND_URL: http://backend:8080
|
|
AUTH_URL: http://localhost:3000
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
pgdata:
|