I have an hawkbit server behind a traefik proxy running on docker-compose
mysql:
image: "mysql:latest"
environment:
MYSQL_DATABASE: "hawkbit"
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
restart: always
ports:
- "3306:3306"
volumes:
mysql-db-data:/var/lib/mysql
labels:
NAME: "mysql"
networks:
hawkbit-network
hawkbit:
image: "hawkbit/hawkbit-update-server:latest-mysql"
environment:
- 'SPRING_DATASOURCE_URL=jdbc:mariadb://mysql:3306/hawkbit'
- 'SPRING_RABBITMQ_HOST=rabbitmq'
- 'SPRING_RABBITMQ_USERNAME=guest'
- 'SPRING_RABBITMQ_PASSWORD=guest'
- 'SPRING_DATASOURCE_USERNAME=root'
volumes:
artifactrepo:/artifactrepo
restart: always
ports:
- "8080:8080"
depends_on:
mysql
labels:
NAME: "hawkbit"
traefik.enable: true
traefik.http.routers.hawkbit.rule: Host(`hawkbit.domain`)
traefik.http.routers.hawkbit.entrypoints: hawkbit
traefik.docker.network: docker-files_traefik-network
traefik.http.services.hawkbit.loadbalancer.server.port: 8080
networks:
hawkbit-network
traefik-network
volumes:
mysql-db-data:
driver: local
artifactrepo:
driver: local
networks:
traefik-network:
hawkbit-network:
Right after the building of the docker compose, everything works fine, I have access to the UI, can connect, save parameters.
But after few hours, hawkbit seems to lost the connection to the database
SQL State : 42000
Error Code : 1049
Message : (conn=82) Unknown database 'hawkbit'
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:60)
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:75)
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:147)
at org.flywaydb.core.Flyway.migrate(Flyway.java:124)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
115 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: (conn=82) Unknown database 'hawkbit'
When I look with docker ps, I see the uptime of mysql container have few hours less than the hawkbit one.
So it's seems to be a volume problems, as mysql container has been rebooted and can't find data.
It's confirmed when I try to restart mysql container, hawkbit one, and both without result, but removing mysql volume and restart both works and it's up for few jours before crashing again.
I don't see where I made a mistake on volume declaration, can it be another problem?
Thanks