Following the approach taken in aerogear-app-metrics:
- resource/ image definitions: -- [postgres db image definition|https://github.com/aerogear/aerogear-app-metrics/blob/c37fb04460868d64a5b6a1ab22860b1b55b848d4/openshift-template.yml#L98-L128] -- [docker-compose.yml|https://github.com/aerogear/aerogear-app-metrics/blob/c37fb04460868d64a5b6a1ab22860b1b55b848d4/docker-compose.yml#L4-L11] -- [CI config|https://github.com/aerogear/aerogear-app-metrics/blob/fc70de7e74d35274f98899faa775191c01c07969/.circleci/config.yml#L9-L17]
- actual setup in code: -- initialised in [main.go|https://github.com/aerogear/aerogear-app-metrics/blob/c37fb04460/cmd/metrics-api/metrics-api.go#L31] -- db setup logic housed in a [dedicated setup.go file|https://github.com/aerogear/aerogear-app-metrics/blob/c37fb04460/internal/setup/setup.go#L27-L42] -- which defers to [db initialisation & setup logic|https://github.com/aerogear/aerogear-app-metrics/blob/c37fb04460868d64a5b6a1ab22860b1b55b848d4/pkg/dao/db.go] kept in a dedicated dao db file, but we can add this to our repository.go file where we are keeping our db logic I think -- drawing on [config for db setup|https://github.com/aerogear/aerogear-app-metrics/blob/c37fb04460868d64a5b6a1ab22860b1b55b848d4/pkg/config/config.go#L47-L79]
I think this approach can be adopted for creation and setup of postgres db in mobile-security-service. The logic contained in dao/db.go will need to be switched to our db layer.
|
|