Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow startup args to be specified by envvar as well as CMD #831

Closed
shabble opened this issue Apr 8, 2021 · 1 comment
Closed

Allow startup args to be specified by envvar as well as CMD #831

shabble opened this issue Apr 8, 2021 · 1 comment
Labels
Request Request for image modification or feature

Comments

@shabble
Copy link

shabble commented Apr 8, 2021

The ability to configure various simple aspects via the -c shared_preload_libraries=foo etc is really helpful, but unfortunately Github Actions doesn't allow configuration of the CMD parameter when using a container as a supporting service for a CI job.

This means that at the moment, I don't think there's any good way to make these sorts of startup config changes that can work within Github Actions without making a (granted, very simple) derivative image. The main reason against just doing that is having to keep up to date with new releases of the base-image.

My current solution is an entrypoint-wrapper that just checks if a specific var exists, and adds that to the invocatino of the postgres docker-entrypoint.sh if so, but I wonder if it might be worth considering for the core postgres image?

#826 makes it look like maybe a hard sell, but this has the advantage(?) of being much more general than specific vars for every different usecase.

The actual wrapper/logic could be something like:

#!/usr/bin/env bash
set -eux
if [[ -v "PG_EXTRA_STARTUP_ARGS" ]]; then
    exec /docker-entrypoint.sh $PG_EXTRA_STARTUP_ARGS "$@"
else
    exec /docker-entrypoint.sh "$@" 
fi

(although really, it would be better integrated into the existing docker-entrypoint, I just didn't want to meddle with it downstream...)

and then invoked by
docker run -e 'PG_EXTRA_STARTUP_ARGS=postgres -c shared_preload_libraries=pg_stat_statements' postgres or similar.

Any thoughts?

@wglambert wglambert added the Request Request for image modification or feature label Apr 8, 2021
@yosifkit
Copy link
Member

yosifkit commented Apr 8, 2021

We've had the same request in the past for the docker image but for GitLab CI (like docker-library/docker#12) and my response is the same for GitHub Actions:

This sounds like a failing of the docker [service] runner in the [GitHub Actions]. The services [and container objects should really just include entrypoint and command support].

I would probably work around it by just using the shell runner since the yaml syntax is limited, but there would be extra concerns like the need to clean up the containers at the end or on error that the docker runner probably just does for you.

- docker-library/docker#12 (comment)

(and they eventually realized that customizing the command of a service was useful: https://docs.gitlab.com/ee/ci/services/#setting-a-command-for-the-service)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request Request for image modification or feature
Projects
None yet
Development

No branches or pull requests

3 participants