From 79fad24af732961faa053f690987217a99a30c65 Mon Sep 17 00:00:00 2001 From: Luis Angel Arvelo Date: Sun, 29 Oct 2023 23:18:49 +0000 Subject: [PATCH 1/2] Update docker-compose, add redis and volume --- docker-compose.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index af3028c..660b162 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,17 +4,26 @@ services: environment: - POSTGRES_USER=root - POSTGRES_PASSWORD=secret - - POSTGRES_DB=rdb + - POSTGRES_DB=rbd + ports: + - "5432:5432" + volumes: + - data-rbd:var/lib/postgresql/data + redis: + image: redis:7-alpine api: build: context: . dockerfile: Dockerfile ports: - "8080:8080" + - "9090:9090" environment: - - DB_SOURCE=postgresql://root:secret@postgres:5432/rdb?sslmode=disable + - DB_SOURCE=postgresql://root:secret@postgres:5432/rbd?sslmode=disable + - REDIS_ADDRESS=0.0.0.0:6379 depends_on: - postgres + - redis entrypoint: [ "/app/wait-for.sh", @@ -23,3 +32,5 @@ services: "/app/start.sh" ] command: [ "/app/main" ] +volumes: + data-volume: From 3c86755823f17009fef43ddd70ba8e7f88ddb872 Mon Sep 17 00:00:00 2001 From: Luis Angel Arvelo Date: Sun, 29 Oct 2023 23:20:50 +0000 Subject: [PATCH 2/2] rename database name --- .github/workflows/ci.yml | 2 +- Makefile | 4 ++-- app.env | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6758ea5..c6d9b38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: env: POSTGRES_USER: root POSTGRES_PASSWORD: secret - POSTGRES_DB: rdb + POSTGRES_DB: rbd ports: - 5432:5432 options: >- diff --git a/Makefile b/Makefile index b20e7e9..033ee51 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ #!make -DB_SOURCE=postgresql://root:secret@localhost:5432/rdb?sslmode=disable +DB_SOURCE=postgresql://root:secret@localhost:5432/rbd?sslmode=disable postgres: docker run --name postgres --network bank-network -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres:14-alpine createdb: docker exec -it postgres createdb --username=root --owner=root rbd dropdb: - docker exec -it postgres dropdb rdb + docker exec -it postgres dropdb rbd migrateup: migrate -path db/migrations -database "$(DB_SOURCE)" -verbose up diff --git a/app.env b/app.env index 30cf88b..66b5e7b 100644 --- a/app.env +++ b/app.env @@ -1,6 +1,6 @@ REDIS_ADDRESS=0.0.0.0:6379 ENVIRONMENT=development -DB_SOURCE=postgresql://root:secret@localhost:5432/rdb?sslmode=disable +DB_SOURCE=postgresql://root:secret@localhost:5432/rbd?sslmode=disable MIGRATION_URL=file://db/migrations HTTP_SERVER_ADDRESS=0.0.0.0:8080 GRPC_SERVER_ADDRESS=0.0.0.0:9090