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

Unavailable Docker Arguments #6

Closed
caaumen opened this issue Aug 19, 2019 · 2 comments
Closed

Unavailable Docker Arguments #6

caaumen opened this issue Aug 19, 2019 · 2 comments

Comments

@caaumen
Copy link

caaumen commented Aug 19, 2019

Issue: GPP container requires additional arguments passed to the docker run command that are unavailable in scripts/gpp.sh.

Examples:
Thread Count - GPP is unable to support new components due to max number of threads reading as "1". The non-container GPP normally has this value as 65536.
Using docker run ... --ulimit nproc=65536 ... fixes this issue.

Shared Memory - Docker containers default to a 64MB /dev/shm directory. The non-container GPP normally uses 50% of the RAM size, but containers should use only what is required for the expected application environment.
Using docker run ... --shm-size=<desired memory> ... fixes this issue.

Solution:
To prevent having to add every argument that is normally accepted by the docker run command, adding an --arg argument can offer users the ability to pass arguments through to the command. For the above two examples the gpp could be run via the following command:
./gpp start mGPP --args "--ulimit nproc=65536 --shm-size=256M"

This is possible by changing the scripts/gpp.sh file with the following diff:

--- a/scripts/gpp.sh
+++ b/scripts/gpp.sh
@@ -50,6 +50,7 @@ Usage: $0 start|stop NODE_NAME (options)
        [-g|--gpp    GPP_NAME]    GPP Device name, default is GPP_[UUID]
        [-d|--domain DOMAIN_NAME] Domain Name, default is REDHAWK_DEV
        [-o|--omni   OMNISERVER]  IP to the OmniServer (detected: ${OMNISERVER})
+       [--args <ARGS>]           Additional arguments passed to 'docker run'
        [-p|--print]              Just print resolved settings
 
 Examples:
@@ -106,6 +107,10 @@ while [[ $# -gt 0 ]]; do
                        usage
                        exit 0
                        ;;
+               --args)
+                       ARGUMENTS="${2:?Missing ARGUMENTS Argument}"
+                       shift
+                       ;;
                -p|--print)
                        JUST_PRINT=YES
                        ;;
@@ -127,6 +132,7 @@ fi
 # Enforce defaults
 GPP_NAME=${GPP_NAME:-GPP_$(uuidgen)}
 DOMAIN_NAME=${DOMAIN_NAME:-REDHAWK_DEV}
+ARGUMENTS=${ARGUMENTS:-""}
 
 if ! [ -z ${JUST_PRINT+x} ]; then
        cat <<EOF
@@ -185,6 +191,7 @@ if [[ $COMMAND == "start" ]]; then
                                -e DOMAINNAME=${DOMAIN_NAME} \
                                -e OMNISERVICEIP=${OMNISERVER} \
                                ${NETWORK_ARGS} \
+                               ${ARGUMENTS} \
                                --name ${CONTAINER_NAME} \
                                ${IMAGE_NAME} &> /dev/null

Similar changes could be done to all of the launch scripts to prevent future issues of this same nature.

btgoodwin pushed a commit that referenced this issue Sep 4, 2019
Per #6, it's sometimes helpful to pass additional arguments
to 'docker run', so it has been added to various launcher
scripts where it seemed appropriate.  NOTE: If you use this
to change the --network argument, you will need to handle
this for all containers.

Signed-off-by: Thomas Goodwin <[email protected]>
@btgoodwin
Copy link
Contributor

I apologize for the delay in responding. FWIW, the GPP's failure to correctly parse the ulimit should be fixed soon. All the same, I agree this would add value to several of the container launch scripts (see: 5384831).

@caaumen
Copy link
Author

caaumen commented Sep 12, 2019

Tested updated gpp script and performs as expected! Thanks.

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

No branches or pull requests

2 participants