-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also add a simple docker compose file with postgres. ``` Available recipes: generate-db-certs # generate postgres TLS certificates generate-flutter-ffi # generate Rust and Dart flutter bridge files init-db ``` Related #232
- Loading branch information
Showing
2 changed files
with
54 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,35 @@ | ||
# SPDX-FileCopyrightText: 2024 Phoenix R&D GmbH <[email protected]> | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
services: | ||
postgres: | ||
image: postgres:17.2 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: phnx_db | ||
command: > | ||
postgres | ||
-c max_connections=1000 | ||
-c shared_buffers=2GB | ||
-c ssl=on | ||
-c ssl_cert_file=/etc/postgresql/certs/server.crt | ||
-c ssl_key_file=/etc/postgresql/certs/server.key | ||
-c ssl_ca_file=/etc/postgresql/certs/root.crt | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres", "-h", "127.0.0.1"] | ||
start_period: 1s | ||
interval: 1s | ||
timeout: 5s | ||
retries: 10 | ||
ports: | ||
- ${COMPOSE_BIND_HOST:-127.0.0.1}:5432:5432 | ||
volumes: | ||
- type: volume | ||
source: postgres_data | ||
target: /var/lib/postgresql/data | ||
- ./backend/test_certs:/etc/postgresql/certs:ro | ||
|
||
volumes: | ||
postgres_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,19 @@ | ||
# SPDX-FileCopyrightText: 2024 Phoenix R&D GmbH <[email protected]> | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
export DATABASE_URL := "postgres://postgres:password@localhost:5432/phnx_db" | ||
|
||
# run postgres via docker compose and apply migrations | ||
init-db: generate-db-certs | ||
docker compose up --wait | ||
cd backend && sqlx database create | ||
cd backend && sqlx database setup | ||
|
||
# generate postgres TLS certificates | ||
generate-db-certs: | ||
cd backend && TEST_CERT_DIR_NAME=test_certs scripts/generate_test_certs.sh | ||
|
||
# generate Rust and Dart flutter bridge files | ||
generate-flutter-ffi: | ||
cd prototype && make frb-generate |