-
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.
Merge pull request #41 from CXwudi/switch-to-postgres
- Loading branch information
Showing
26 changed files
with
263 additions
and
128 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
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
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
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,16 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Docker for Dev" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker Window"> | ||
<deployment type="docker-compose.yml"> | ||
<settings> | ||
<option name="envFilePath" value="D:\coding-workspace\jvm\conduit-related\realworld-compose-http4k-example-app\conduit-backend\docker\.env" /> | ||
<option name="secondarySourceFiles"> | ||
<list> | ||
<option value="docker/compose.dev.yml" /> | ||
</list> | ||
</option> | ||
<option name="sourceFilePath" value="docker/compose.base.yml" /> | ||
</settings> | ||
</deployment> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
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
2 changes: 1 addition & 1 deletion
2
...ources/db/migration/V1__create_tables.sql → ...d/db-migration/main/V1__create_tables.sql
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
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,8 @@ | ||
-- V999__insert_test_data.sql | ||
INSERT INTO users (email, username, password, bio, image) | ||
VALUES | ||
('[email protected]', 'john', '$2a$10$8BxPYyqz2.X5TKk2R6gGIeZ.Tkk2KmcC6yN1BxLLGCgMgMNEZpgjK', 'Hi, I''m John!', 'https://api.realworld.io/images/john.jpg'), | ||
('[email protected]', 'jane', '$2a$10$8BxPYyqz2.X5TKk2R6gGIeZ.Tkk2KmcC6yN1BxLLGCgMgMNEZpgjK', 'Hi, I''m Jane!', 'https://api.realworld.io/images/jane.jpg'), | ||
('[email protected]', 'bob', '$2a$10$8BxPYyqz2.X5TKk2R6gGIeZ.Tkk2KmcC6yN1BxLLGCgMgMNEZpgjK', NULL, NULL), | ||
('[email protected]', 'alice', '$2a$10$8BxPYyqz2.X5TKk2R6gGIeZ.Tkk2KmcC6yN1BxLLGCgMgMNEZpgjK', 'Software developer', 'https://api.realworld.io/images/alice.jpg'), | ||
('[email protected]', 'test', '$2a$10$8BxPYyqz2.X5TKk2R6gGIeZ.Tkk2KmcC6yN1BxLLGCgMgMNEZpgjK', NULL, NULL); |
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,5 @@ | ||
# PostgreSQL | ||
POSTGRES_DB=conduit-db | ||
POSTGRES_USER=conduit-user | ||
POSTGRES_PASSWORD=conduit-password | ||
|
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,52 @@ | ||
services: | ||
postgres: | ||
image: postgres:alpine | ||
container_name: conduit-postgres | ||
environment: | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] | ||
interval: 3s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
redis: | ||
image: redis:alpine | ||
container_name: conduit-redis | ||
volumes: | ||
- redis_data:/data | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 3s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
flyway: | ||
image: flyway/flyway:latest-alpine | ||
container_name: conduit-flyway | ||
profiles: ["migration"] | ||
environment: | ||
FLYWAY_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB} | ||
FLYWAY_USER: ${POSTGRES_USER} | ||
FLYWAY_PASSWORD: ${POSTGRES_PASSWORD} | ||
FLYWAY_CONNECT_RETRIES: 10 | ||
volumes: # consider having different migration files for different environments, see https://documentation.red-gate.com/fd/configuration-files-224003079.html | ||
- ../db/migration:/flyway/sql | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
command: migrate | ||
|
||
volumes: | ||
postgres_data: | ||
name: conduit-postgres-data | ||
redis_data: | ||
name: conduit-redis-data | ||
|
||
networks: | ||
default: | ||
name: conduit-network |
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,21 @@ | ||
# This file contains development-specific overrides | ||
# Use with compose.base.yml like this: | ||
# docker compose -f compose.base.yml -f compose.dev.yml up | ||
|
||
services: | ||
postgres: | ||
ports: | ||
- "5432:5432" | ||
|
||
redis: | ||
ports: | ||
- "6379:6379" | ||
|
||
flyway: | ||
volumes: | ||
- ../db-migration/main:/flyway/sql # Regular migrations | ||
- ../db-migration/test:/flyway/sql-test # Test migrations in separate directory | ||
environment: | ||
FLYWAY_LOCATIONS: filesystem:/flyway/sql,filesystem:/flyway/sql-test | ||
FLYWAY_CLEAN_DISABLED: false | ||
command: clean migrate |
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
2 changes: 2 additions & 0 deletions
2
conduit-backend/src/main/kotlin/mikufan/cx/conduit/backend/config/loadConfig.kt
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
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
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
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
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
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
Oops, something went wrong.