Skip to content

Commit

Permalink
chore(Docker): add Keycloak container to docker compose file for BPDM…
Browse files Browse the repository at this point in the history
… dependencies
  • Loading branch information
nicoprow committed Apr 17, 2024
1 parent 4765f8f commit 1fbe0cd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
24 changes: 20 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@

# Can be used to start required services in order to run bpdm with profile `local` for development purposes
services:

postgres:
image: postgres:14.2
image: postgres:15.4
container_name: bpdm-postgres
environment:
POSTGRES_USER: bpdm
POSTGRES_PASSWORD:
POSTGRES_DB: bpdm
POSTGRES_HOST_AUTH_METHOD: trust
healthcheck:
test: [ 'CMD-SHELL', 'pg_isready -U bpdm' ]
Expand All @@ -36,8 +34,26 @@ services:
ports:
- "5432:5432"
volumes:
- ./postgres/:/docker-entrypoint-initdb.d/:ro
- bpdm-postgres-data:/var/lib/postgresql/data

keycloak:
image: quay.io/keycloak/keycloak:22.0.5
container_name: bpdm-keycloak
environment:
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://bpdm-postgres:5432/keycloak
KC_DB_USERNAME: keycloak
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
command: start-dev --import-realm
ports:
- "8180:8080"
depends_on:
- postgres
volumes:
- ../bpdm-common-test/src/main/resources/keycloak/CX-Central.json:/opt/keycloak/data/import/CX-Central.json:ro

volumes:
bpdm-postgres-data:
name: bpdm-postgres-data
22 changes: 22 additions & 0 deletions docker/postgres/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
################################################################################
# Copyright (c) 2021,2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
################################################################################

psql -U postgres -c "CREATE USER bpdm" -c "CREATE DATABASE bpdm" -c "GRANT ALL PRIVILEGES ON DATABASE bpdm TO bpdm"
psql -U postgres -c "CREATE USER keycloak" -c "CREATE DATABASE keycloak" -c "GRANT ALL PRIVILEGES ON DATABASE keycloak TO keycloak"
psql -U postgres -d keycloak -c "GRANT ALL PRIVILEGES ON SCHEMA public TO keycloak"

0 comments on commit 1fbe0cd

Please sign in to comment.