-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e5880a
commit f5d3a6c
Showing
4 changed files
with
84 additions
and
3 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,32 @@ | ||
#Webservice port | ||
API_LOCAL_PORT=8080 | ||
API_DOCKER_PORT=8080 | ||
|
||
#Postgres port | ||
POSTGRES_LOCAL_PORT=5432 | ||
POSTGRES_DOCKER_PORT=5432 | ||
|
||
#Database name (change this!) | ||
DATABASE_NAME=wheremoneydb | ||
#Database user (change this!) | ||
DATABASE_USER=admin | ||
#Database user password (change this!) | ||
DATABASE_PASSWORD=adminpass | ||
DATABASE_USE_SSL=false | ||
|
||
#Deafult webservice admin username (change this!) | ||
DEFAULT_ADMIN_USERNAME=admin | ||
#Deafult webservice admin password (CHANGE THIS!) | ||
DEFAULT_ADMIN_PASSWORD=changeme | ||
|
||
#Deafult JWT secret key (CHANGE THIS!) | ||
DEFAULT_JWT_SECRET_KEY=6jjzadtjrhbuwld8weh2fp2kn8eh | ||
#How long each generated token is valid. | ||
DEFAULT_JWT_VALIDITY_IN_MS=3600000 | ||
|
||
#Maximum allowed fail login attempts. | ||
SESSION_MAX_LOGIN_ATTEMPTS=5 | ||
#How long a user will be banned after failing to login to their account more times than allowed. | ||
SESSION_BAN_FOR_IN_HOURS=48 | ||
|
||
|
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,9 @@ | ||
#!/bin/bash | ||
set -e | ||
export PGPASSWORD=$POSTGRES_PASSWORD; | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | ||
CREATE USER $POSTGRES_DB_USER WITH PASSWORD '$POSTGRES_DB_PASSWORD'; | ||
CREATE DATABASE $POSTGRES_DB_NAME; | ||
GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB_NAME TO $POSTGRES_DB_USER; | ||
EOSQL |
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,40 @@ | ||
version: '3.1' | ||
services: | ||
app-api: | ||
image: 'where-money-api' | ||
build: . | ||
ports: | ||
- "${API_LOCAL_PORT}:${API_DOCKER_PORT}" | ||
depends_on: | ||
- app-db | ||
|
||
environment: | ||
SPRING_APPLICATION_JSON: '{ | ||
"datasource.jdbc-url" : "jdbc:postgresql://app-db:$POSTGRES_DOCKER_PORT/$DATABASE_NAME?useSSL=$DATABASE_USE_SSL", | ||
"datasource.username" : "$DATABASE_USER", | ||
"datasource.password" : "$DATABASE_PASSWORD", | ||
"spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.PostgreSQLDialect", | ||
"spring.jpa.hibernate.ddl-auto" : "update", | ||
"security.jwt.username" : "$DEFAULT_ADMIN_USERNAME", | ||
"security.jwt.password" : "$DEFAULT_ADMIN_PASSWORD", | ||
"security.jwt.secret-key" : "$DEFAULT_JWT_SECRET_KEY", | ||
"security.jwt.validity-in-ms" : "$DEFAULT_JWT_VALIDITY_IN_MS", | ||
"session.ban-for-in-hours" : "$SESSION_BAN_FOR_IN_HOURS", | ||
"session.max-login-attempts" : "$SESSION_MAX_LOGIN_ATTEMPTS" | ||
}' | ||
|
||
app-db: | ||
image: postgres:latest | ||
ports: | ||
- "${POSTGRES_LOCAL_PORT}:${POSTGRES_DOCKER_PORT}" | ||
env_file: ./.env | ||
expose: | ||
- $POSTGRES_DOCKER_PORT | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=admin | ||
- POSTGRES_DB_PASSWORD=$DATABASE_PASSWORD | ||
- POSTGRES_DB_USER=$DATABASE_USER | ||
- POSTGRES_DB_NAME=$DATABASE_NAME | ||
volumes: | ||
- ./db:/docker-entrypoint-initdb.d/ |
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