Skip to content

Commit

Permalink
#86 Wait for a database before service run
Browse files Browse the repository at this point in the history
  • Loading branch information
vityaman committed Apr 25, 2024
1 parent f5cde92 commit ef69424
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ class LiquibaseMigration(
@Suppress("Deprecation")
fun start() {
val resources = ClassLoaderResourceAccessor(javaClass.classLoader)
println("Migration::start")
source.connection.use { connection ->
val database = DatabaseFactory.getInstance()
.findCorrectDatabaseImplementation(JdbcConnection(connection))
Liquibase(changelog.pathString, resources, database).use {
it.update("development")
}
}
println("Migration::end")
}
}
12 changes: 10 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,26 @@ services:
- "8080:8080"
networks:
- lms-network
depends_on:
database:
condition: service_healthy
database:
container_name: lms-database
image: postgres
restart: always
ports:
- "5432:5432"
volumes:
- ./botalka/src/main/resources/database:/docker-entrypoint-initdb.d
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
networks:
- lms-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
grafana:
container_name: lms-grafana
build:
Expand Down Expand Up @@ -59,6 +65,8 @@ services:
- lms-network
profiles:
- fuzzing
depends_on:
- botalka
networks:
lms-network:
driver: bridge

0 comments on commit ef69424

Please sign in to comment.