I've been able to get Keywhiz running using the docker container. But the instructions for (and evidently the underlying config file related to) building the database is not working.
When I run the migrate command on the build, instead of creating the database in /data directory, it creates it in files in /tmp/h2_data. When I later try to add a user or do anything with the server, things die on trying to get to the data base:
Exception in thread "main" org.jooq.exception.DataAccessException: SQL [insert into USERS (USERNAME, PASSWORD_HASH, CREATED_AT, UPDATED_AT) values (cast(? as varchar), cast(? as varchar), cast(? as timestamp), cast(? as timestamp))]; Unique index or primary key violation: "PRIMARY_KEY_4 ON PUBLIC.USERS(USERNAME) VALUES ('keywhizadmin', 1)"; SQL statement:
insert into USERS (USERNAME, PASSWORD_HASH, CREATED_AT, UPDATED_AT) values (cast(? as varchar), cast(? as varchar), cast(? as timestamp), cast(? as timestamp)) [23505-187]
at org.jooq_3.10.2.H2.debug(Unknown Source)
at org.jooq.impl.Tools.translate(Tools.java:2194)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:701)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:358)
at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:124)
at keywhiz.service.daos.UserDAO.createUserAt(UserDAO.java:50)
at keywhiz.service.daos.UserDAO.createUser(UserDAO.java:54)
at keywhiz.commands.AddUserCommand.run(AddUserCommand.java:45)
at keywhiz.commands.AddUserCommand.run(AddUserCommand.java:29)
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:72)
Caused by: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "PRIMARY_KEY_4 ON PUBLIC.USERS(USERNAME) VALUES ('keywhizadmin', 1)"; SQL statement:
insert into USERS (USERNAME, PASSWORD_HASH, CREATED_AT, UPDATED_AT) values (cast(? as varchar), cast(? as varchar), cast(? as timestamp), cast(? as timestamp)) [23505-187]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:102)
at org.h2.mvstore.db.MVSecondaryIndex.checkUnique(MVSecondaryIndex.java:233)
at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:191)
at org.h2.mvstore.db.MVTable.addRow(MVTable.java:638)
at org.h2.command.dml.Insert.insertRows(Insert.java:156)
at org.h2.command.dml.Insert.update(Insert.java:114)
at org.h2.command.CommandContainer.update(CommandContainer.java:78)
at org.h2.command.Command.executeUpdate(Command.java:254)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:198)
at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:206)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:426)
at org.jooq.impl.AbstractDMLQuery.execute(AbstractDMLQuery.java:449)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:344)
... 9 more
Where is the right config file that will allow me to create the database properly? The migrate command is not building things properly.