square / keywhiz

A system for distributing and managing secrets

Home Page:https://square.github.io/keywhiz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker run error - Detected resolved migration not applied to database: 1

thatarchguy opened this issue · comments

commented

I'm running the exact commands in the Dockerfile.

The docker build succeeded.
docker build --rm --force-rm -t square/keywhiz .

[...]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Keywhiz (Parent) ................................... SUCCESS [ 17.182 s]
[INFO] Keywhiz Testing .................................... SUCCESS [ 15.355 s]
[INFO] Keywhiz API ........................................ SUCCESS [  8.400 s]
[INFO] Keywhiz Client ..................................... SUCCESS [  0.770 s]
[INFO] Keywhiz CLI ........................................ SUCCESS [ 11.038 s]
[INFO] Keywhiz HKDF ....................................... SUCCESS [  0.884 s]
[INFO] Keywhiz Model ...................................... SUCCESS [  8.718 s]
[INFO] Keywhiz Server ..................................... SUCCESS [01:36 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:43 min
[INFO] Finished at: 2016-02-12T17:03:20+00:00
[INFO] Final Memory: 135M/508M
[INFO] ------------------------------------------------------------------------
 ---> 7b293f69d815
Removing intermediate container 14c90af690e3
Successfully built 7b293f69d815

It fails when trying to run.
docker run square/keywhiz sh -c "java -jar server/target/keywhiz-server-*-SNAPSHOT-shaded.jar server server/src/main/resources/keywhiz-development.yaml"

INFO  [2016-02-12 17:06:20,587] org.eclipse.jetty.util.log: Logging initialized @1627ms
INFO  [2016-02-12 17:06:20,719] keywhiz.UiAssetsBundle: Configuring UI path from JAR resources
INFO  [2016-02-12 17:06:21,140] keywhiz.service.config.Templates: Reading configuration value from file server/src/main/resources/dev_and_test_cookiekey.base64
INFO  [2016-02-12 17:06:22,001] keywhiz.service.config.KeyStoreConfig: Opening keystore at resource path jar:file:/usr/src/app/server/target/keywhiz-server-0.7.11-SNAPSHOT-shaded.jar!/derivation.jceks
INFO  [2016-02-12 17:06:22,165] org.flywaydb.core.internal.util.VersionPrinter: Flyway 3.2.1 by Boxfuse
INFO  [2016-02-12 17:06:22,179] org.flywaydb.core.internal.dbsupport.DbSupportFactory: Database: jdbc:h2:/tmp/h2_data/keywhizdb_development (H2 1.4)
INFO  [2016-02-12 17:06:22,378] org.flywaydb.core.internal.command.DbValidate: Validated 22 migrations (execution time 00:00.122s)
Exception in thread "main" org.flywaydb.core.api.FlywayException: Validate failed. Detected resolved migration not applied to database: 1
    at org.flywaydb.core.Flyway.doValidate(Flyway.java:1108)
    at org.flywaydb.core.Flyway.access$300(Flyway.java:62)
    at org.flywaydb.core.Flyway$2.execute(Flyway.java:1081)
    at org.flywaydb.core.Flyway$2.execute(Flyway.java:1076)
    at org.flywaydb.core.Flyway.execute(Flyway.java:1418)
    at org.flywaydb.core.Flyway.validate(Flyway.java:1076)
    at keywhiz.KeywhizService.validateDabase(KeywhizService.java:215)
    at keywhiz.KeywhizService.run(KeywhizService.java:205)
    at keywhiz.KeywhizService.run(KeywhizService.java:79)
    at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
    at io.dropwizard.cli.Cli.run(Cli.java:70)
    at io.dropwizard.Application.run(Application.java:73)
    at keywhiz.KeywhizService.main(KeywhizService.java:86)

That error means the database isn't running the expected schema. Try running this command first:

docker run square/keywhiz sh -c "java -jar server/target/keywhiz-server-*-SNAPSHOT-shaded.jar migrate server/src/main/resources/keywhiz-development.yaml"

That should run the "migration" scripts to set up the db