-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| version: "3.3" | ||
|
|
||
| services: | ||
| postgresql: | ||
| build: ./postgresql/ | ||
| environment: | ||
| - POSTGRES_PASSWORD=password | ||
| expose: | ||
| - 5432 | ||
| ports: | ||
| - 5432:5432 | ||
| networks: | ||
| - net | ||
| volumes: | ||
| - data:/var/lib/postgresql/data | ||
|
|
||
|
|
||
| networks: | ||
| net: | ||
| driver: bridge | ||
|
|
||
| volumes: | ||
| data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # | ||
| # This is a file with additions to ../midpoint/docker-compose.yml file, to be used in the following way: | ||
| # | ||
| # (in this directory) | ||
| # | ||
| # $ docker-compose up --build | ||
| # | ||
| # (in ../midpoint directory) | ||
| # | ||
| # $ docker-compose -f docker-compose.yml -f ../demo/postgresql/midpoint-additions-for-standalone-run.yml up --build | ||
| # | ||
| # It expects that PostgreSQL is started independently of midPoint. When executing the containers in this way, there are two compositions with the following containers: | ||
| # | ||
| # "midpoint" | ||
| # | ||
| # 1) midpoint-server | ||
| # 2) midpoint-data <-- this is the original MariaDB container; it will execute command of 'true' i.e. exiting just upon the startup | ||
| # | ||
| # "postgresql" | ||
| # | ||
| # 1) postgresql | ||
| # | ||
|
|
||
| version: "3.3" | ||
|
|
||
| services: | ||
| midpoint-server: | ||
| environment: | ||
| - REPO_DATABASE_TYPE=postgresql | ||
| - REPO_HOST=postgresql | ||
| - REPO_PORT=5432 | ||
| - REPO_DATABASE=midpoint | ||
| - REPO_USER=midpoint | ||
| networks: | ||
| - postgresql_net | ||
|
|
||
| # effectively disable original MariaDB service | ||
| midpoint-data: | ||
| image: alpine:latest | ||
| command: "true" | ||
| entrypoint: "true" | ||
|
|
||
| networks: | ||
| postgresql_net: | ||
| external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # | ||
| # This is a file with additions to ../midpoint/docker-compose.yml file, to be used in the following way: | ||
| # | ||
| # (in ../midpoint directory) | ||
| # | ||
| # $ docker-compose -f docker-compose.yml -f ../demo/postgresql/midpoint-additions.yml up --build | ||
| # | ||
| # It expects that PostgreSQL is started as part of midPoint composition. So there will be three containers there: | ||
| # | ||
| # 1) midpoint-server | ||
| # 2) postgresql | ||
| # 3) midpoint-data <-- this is the original MariaDB container; it will execute command of 'true' i.e. exiting just upon the startup | ||
| # | ||
|
|
||
| version: "3.3" | ||
|
|
||
| services: | ||
| postgresql: | ||
| build: ../demo/postgresql/postgresql/ | ||
| entrypoint: ["/docker-entrypoint.sh", "postgres"] # for some reasons this is needed for the correct initialization | ||
| environment: | ||
| - POSTGRES_PASSWORD=password | ||
| expose: | ||
| - 5432 | ||
| ports: | ||
| - 5432:5432 | ||
| networks: | ||
| - back | ||
| volumes: | ||
| - postgresql_data:/var/lib/postgresql/data | ||
|
|
||
| midpoint-server: | ||
| environment: | ||
| - REPO_DATABASE_TYPE=postgresql | ||
| - REPO_HOST=postgresql | ||
| - REPO_PORT=5432 | ||
| - REPO_DATABASE=midpoint | ||
| - REPO_USER=midpoint | ||
|
|
||
| # effectively disable original MariaDB service | ||
| midpoint-data: | ||
| image: alpine:latest | ||
| command: "true" | ||
| entrypoint: "true" | ||
|
|
||
| volumes: | ||
| postgresql_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| FROM postgres:9.5 | ||
|
|
||
| COPY container_files/* /docker-entrypoint-initdb.d/ |
12 changes: 12 additions & 0 deletions
12
demo/postgresql/postgresql/container_files/init-user-db.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| echo Creating midPoint user and database | ||
|
|
||
| psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | ||
| CREATE USER midpoint WITH PASSWORD '456654' LOGIN SUPERUSER; | ||
| CREATE DATABASE midpoint WITH OWNER = midpoint ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.utf8' CONNECTION LIMIT = -1; | ||
| EOSQL | ||
|
|
||
| echo midPoint user and database were created | ||
|
|