Add configuration to allow internal and external configuration.

Default to external files (mounted 'config/').
This commit is contained in:
Robert Adams
2022-02-06 03:22:42 +00:00
parent 479aa9114a
commit 3c3c2acce7
7 changed files with 98 additions and 11 deletions
@@ -0,0 +1,45 @@
version: '3'
services:
dbservice:
# MySql version 8 requires a bunch of new security stuff. Stay with v5.
# image: mysql:5
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD:
# Parameters added to invocation.
# Default is to flush after every operation which slows Docker image down.
# This flushes log once a second.
command: --innodb_flush_log_at_trx_commit=2 --sync_binlog=0
volumes:
# NOTE: you must create this directory before starting the simulator
# This mysql data directory can be placed anywhere
- ~/opensim-sql-data:/var/lib/mysql
# restart: always
opensim:
depends_on:
- dbservice
image: opensim-opensim
environment:
CONFIG_NAME:
CONFIGKEY:
EXTERNAL_HOSTNAME:
volumes:
- ./config:/home/opensim/opensim/bin/config
ports:
- 8002:8002/tcp
- 8002:8002/udp
- 9000:9000/tcp
- 9000:9000/udp
- 9010:9010/tcp
- 9010:9010/udp
links:
- dbservice:dbservice
# restart: always
@@ -29,8 +29,9 @@ services:
CONFIGKEY:
EXTERNAL_HOSTNAME:
volumes:
- ./config:/home/opensim/opensim/bin/config
# If the configuration is outside the container.
# volumes:
# - ./config:/home/opensim/opensim/bin/config
ports:
- 8002:8002/tcp
@@ -0,0 +1,24 @@
version: '3'
services:
opensim:
image: opensim-opensim
environment:
- CONFIGKEY
- CONFIG_NAME
- EXTERNAL_HOSTNAME
volumes:
- ./config:/home/opensim/opensim/bin/config
ports:
- 8002:8002/tcp
- 8002:8002/udp
- 9000:9000/tcp
- 9000:9000/udp
- 9010:9010/tcp
- 9010:9010/udp
# restart: always
@@ -10,8 +10,9 @@ services:
- CONFIG_NAME
- EXTERNAL_HOSTNAME
volumes:
- ./config:/home/opensim/opensim/bin/config
# If the configuration is outside of the container
# volumes:
# - ./config:/home/opensim/opensim/bin/config
ports:
- 8002:8002/tcp
+1 -1
View File
@@ -23,7 +23,7 @@ if [[ ! -z "$MYSQL_ROOT_PASSWORD" ]] ; then
done
SQLCMDS=/tmp/mymy$$
SQLOPTIONS=tmp/mymyoptions$$
SQLOPTIONS=/tmp/mymyoptions$$
rm -f "$SQLCMDS"
rm -f "$SQLOPTIONS"
@@ -7,7 +7,7 @@ OPENSIMBIN=${OPENSIMBIN:-/home/opensim/opensim/bin}
# For this image, CONFIG_NAME is the configuration being used
CONFIG_NAME=${CONFIG_NAME:-standalone}
CONFIGDIR=${OPENSIMBIN}/config/${CONFIG_NAME}
CONFIGDIR=${OPENSIMBIN}/config/config-${CONFIG_NAME}
cd "$CONFIGDIR"
source ../scripts/setEnvironment.sh
+21 -5
View File
@@ -10,6 +10,13 @@
# CONFIG_NAME=nameOfRunConfiguration (default 'standalone' of not supplied)
# EXTERNAL_HOSTNAME=IPorDNSnameForSimulator
# If this environment variable is defined, the configuration files are updated with
# configuration values in the container (at container runtime). Otherwise, the
# configuration files are updated with values external to the container (in the
# filesystem of the invoker and the internal directory 'bin/config/ is mounted
# as the local 'config' directory.
# export OS_DOCKER_CONTAINER_CONFIG="yes"
BASE=$(pwd)
if [[ -z "$EXTERNAL_HOSTNAME" ]] ; then
@@ -25,14 +32,23 @@ export CONFIG_NAME=${CONFIG_NAME:-standalone}
# This export fakes out the environment setup script to look for files in
# build environment rather than in run environment.
export OPENSIMBIN=$BASE
source config/scripts/setEnvironment.sh
unset OPENSIMBIN
# if configuration files are external to the container, run the configuration
if [[ -z "$OS_DOCKER_CONTAINER_CONFIG" ]] ; then
echo "opensim-docker: running configuration file initialization"
config/scripts/updateConfigFiles.sh
else
echo "opensim-docker: delaying configuration file initialization to configuration start"
# Just set the configuration variables into the environment
source config/scripts/setEnvironment.sh
fi
# Use the generic docker-compose file or the one specific to the configuration if it exists
cd "$BASE"
COMPOSEFILE=./docker-compose.yml
if [[ -e "config/config-${CONFIG_NAME}/docker-compose.yml" ]] ; then
COMPOSEFILE="config/config-${CONFIG_NAME}/docker-compose.yml"
COMPOSEFILE="config/config-${CONFIG_NAME}/docker-compose.yml"
if [[ -z "$OS_DOCKER_CONTAINER_CONFIG" ]] ; then
# if using external configuration, include docker-compose with the mount
COMPOSEFILE="config/config-${CONFIG_NAME}/docker-compose-external-config.yml"
fi
# Local directory for storage of sql persistant data (so region