Hi,
I’m doing some development with Razuna and have created a docker image based on my local razuna instance, where i’ve done a custom setup. When I stop and restart my Razuna image in Docker, although my Razuna instance comes back up seemingly intact, the api key for my ‘test’ user has changed. Is there anything I can do (or need to do) to make sure the stored api key stays the same (e.g. so i can use Docker + Razuna for repeatable tests)?
API key regenerated (?)
Docker by default does not store data outside if itself unless you tell it to, i.e. any data within is destroyed when restarted.
I suggest you use our Docker script and read the description about volumes.
@Nitai,
thanks for the reply.
My approach has been to create a dockerbuild descriptor that adds java and all dependencies (like ImageMagick) and copies-in the Razuna/tomcat folder, for which I had already done a local setup (added an admin user, added a test user, uploaded some images, tweaked the file path locations for dependencies like ImageMagick so they match the docker target folder locations).
My end goal is to have a docker image that starts a container with a primed Razuna instance that I can use in integration/regression test scenarios - with known assets available at known locations, via the API - and which gets torn down at the end of tests. It almost works: assets are available and served up correctly. I had expected the api key to remain the same - in the same way the loaded assets remain the same following docker container restarts - but perhaps the api key is stored in a different way to images (?). Do you have any thoughts on how I can achieve this use case with a container approach - given a test client needs to know the api key in advance?
If you are using the embedded database, then you might save it to the local disk as well. This is the “db” folder on the root, i.e. razuna/db.
Ok thanks Nitai,
so perhaps if i can expose a port to connect to the H2 db running inside Tomcat, I can issue an INSERT statement (if i can figure out what that should be) as part of the Razuna image start-up or post start-up (?).
Maybe I should just go back to my Docker image and figure out why the API key - which stays the same between local restarts of Razuna - changes with each restart of the Docker image…
Is it significant that, with the H2 embedded database seemingly up and running ok, I still see Tomcat logs (catalina.out) writing (lines truncated in the actual log) like
{ts ‘2018-02-13 10:52:41’} ---------------------- Config Error. Aborting… !!!
±-------------±-
| type | Database
| detail | The datasource razuna_server could not be found or was invalid
| message | General SQL Error
| errorcode | errorCode.sqlError
| extendedinfo | javax.naming.NameNotFoundException: Name [razuna_server] is not bound in this Context. Unable to find [r
| tagcontext | {CFML Type::array}
| tagname | CFQUERY
?
A docker image does not have a persistent storage, every time you start the image it will be “as new”. You need to mount “volumes” in order to make it persistent.