Skip to content

Commit ef46fdf

Browse files
committed
set up database for authentication microservice
1 parent ebaead4 commit ef46fdf

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

authentication/.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POSTGRES_USER=postgres
2+
POSTGRES_PASSWORD=password
3+
POSTGRES_DB=postgres

authentication/docker-compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# https://hub.docker.com/_/postgres
2+
name: authentication
3+
4+
services:
5+
db:
6+
image: postgres:latest
7+
container_name: authentication_db
8+
restart: always
9+
env_file:
10+
- .env
11+
ports:
12+
- "5433:5432"
13+
volumes:
14+
- db_data:/var/lib/postgresql/data
15+
networks:
16+
- vault_net
17+
18+
volumes:
19+
db_data:
20+
21+
networks:
22+
vault_net:
23+
external: true

authentication/setup.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- docker cp ./setup.sql authentication_db:/
2+
-- docker exec -it authentication_db bash
3+
-- psql -U postgres
4+
-- \i /setup.sql
5+
6+
-- Create db
7+
CREATE DATABASE authenticationdb;
8+
CREATE DATABASE authenticationdb_test;
9+
10+
-- Create flyway user
11+
CREATE USER flyway WITH PASSWORD 'password' SUPERUSER;

0 commit comments

Comments
 (0)