Lagom deployment: how to add a custom script & invoke before the service starts

My App has two services 1. Authorization Gateway 2. REST API with Cassandra Persistence, I am also using cassandra for backend.

Cassandra connection uses SSL which means I need to run a custom script to pull SSL keys before the service starts as I am passing the keys as java options. I am not able to add my custom script to the docker image and invoke it. Could you suggest how do I do that?

I tried to add a custom docker image with my custom script included but sbt didn’t like it when I used, even if it works how do I invoke my custom script? Looks like Lagom is generating a bootstrap shell script, is there a way to customize it?

dockerBaseImage := “gcr.io/project-xyz/image-xyz:latest

Also, could you direct me to any references on deploying Lagom services to Google Kubernetes Engine.

Lagom builds on sbt-native-packager for Docker image creation. It supports a lot of configurability, including a custom image entrypoint, or customizing the generated launch script. As Lagom builds on Play as the server framework, it makes use of the Play packaging support in sbt-native-packager.

https://sbt-native-packager.readthedocs.io/en/latest/formats/docker.html

https://sbt-native-packager.readthedocs.io/en/latest/formats/universal.html

https://sbt-native-packager.readthedocs.io/en/latest/recipes/play.html

https://sbt-native-packager.readthedocs.io/en/latest/archetypes/java_app/customize.html#start-script-customizations

Thanks a lot for the response Tim. I will look into these documents. I was able to fix the custom docker image issue after looking into sbt-native-packger documentation. I think the most important command I was missing was docker:stage from sbt command line. It gave me access to expected Docerfile (target/docker/stage/Dockerfile). Also, it didn’t like my custom dockerBaseImage as I was using full image path instead of just the name, in this case gcr.io/project-id/lagom-base instead of just lagom-base. I am far from complete deployment but definitely not stuck anymore, hopefully shopping-cart example would guide me from here on.

.settings(lagomForkedTestSettings)
.settings(
   dockerBaseImage := "lagom-base",
   dockerAlias := dockerAlias.value.withRegistryHost(Option("gcr.io/project-id"))
)

Once again, thanks a lot.