From cfcde0ceb46eaf2636fb0f0902d427aeba954455 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 13 Aug 2024 22:15:07 +0000 Subject: [PATCH] Add MARIADB_ROOT_PASSWORD for MariaDB initialization Update run-opensim.sh to load os-secrets for DB initialization. Rename OS_BRANCH to OS_GIT_BRANCH Rename OS_REPO to OS_GIT_REPO Eliminate OPENSIM_USER and OPENSIM_USER_PASSWORD from os-secrets as they are not used. --- image-ncg/Dockerfile-ncg | 10 +++++----- image-ncg/build-ncg.sh | 4 ++-- image-ncg/config-standalone/os-secrets | 3 +-- image-ncg/docker-compose.yml | 1 + image-ncg/env | 8 ++++---- image-ncg/run-opensim.sh | 9 +++++++++ image-opensim-herbal3d/Dockerfile-herbal3d | 6 +++--- image-opensim-herbal3d/build-herbal3d.sh | 2 +- .../config/config-basilalpha/os-secrets | 5 +---- .../config/config-standalone/os-secrets | 4 +--- image-opensim/Dockerfile-opensim | 10 +++++----- image-opensim/build-opensim.sh | 4 ++-- image-opensim/config-osgrid/os-secrets | 3 +-- image-opensim/config-standalone/os-secrets | 3 +-- image-opensim/docker-compose.yml | 1 + image-opensim/env | 6 +++--- image-opensim/run-opensim.sh | 8 ++++++++ run-scripts/bootOpenSim.sh | 2 +- run-scripts/getVersion.sh | 2 +- 19 files changed, 51 insertions(+), 40 deletions(-) diff --git a/image-ncg/Dockerfile-ncg b/image-ncg/Dockerfile-ncg index 0375db3..bb2aa5f 100644 --- a/image-ncg/Dockerfile-ncg +++ b/image-ncg/Dockerfile-ncg @@ -16,8 +16,8 @@ ARG VERSIONDIR=/home/opensim/VERSION ARG OS_ACCOUNT=opensim # Arguments for fetching the proper version of OpenSimulator -ARG OS_REPO=https://github.com/OpenSim-NGC/OpenSim-Sasquatch.git -ARG OS_BRANCH=develop +ARG OS_GIT_REPO=https://github.com/OpenSim-NGC/OpenSim-Sasquatch.git +ARG OS_GIT_BRANCH=develop ARG OS_BUILDTARGET=Release ARG OS_SLN=OpenSim.sln @@ -57,12 +57,12 @@ RUN mkdir -p $VERSIONDIR \ # Fetch the latest version of the NCG sources. RUN cd $OPENSIMHOME \ - && git clone --depth=1 -b $OS_BRANCH --single-branch $OS_REPO opensim + && git clone --depth=1 -b $OS_GIT_BRANCH --single-branch $OS_GIT_REPO opensim # Extract version information from the fetched sources RUN cd $OPENSIMDIR \ - && echo $OS_REPO > "$VERSIONDIR/OS_GIT_REPO" \ - && echo $OS_BRANCH > "$VERSIONDIR/OS_GIT_BRANCH" \ + && echo $OS_GIT_REPO > "$VERSIONDIR/OS_GIT_REPO" \ + && echo $OS_GIT_BRANCH > "$VERSIONDIR/OS_GIT_BRANCH" \ && echo $OS_BUILDTARGET > "$VERSIONDIR/OS_BUILD_TARGET" \ && git describe --tags --long --always > "$VERSIONDIR/OS_GIT_DESCRIBE" \ && git rev-parse HEAD > "$VERSIONDIR/OS_GIT_COMMIT" \ diff --git a/image-ncg/build-ncg.sh b/image-ncg/build-ncg.sh index 369462e..ab03bcf 100755 --- a/image-ncg/build-ncg.sh +++ b/image-ncg/build-ncg.sh @@ -26,8 +26,8 @@ docker build \ --build-arg OS_DOCKER_GIT_BRANCH=$OS_DOCKER_GIT_BRANCH \ --build-arg OS_DOCKER_GIT_COMMIT=$OS_DOCKER_GIT_COMMIT \ --build-arg OS_DOCKER_GIT_COMMIT_SHORT=$OS_DOCKER_GIT_COMMIT_SHORT \ - --build-arg OS_REPO=$OS_REPO \ - --build-arg OS_BRANCH=$OS_BRANCH \ + --build-arg OS_GIT_REPO=$OS_GIT_REPO \ + --build-arg OS_GIT_BRANCH=$OS_GIT_BRANCH \ --build-arg OS_BUILDTARGET=$OS_BUILDTARGET \ --build-arg OS_SLN=$OS_SLN \ -t "$IMAGE_NAME" \ diff --git a/image-ncg/config-standalone/os-secrets b/image-ncg/config-standalone/os-secrets index 7d878a6..7c75b4e 100644 --- a/image-ncg/config-standalone/os-secrets +++ b/image-ncg/config-standalone/os-secrets @@ -17,13 +17,12 @@ # If this next variable is defined, MYSQL is configured export MYSQL_ROOT_PASSWORD=unknownStuff +export MARIADB_ROOT_PASSWORD=unknownStuff export MYSQL_DB_HOST=dbservice export MYSQL_DB_DB=opensim export MYSQL_DB_USER=opensim export MYSQL_DB_USER_PW=moreUnknownStuff -export OPENSIM_USER=opensim - # The following are used to initialize estate if running standalone export DEFAULT_ESTATE_NAME="MyEstate" export DEFAULT_ESTATE_OWNER="Donald Duck" diff --git a/image-ncg/docker-compose.yml b/image-ncg/docker-compose.yml index de146b0..213b345 100644 --- a/image-ncg/docker-compose.yml +++ b/image-ncg/docker-compose.yml @@ -11,6 +11,7 @@ services: image: mariadb:latest environment: MYSQL_ROOT_PASSWORD: + MARIADB_ROOT_PASSWORD: # Parameters added to invocation. # Default is to flush after every operation which slows Docker image down. # This flushes log once a second. diff --git a/image-ncg/env b/image-ncg/env index d6ed3cb..f047e5f 100644 --- a/image-ncg/env +++ b/image-ncg/env @@ -9,10 +9,10 @@ # assignment file and a docker-compose env-file # The sources to build -OS_REPO=https://github.com/OpenSim-NGC/OpenSim-Sasquatch.git -# OS_BRANCH=develop -# OS_BRANCH=opensim-rel-0.9.3.8940 -OS_BRANCH=opensim-rel-0.9.3.8984 +OS_GIT_REPO=https://github.com/OpenSim-NGC/OpenSim-Sasquatch.git +# OS_GIT_BRANCH=develop +# OS_GIT_BRANCH=opensim-rel-0.9.3.8940 +OS_GIT_BRANCH=opensim-rel-0.9.3.8984 OS_BUILDTARGET=Release OS_SLN=OpenSim.sln diff --git a/image-ncg/run-opensim.sh b/image-ncg/run-opensim.sh index 75a3685..c245dc8 100755 --- a/image-ncg/run-opensim.sh +++ b/image-ncg/run-opensim.sh @@ -14,7 +14,14 @@ BASE=$(pwd) # source ./envToEnvironment.sh source ./env +# The selects the configuration to mount and use in the Docker image export OS_CONFIG=${OS_CONFIG:-standalone} +echo "Using configuration \"$OS_CONFIG\"" + +# Get the secrets for the environment +# (the following 'export' fakes out 'setEnvironment' to use the local directory +export OPENSIMCONFIG=${BASE}/config-${OS_CONFIG} +source ${OPENSIMCONFIG}/scripts/setEnvironment.sh # Local directory for storage of sql persistant data (so region # contents persists between container restarts). @@ -25,6 +32,8 @@ if [[ ! -d "$HOME/opensim-sql-data" ]] ; then chmod o+w "$HOME/opensim-sql-data" fi +cd "${BASE}" + # https://docs.docker.com/engine/security/userns-remap/ # --userns-remap="opensim:opensim" docker-compose \ diff --git a/image-opensim-herbal3d/Dockerfile-herbal3d b/image-opensim-herbal3d/Dockerfile-herbal3d index 0e6b31e..89e2983 100644 --- a/image-opensim-herbal3d/Dockerfile-herbal3d +++ b/image-opensim-herbal3d/Dockerfile-herbal3d @@ -18,8 +18,8 @@ ARG OS_DOCKER_GIT_COMMIT ARG OS_DOCKER_GIT_COMMIT_SHORT # Arguments for fetching OpenSimulator -ARG OS_REPO=git://opensimulator.org/git/opensim -ARG OS_BRANCH=dotnet6 +ARG OS_GIT_REPO=git://opensimulator.org/git/opensim +ARG OS_GIT_BRANCH=dotnet6 # Each of the different packages can have their branch over-ridden with a --build-arg ARG COMMON_ENTITIES_BRANCH=dotnet6 @@ -66,7 +66,7 @@ RUN mkdir -p $VERSIONDIR \ # Fetch the latest version of the OpenSimulator sources. RUN cd /home/opensim \ - && git clone --depth=1 -b $OS_BRANCH --single-branch $OS_REPO opensim + && git clone --depth=1 -b $OS_GIT_BRANCH --single-branch $OS_GIT_REPO opensim RUN cd $OPENSIMDIR/addon-modules/ \ && git clone --depth=1 -b $COMMON_ENTITIES_BRANCH --single-branch https://github.com/Herbal3d/HerbalCommonEntitiesCS.git diff --git a/image-opensim-herbal3d/build-herbal3d.sh b/image-opensim-herbal3d/build-herbal3d.sh index 13d64e5..ce84872 100755 --- a/image-opensim-herbal3d/build-herbal3d.sh +++ b/image-opensim-herbal3d/build-herbal3d.sh @@ -15,7 +15,7 @@ cp -r ../run-scripts temp-run-scripts # Note that the '--no-cache' can be added force refetching of the OpenSimulator git sources # --no-cache -# As of 20220320, the Prebuild needed for Herbal3d is in a branch (setting of OS_BRANCH) +# As of 20220320, the Prebuild needed for Herbal3d is in a branch (setting of OS_GIT_BRANCH) docker build \ --build-arg BUILD_DATE=$BUILD_DATE \ --build-arg BUILD_DAY=$BUILD_DAY \ diff --git a/image-opensim-herbal3d/config/config-basilalpha/os-secrets b/image-opensim-herbal3d/config/config-basilalpha/os-secrets index 387150a..ed08b59 100644 --- a/image-opensim-herbal3d/config/config-basilalpha/os-secrets +++ b/image-opensim-herbal3d/config/config-basilalpha/os-secrets @@ -16,16 +16,13 @@ # ccrypt -d -E "CONFIGKEY" < os-secrets.crypt # If this next variable is defined, MYSQL is configured -export MYSQL_ROOT_ACCOUNT=root export MYSQL_ROOT_PASSWORD=NotFoundAnywhere +export MARIADB_ROOT_PASSWORD=NotFoundAnywhere export MYSQL_DB_SOURCE=dbservice export MYSQL_DB_DB=opensim export MYSQL_DB_USER=opensim export MYSQL_DB_USER_PASSWORD=StuffAndNonsense -export OPENSIM_USER=opensim -export OPENSIM_USER_PASSWORD=unknownPassword - # The following are used to initialize estate if running standalone export DEFAULT_ESTATE_NAME="Basil Estate" export DEFAULT_ESTATE_OWNER="Donald Duck" diff --git a/image-opensim-herbal3d/config/config-standalone/os-secrets b/image-opensim-herbal3d/config/config-standalone/os-secrets index 08bcdc4..4ff0336 100644 --- a/image-opensim-herbal3d/config/config-standalone/os-secrets +++ b/image-opensim-herbal3d/config/config-standalone/os-secrets @@ -17,14 +17,12 @@ # If this next variable is defined, MYSQL is configured #export MYSQL_ROOT_PASSWORD=unknownStuff +#export MARIADB_ROOT_PASSWORD=unknownStuff export MYSQL_DB_SOURCE=localhost export MYSQL_DB_DB=opensim export MYSQL_DB_USER=opensim export MYSQL_DB_USER_PASSWORD=dbpassword -export OPENSIM_USER=opensim -export OPENSIM_USER_PASSWORD=unknownPassword - # The following are used to initialize estate if running standalone export DEFAULT_ESTATE_NAME="Donalds Estate" export DEFAULT_ESTATE_OWNER="Donald Duck" diff --git a/image-opensim/Dockerfile-opensim b/image-opensim/Dockerfile-opensim index 49d556c..7881f28 100644 --- a/image-opensim/Dockerfile-opensim +++ b/image-opensim/Dockerfile-opensim @@ -16,8 +16,8 @@ ARG VERSIONDIR=/home/opensim/VERSION ARG OS_ACCOUNT=opensim # Arguments for fetching the proper version of OpenSimulator -ARG OS_REPO=git://opensimulator.org/git/opensim -ARG OS_BRANCH=mster +ARG OS_GIT_REPO=git://opensimulator.org/git/opensim +ARG OS_GIT_BRANCH=master ARG OS_BUILDTARGET=Release ARG OS_SLN=OpenSim.sln @@ -57,12 +57,12 @@ RUN mkdir -p $VERSIONDIR \ # Fetch the latest version of the OpenSimulator sources. RUN cd $OPENSIMHOME \ - && git clone --depth=1 -b $OS_BRANCH --single-branch $OS_REPO opensim + && git clone --depth=1 -b $OS_GIT_BRANCH --single-branch $OS_GIT_REPO opensim # Extract version information from the fetched sources RUN cd $OPENSIMDIR \ - && echo $OS_REPO > "$VERSIONDIR/OS_GIT_REPO" \ - && echo $OS_BRANCH > "$VERSIONDIR/OS_GIT_BRANCH" \ + && echo $OS_GIT_REPO > "$VERSIONDIR/OS_GIT_REPO" \ + && echo $OS_GIT_BRANCH > "$VERSIONDIR/OS_GIT_BRANCH" \ && echo $OS_BUILDTARGET > "$VERSIONDIR/OS_BUILD_TARGET" \ && git describe --tags --long --always > "$VERSIONDIR/OS_GIT_DESCRIBE" \ && git rev-parse HEAD > "$VERSIONDIR/OS_GIT_COMMIT" \ diff --git a/image-opensim/build-opensim.sh b/image-opensim/build-opensim.sh index f33374b..dcb9679 100755 --- a/image-opensim/build-opensim.sh +++ b/image-opensim/build-opensim.sh @@ -26,8 +26,8 @@ docker build \ --build-arg OS_DOCKER_GIT_BRANCH=$OS_DOCKER_GIT_BRANCH \ --build-arg OS_DOCKER_GIT_COMMIT=$OS_DOCKER_GIT_COMMIT \ --build-arg OS_DOCKER_GIT_COMMIT_SHORT=$OS_DOCKER_GIT_COMMIT_SHORT \ - --build-arg OS_REPO=$OS_REPO \ - --build-arg OS_BRANCH=$OS_BRANCH \ + --build-arg OS_GIT_REPO=$OS_GIT_REPO \ + --build-arg OS_GIT_BRANCH=$OS_GIT_BRANCH \ --build-arg OS_BUILDTARGET=$OS_BUILDTARGET \ --build-arg OS_SLN=$OS_SLN \ -t "$IMAGE_NAME" \ diff --git a/image-opensim/config-osgrid/os-secrets b/image-opensim/config-osgrid/os-secrets index 7d878a6..7c75b4e 100644 --- a/image-opensim/config-osgrid/os-secrets +++ b/image-opensim/config-osgrid/os-secrets @@ -17,13 +17,12 @@ # If this next variable is defined, MYSQL is configured export MYSQL_ROOT_PASSWORD=unknownStuff +export MARIADB_ROOT_PASSWORD=unknownStuff export MYSQL_DB_HOST=dbservice export MYSQL_DB_DB=opensim export MYSQL_DB_USER=opensim export MYSQL_DB_USER_PW=moreUnknownStuff -export OPENSIM_USER=opensim - # The following are used to initialize estate if running standalone export DEFAULT_ESTATE_NAME="MyEstate" export DEFAULT_ESTATE_OWNER="Donald Duck" diff --git a/image-opensim/config-standalone/os-secrets b/image-opensim/config-standalone/os-secrets index 7d878a6..7c75b4e 100644 --- a/image-opensim/config-standalone/os-secrets +++ b/image-opensim/config-standalone/os-secrets @@ -17,13 +17,12 @@ # If this next variable is defined, MYSQL is configured export MYSQL_ROOT_PASSWORD=unknownStuff +export MARIADB_ROOT_PASSWORD=unknownStuff export MYSQL_DB_HOST=dbservice export MYSQL_DB_DB=opensim export MYSQL_DB_USER=opensim export MYSQL_DB_USER_PW=moreUnknownStuff -export OPENSIM_USER=opensim - # The following are used to initialize estate if running standalone export DEFAULT_ESTATE_NAME="MyEstate" export DEFAULT_ESTATE_OWNER="Donald Duck" diff --git a/image-opensim/docker-compose.yml b/image-opensim/docker-compose.yml index de06b1d..75d25f6 100644 --- a/image-opensim/docker-compose.yml +++ b/image-opensim/docker-compose.yml @@ -11,6 +11,7 @@ services: image: mariadb:latest environment: MYSQL_ROOT_PASSWORD: + MARIADB_ROOT_PASSWORD: # Parameters added to invocation. # Default is to flush after every operation which slows Docker image down. # This flushes log once a second. diff --git a/image-opensim/env b/image-opensim/env index 18425cb..c39ead0 100644 --- a/image-opensim/env +++ b/image-opensim/env @@ -9,9 +9,9 @@ # assignment file and a docker-compose env-file # The sources to build -OS_REPO=git://opensimulator.org/git/opensim -OS_BRANCH=master -# OS_BRANCH=opensim-rel-0.9.3.8940 +OS_GIT_REPO=git://opensimulator.org/git/opensim +OS_GIT_BRANCH=master +# OS_GIT_BRANCH=opensim-rel-0.9.3.8940 OS_BUILDTARGET=Release OS_SLN=OpenSim.sln diff --git a/image-opensim/run-opensim.sh b/image-opensim/run-opensim.sh index 373fec9..c245dc8 100755 --- a/image-opensim/run-opensim.sh +++ b/image-opensim/run-opensim.sh @@ -14,9 +14,15 @@ BASE=$(pwd) # source ./envToEnvironment.sh source ./env +# The selects the configuration to mount and use in the Docker image export OS_CONFIG=${OS_CONFIG:-standalone} echo "Using configuration \"$OS_CONFIG\"" +# Get the secrets for the environment +# (the following 'export' fakes out 'setEnvironment' to use the local directory +export OPENSIMCONFIG=${BASE}/config-${OS_CONFIG} +source ${OPENSIMCONFIG}/scripts/setEnvironment.sh + # Local directory for storage of sql persistant data (so region # contents persists between container restarts). # This must be the same directory as in $COMPOSEFILE @@ -26,6 +32,8 @@ if [[ ! -d "$HOME/opensim-sql-data" ]] ; then chmod o+w "$HOME/opensim-sql-data" fi +cd "${BASE}" + # https://docs.docker.com/engine/security/userns-remap/ # --userns-remap="opensim:opensim" docker-compose \ diff --git a/run-scripts/bootOpenSim.sh b/run-scripts/bootOpenSim.sh index 3cd3503..32057ba 100755 --- a/run-scripts/bootOpenSim.sh +++ b/run-scripts/bootOpenSim.sh @@ -15,7 +15,7 @@ export OPENSIMCONFIG=$OPENSIMBIN/config # Start Opensim echo "Starting OpenSimulator version $(cat $VERSIONDIR/OS_VERSION)" -echo " built from branch $(cat $VERSIONDIR/OS_BRANCH)" +echo " built from branch $(cat $VERSIONDIR/OS_GIT_BRANCH)" echo " with opensim-docker version $(cat $VERSIONDIR/OS_DOCKER_IMAGE_VERSION)" echo " using configuration set \"$OS_CONFIG\"" diff --git a/run-scripts/getVersion.sh b/run-scripts/getVersion.sh index ec23977..a6be61b 100755 --- a/run-scripts/getVersion.sh +++ b/run-scripts/getVersion.sh @@ -17,7 +17,7 @@ for valueName in * ; do done if [[ -z "$part" ]] ; then - echo "${OS_VERSION}-${OS_BRANCH}-${OS_GIT_COMMIT_SHORT}-${BUILD_DATE}/${OS_DOCKER_IMAGE_VERSION}" + echo "${OS_VERSION}-${OS_GIT_BRANCH}-${OS_GIT_COMMIT_SHORT}-${BUILD_DATE}/${OS_DOCKER_IMAGE_VERSION}" else cat ${VERSIONDIR}/$part fi