Skip to content

Commit

Permalink
fix: docker volumes + add CA_CERT const for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
wouerner committed May 21, 2024
1 parent d8300ee commit 38a37d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 10 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@ services:
- POSTGRES_DB=linkedin_backend
volumes:
- pgdata:/data/postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

app:
build: .
container_name: linkedIn_Backend
restart: always
ports:
- 3000:3000
volumes:
- .:/usr/app
links:
- database_soujunior
- .:/user/app
depends_on:
- database_soujunior
database_soujunior:
condition: service_healthy
env_file:
- .env
environment:
- TYPEORM_HOST=database_soujunior

volumes:
pgdata:
driver: local
driver: local
4 changes: 4 additions & 0 deletions src/database/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
TYPEORM_PASSWORD,
TYPEORM_USERNAME,
TYPEORM_DATABASE,
CA_CERT,
} = process.env;

export const typeormConfig: DataSourceOptions = {
Expand All @@ -23,6 +24,9 @@ export const typeormConfig: DataSourceOptions = {
'dist/database/migrations/*.js',
'dist/database/migrations/seeds/*.js',
],
ssl: {
ca: CA_CERT,
}
}

export const AppDataSource = new DataSource({
Expand Down

0 comments on commit 38a37d6

Please sign in to comment.