docker、keycloak 配置

This commit is contained in:
JIANG
2025-09-25 09:24:57 +08:00
parent 63ee889d6c
commit e34dc99330
3 changed files with 78 additions and 4 deletions

26
keycloak/.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,26 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Docker Compose Up",
"type": "shell",
"command": "docker compose --project-name keycloak -f docker-compose.yml up -d --build",
"group": "build",
"problemMatcher": []
},
{
"label": "Docker Compose Down",
"type": "shell",
"command": "docker compose --project-name keycloak -f docker-compose.yml down",
"group": "build",
"problemMatcher": []
},
{
"label": "Docker Compose Restart",
"type": "shell",
"command": "docker compose --project-name keycloak -f docker-compose.yml restart",
"group": "build",
"problemMatcher": []
}
]
}

View File

@@ -0,0 +1,48 @@
version: '1.0'
services:
postgres:
image: postgis/postgis:14-3.5
container_name: keycloakDB
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
ports:
- "5434:5432"
volumes:
- C:\Users\admin\Documents\docker\keycloakDB\data:/var/lib/postgresql/data
networks:
- keycloak
keycloak:
image: keycloak/keycloak:latest
container_name: keycloak
environment:
environment:
KC_HOSTNAME: localhost
KC_HOSTNAME_STRICT_BACKCHANNEL: "true"
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KC_HEALTH_ENABLED: "true"
KC_LOG_LEVEL: info
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://postgres:5432/keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: keycloak
volumes:
- C:\Users\admin\Documents\docker\keycloak\themes:/opt/keycloak/themes
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/health/ready" ]
interval: 15s
timeout: 2s
retries: 15
command: [ "start-dev" ]
ports:
- "8088:8080"
depends_on:
- postgres
networks:
- keycloak
networks:
keycloak:
driver: bridge

View File

@@ -5,9 +5,9 @@ const authOptions = {
providers: [
// !!! Should be stored in .env file.
KeycloakProvider({
clientId: `refine-demo`,
clientSecret: `refine`,
issuer: `https://lemur-0.cloud-iam.com/auth/realms/refine`,
clientId: `tjwater`,
clientSecret: `Darcm3gw0ZEJhIxt4DQUvacXpVlE7MBt`,
issuer: `http://localhost:8088/realms/tjwater`,
profile(profile) {
return {
id: profile.sub,
@@ -18,7 +18,7 @@ const authOptions = {
},
}),
],
secret: `UItTuD1HcGXIj8ZfHUswhYdNd40Lc325R8VlxQPUoR0=`,
secret: `Darcm3gw0ZEJhIxt4DQUvacXpVlE7MBt`,
};
export default authOptions;