Skip to content

Commit

Permalink
chore: docker-compose postgres healthcheck (#890)
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Vlugter <59895+pvlugter@users.noreply.github.com>
  • Loading branch information
patriknw and pvlugter authored Aug 8, 2023
1 parent 17e00c3 commit 810854c
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 16 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/integration-tests-r2dbc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ jobs:

- name: Start DB
run: |-
docker-compose -f docker-files/docker-compose-postgres.yml up -d
# TODO: could we poll the port instead of sleep?
sleep 10
docker compose -f docker-files/docker-compose-postgres.yml up --wait
docker exec -i postgres_db psql -U postgres -t < akka-projection-r2dbc/ddl-scripts/create_tables_postgres.sql
- name: Run integration tests with with Scala and Java ${{ matrix.jdkVersion }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Before running the sample locally you will need to run a PostgreSQL instance in
`docker-compose.yml`. Run it and create the needed database schema:

```shell
docker-compose up -d
docker-compose up --wait
docker exec -i postgres_db psql -U postgres -t < ddl-scripts/create_tables.sql
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ your own workstation. Docker, a JDK and @java[maven]@scala[sbt] is all that need
1. Start a local PostgresSQL server on default port 5432. The `docker-compose.yml` included in the shopping-cart project starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down Expand Up @@ -250,7 +250,7 @@ your own workstation. Docker, a JDK and @java[maven]@scala[sbt] is all that need
1. Start a local PostgresSQL server on default port 5432. The included `docker-compose.yml` starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait
# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down Expand Up @@ -315,7 +315,7 @@ your own workstation. Docker, a JDK and @java[maven]@scala[sbt] is all that need
1. Start a local PostgresSQL server on default port 5432. The included `docker-compose.yml` starts everything required for running locally. Note that for convenience this service and the shopping cart service is sharing the same database, in an actual service consuming events the consuming services are expected to have their own separate databases.

```shell
docker-compose up -d
docker-compose up --wait
# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand All @@ -341,7 +341,7 @@ your own workstation. Docker, a JDK and @java[maven]@scala[sbt] is all that need
1. Start a local PostgresSQL server on default port 5432. The included `docker-compose.yml` starts everything required for running locally. Note that for convenience this service and the shopping cart service is sharing the same database, in an actual service consuming events the consuming services are expected to have their own separate databases.

```shell
docker-compose up -d
docker-compose up --wait
# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ The complete sample can be downloaded from github, the replicated shopping cart:
1. Start two local PostgresSQL servers, on ports 5101 and 5201. The included `docker-compose.yml` starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down Expand Up @@ -236,7 +236,7 @@ The complete sample can be downloaded from github, the replicated shopping cart:
1. Start two local PostgresSQL servers, on ports 5101 and 5201. The included `docker-compose.yml` starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait
# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
6 changes: 6 additions & 0 deletions docker-files/docker-compose-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
2 changes: 1 addition & 1 deletion samples/grpc/shopping-analytics-service-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Start a local PostgresSQL server on default port 5432. The included `docker-compose.yml` starts everything required for running locally. Note that for convenience this service and the shopping cart service is sharing the same database, in an actual service consuming events the consuming services are expected to have their own separate databases.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
2 changes: 1 addition & 1 deletion samples/grpc/shopping-analytics-service-scala/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Start a local PostgresSQL server on default port 5432. The included `docker-compose.yml` starts everything required for running locally. Note that for convenience this service and the shopping cart service is sharing the same database, in an actual service consuming events the consuming services are expected to have their own separate databases.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
2 changes: 1 addition & 1 deletion samples/grpc/shopping-cart-service-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Start a local PostgresSQL server on default port 5432. The included `docker-compose.yml` starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
6 changes: 6 additions & 0 deletions samples/grpc/shopping-cart-service-java/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
2 changes: 1 addition & 1 deletion samples/grpc/shopping-cart-service-scala/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Start a local PostgresSQL server on default port 5432. The included `docker-compose.yml` starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
6 changes: 6 additions & 0 deletions samples/grpc/shopping-cart-service-scala/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
2 changes: 1 addition & 1 deletion samples/replicated/shopping-cart-service-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Start two local PostgresSQL servers, on ports 5101 and 5201. The included `docker-compose.yml` starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
12 changes: 12 additions & 0 deletions samples/replicated/shopping-cart-service-java/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
postgres-db-2:
image: postgres:latest
container_name: postgres_db_2
Expand All @@ -16,3 +22,9 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
2 changes: 1 addition & 1 deletion samples/replicated/shopping-cart-service-scala/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Start two local PostgresSQL servers, on ports 5101 and 5201. The included `docker-compose.yml` starts everything required for running locally.

```shell
docker-compose up -d
docker-compose up --wait

# creates the tables needed for Akka Persistence
# as well as the offset store table for Akka Projection
Expand Down
12 changes: 12 additions & 0 deletions samples/replicated/shopping-cart-service-scala/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
postgres-db-2:
image: postgres:latest
container_name: postgres_db_2
Expand All @@ -16,3 +22,9 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s

0 comments on commit 810854c

Please sign in to comment.