From ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 22 May 2019 19:14:35 +1000 Subject: Major tweaking of the scripts to suit the new setup. --- INSTALL.md | 11 +- InstallItAll.sh | 137 +++++++++--------- bin/config-include/config.ini.IG_example | 54 ------- bin/config-include/config.ini.MG_example | 178 ------------------------ bin/config-include/config.ini.localhost_example | 52 ------- bin/config-include/config_IG.ini | 46 ++++++ bin/config-include/config_MG.ini | 172 +++++++++++++++++++++++ bin/config-include/config_localhost.ini | 46 ++++++ example/caches/MeshCache/.keep | 0 example/config/ROBUST/opensim-monit.conf | 6 +- example/config/config.ini | 30 ++-- example/config/sim_skeleton/My_sim.xml | 7 + example/config/sim_skeleton/ThisSim.ini | 21 ++- example/config/sim_skeleton/opensim-monit.conf | 8 +- example/start.sh | 2 +- scripts/backup-sims.sh | 4 +- scripts/common.sh | 3 +- scripts/install/create_sim.sh | 55 ++++---- scripts/install/go_live.sh | 2 +- scripts/install/opensim-monit.conf | 17 +-- scripts/install/secure.sh | 20 +++ scripts/start-sim | 18 +-- 22 files changed, 446 insertions(+), 443 deletions(-) delete mode 100644 bin/config-include/config.ini.IG_example delete mode 100644 bin/config-include/config.ini.MG_example delete mode 100644 bin/config-include/config.ini.localhost_example create mode 100644 bin/config-include/config_IG.ini create mode 100644 bin/config-include/config_MG.ini create mode 100644 bin/config-include/config_localhost.ini create mode 100644 example/caches/MeshCache/.keep create mode 100755 scripts/install/secure.sh diff --git a/INSTALL.md b/INSTALL.md index b501b92..fdbc8e0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,7 +8,9 @@ from Linux. It's only been tested on Ubuntu 10.04, 11.04, 12.04, 16.04, as well as Debian 8, and Devuan 9, YMMV. This is also a WIP, use it at your own -risk. It's been used to set up a few freshly installed servers though. +risk. It's been used to set up a few freshly installed servers though. +It should work on recent Debian based Linux distros. + The directory layout. --------------------- @@ -76,12 +78,7 @@ following script, from inside the OpenSim directory - ./InstallItAll.sh DatabasePassword -This will do most of the work for you, except for creating sims. There -is a final step that needs to be done manually for now. Edit -/etc/rc.local, make sure it has the following line in it somewhere, -probably at the end - - -/opt/opensim/current/scripts/fix_var_run.sh +This will do most of the work for you, except for creating sims. Creating sims. diff --git a/InstallItAll.sh b/InstallItAll.sh index 0568709..6467ff8 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -1,42 +1,26 @@ #!/bin/bash -OSPATH="/opt/opensim" MYSQL_HOST="localhost" -MYSQL_DB="InfiniteGrid" -MYSQL_USER="opensim" -OS_USER="opensim" - -OSVER="0.9.0.1" - - -# Figure out where we are, most of this mess is to troll through soft links. -PRG="$0" -while [ -h "${PRG}" ] ; do - ls=$(ls -ld "${PRG}") - link=`expr "${ls}" : '.*-> \(.*\)$'` - if expr "${link}" : '.*/.*' > /dev/null; then - PRG="${link}" - else - PRG=$(dirname "${PRG}")/"${link}" - fi -done -PRGDIR=$(dirname "${PRG}") -pushd ${PRGDIR} >/dev/null -PRGDIR=$(pwd) -popd >/dev/null +MYSQL_DB="opensim_SC" +MYSQL_USER="opensim_SC" + +OS_VER="0.9.0.1" + +source scripts/common.sh +getPrgDir # This should all be safe for pre existing installs that are being updated. MYSQL_PASSWORD=$1 # Try to get old database credentials if they exist. -if [ -f ${OSPATH}/config/config.ini ]; then +if [ -f ${OS_PATH}/config/config.ini ]; then # Get the database credentials. declare -A creds while read -d ';' p; do k=$(echo ${p} | cut -d '=' -f 1) v=$(echo ${p} | cut -d '=' -f 2) creds[${k}]="${v}" - done < <(sudo grep ConnectionString ${OSPATH}/config/config.ini | cut -d '"' -f 2) + done < <(sudo grep ConnectionString ${OS_PATH}/config/config.ini | cut -d '"' -f 2) # The above seems the best way to get bash to let the creds assignments survive outside the loop. MYSQL_HOST="${creds[Data Source]}" @@ -50,76 +34,89 @@ fi USER=$(whoami) -echo "Installing software." -sudo apt-get install mysql-server tmux mono-complete mono-gmcs nunit uuid-runtime monit mc +echo "Installing into ${OS_PATH}, as user ${OS_USER} ." +echo "Using MySQL host:${MYSQL_HOST} database:${MYSQL_DB} user:${MYSQL_USER} password:${MYSQL_PASSWORD} ." + + +echo "Installing and compiling software." +sudo apt-get install mariadb-server tmux mono-complete mono-devel nunit uuid-runtime monit # nant is done separately, coz it was removed from Debian for some mysterious reason. sudo apt-get install nant sudo /etc/init.d/mysql restart -echo "Setting up OpenSim users." + +echo "Setting up OpenSim users. This next prompt asks for your MySQL root users password." # "create user if not exists" doesn't exist until MySQL 5.7, so we have to put up with a warning, which we can ignore. mysql -u root -p -h localhost << zzzzEOFzzz create database if not exists $MYSQL_DB; -create user $OS_USER identified by '$MYSQL_PASSWORD'; -create user $OS_USER@localhost identified by '$MYSQL_PASSWORD'; -grant all on $MYSQL_DB.* to $OS_USER; -grant all on $MYSQL_DB.* to $OS_USER@localhost; +create user '$OS_USER' identified by '$MYSQL_PASSWORD'; +create user '$OS_USER'@localhost identified by '$MYSQL_PASSWORD'; +grant all on $MYSQL_DB.* to '$OS_USER'; +grant all on $MYSQL_DB.* to '$OS_USER'@localhost; FLUSH PRIVILEGES; zzzzEOFzzz -echo "Setting up OpenSim." -sudo adduser --system --shell /bin/false --group $OS_USER -sudo addgroup $USER $OS_USER +sudo adduser --system --shell /bin/false --group ${OS_USER} +sudo addgroup ${USER} ${OS_USER} -echo "Building OpenSim." -./BuildIt.sh echo "Setting up OpenSim." -sudo rm -fr $OSPATH/opensim-IG_* -sudo mkdir -p $OSPATH/opensim-IG_$OSVER -sudo cp -fr $PRGDIR/* $OSPATH/opensim-IG_$OSVER - -cd $OSPATH -sudo ln -fs opensim-IG_$OSVER current +sudo rm -fr ${OS_PATH}/opensim-SC_* +sudo mkdir -p ${OS_PATH}/opensim-SC_${OS_VER} +sudo cp -fr $PRGDIR/* ${OS_PATH}/opensim-SC_${OS_VER} +cd ${OS_PATH} +if [ ! -h current ]; then + sudo ln -fs opensim-SC_${OS_VER} current +fi cd current - for dir in AssetFiles backups caches config db logs do - if [ ! -f ../$dir ]; then + if [ ! -d ../$dir ]; then sudo cp -fr example/$dir .. fi done -pushd config/ROBUST >/dev/null +pushd ../config/ROBUST >/dev/null sudo ln -fs ../../current/scripts/common.sh common.sh sudo ln -fs ../../current/scripts/start-sim start-sim sudo ln -fs ../../current/scripts/start-sim stop-sim +sudo sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf popd >/dev/null -echo "Securing OpenSim." -sudo chown -R $OS_USER:$OS_USER $OSPATH -sudo chmod -R 775 $OSPATH -sudo chmod -R a-x $OSPATH -sudo chmod -R a+X $OSPATH -sudo chmod -R g+w $OSPATH -sudo chmod -R a+x $OSPATH/current/scripts/*.sh -sudo chmod a+x $OSPATH/current/scripts/show-console -sudo chmod a+x $OSPATH/current/scripts/start-sim - -sudo chmod ug+rwx $OSPATH/config -sudo chmod g+s $OSPATH/config -sudo chmod 600 $OSPATH/config/config.ini - -sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" config/config.ini -sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" config/config.ini -sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" config/config.ini -sudo chmod 600 config/config.ini -sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" config/config.ini -sudo chmod 600 config/config.ini - -sudo cp scripts/opensim.tmux.conf /home/$OS_USER/.tmux.conf -sudo chown $USER /home/$OS_USER/.tmux.conf -sudo chmod 644 /home/$OS_USER/.tmux.conf +sudo cp bin/config-include/config_* ../config/ +sudo ln -fs config_localhost.ini ../config/config.ini +sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_IG.ini +sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_IG.ini +sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_IG.ini + +sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_MG.ini +sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_MG.ini +sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_MG.ini + +sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_localhost.ini +sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_localhost.ini +sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_localhost.ini + +sudo chmod 600 ../config/*.ini +sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_IG.ini +sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_MG.ini +sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_localhost.ini +sudo chmod 600 ../config/*.ini + +if [ ! -f /home/${OS_USER}/.tmux.conf ]; then + sudo cp scripts/install/opensim.tmux.conf /home/${OS_USER}/.tmux.conf + sudo chown ${OS_USER}:${OS_USR} /home/${OS_USER}/.tmux.conf + sudo chmod 644 /home/${OS_USER}/.tmux.conf +fi + + +echo "Building OpenSim." +sudo chown -R ${USER}:${USER} ${OS_PATH} * +./BuildIt.sh + + +cd scripts/install +sudo ./secure.sh echo "Done installing OpenSim." diff --git a/bin/config-include/config.ini.IG_example b/bin/config-include/config.ini.IG_example deleted file mode 100644 index 710ccae..0000000 --- a/bin/config-include/config.ini.IG_example +++ /dev/null @@ -1,54 +0,0 @@ -; ** -; * The Const section allows us to define some basic information that we -; * will use throughout our configuration. We will provide examples for -; * setting the base url of the Robust server and the public and private ports -; * it uses. Changing the values of the constants will set the operating -; * parameters thoughout the configuration. Other constants that may prove -; * to be useful may be added to the followin section. They may be -; * referenced anywhere in the configuration by using ${Const|Name}. One -; * such use is providing a base path for setting locations that Robust -; * uses to write data. - -; Also put grid specific stuff here. - - -[Paths] - AssetsPath = "../../AssetFiles" - BackupPath = "../../backups" - CachePath = "../../caches" - DbPath = "../../db" - LogPath = "../../logs" - - -[Const] -; MOTD = "onefang needs a little coding or sysadmin work to keep IG going. Please help me find some." - MOTD = "More members are coming, slowly. Invite your friends to." - - GridName = "Infinite Grid" - ShortGridName = "IG" - - ; For a grid these will usually be the externally accessible IP/DNS - ; name and use default public port 8002 and default private port 8003 - ; For a standalone this will usually be the externally accessible IP/DNS - ; name and use default public port 9000. The private port is not used - ; in the configuration for a standalone. - - ;# {BaseURL} {} {BaseURL} {"http://example.com" "http://127.0.0.1"} "http://127.0.0.1" - BaseHostname = "http://grid.infinitegrid.org" - HostName = "grid.infinitegrid.org" - BaseURL = http://grid.infinitegrid.org - GridURL = http://grid.infinitegrid.org - - ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" - PublicPort = "8002" - - ;# {PrivatePort} {} {PrivatePort} {8003} "8003" - PrivatePort = "8003" - - - DataProvider = "OpenSim.Data.MySQL.dll" - ConnectionString = "Data Source=localhost;Database=****;User ID=****;Password=****;Old Guids=true;" - - - ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER - AssetServerPort = "8003" diff --git a/bin/config-include/config.ini.MG_example b/bin/config-include/config.ini.MG_example deleted file mode 100644 index 737bff4..0000000 --- a/bin/config-include/config.ini.MG_example +++ /dev/null @@ -1,178 +0,0 @@ -; ** -; * The Const section allows us to define some basic information that we -; * will use throughout our configuration. We will provide examples for -; * setting the base url of the Robust server and the public and private ports -; * it uses. Changing the values of the constants will set the operating -; * parameters thoughout the configuration. Other constants that may prove -; * to be useful may be added to the followin section. They may be -; * referenced anywhere in the configuration by using ${Const|Name}. One -; * such use is providing a base path for setting locations that Robust -; * uses to write data. - -; Also put grid specific stuff here. - - -[Paths] - AssetsPath = "../../AssetFiles" - BackupPath = "../../backups" - CachePath = "../../caches" - DbPath = "../../db" - LogPath = "../../logs" - - -[Const] - MOTD = "All of the World is a Stage, and Everyone's a Critic." - - GridName = "Misfitz Grid" - ShortGridName = "MG" - - ; For a grid these will usually be the externally accessible IP/DNS - ; name and use default public port 8002 and default private port 8003 - ; For a standalone this will usually be the externally accessible IP/DNS - ; name and use default public port 9000. The private port is not used - ; in the configuration for a standalone. - - ;# {BaseURL} {} {BaseURL} {"http://example.com" "http://127.0.0.1"} "http://127.0.0.1" - BaseHostname = "http://misfitzgrid.com" - HostName = "misfitzgrid.com" - BaseURL = http://misfitzgrid.com - GridURL = http://misfitzgrid.com - - ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" - PublicPort = "8002" - - ;# {PrivatePort} {} {PrivatePort} {8003} "8003" - PrivatePort = "8003" - - - DataProvider = "OpenSim.Data.MySQL.dll" - ConnectionString = "Data Source=localhost;Database=****;User ID=****;Password=****;Old Guids=true;" - - - ; jOpenSim URL - jOpensimURL = "http://misfitzgrid.com/members" - ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER - AssetServerPort = "8004" - - -[Network] - ;# {ExternalHostNameForLSL} {} {Hostname to use for HTTP-IN URLs. This should be reachable from the internet.} {} - ;; Hostname to use in llRequestURL/llRequestSecureURL - ;; if not defined - llRequestURL/llRequestSecureURL are disabled - ExternalHostNameForLSL = "server2.misfitzgrid.com" - - -[Messaging] - ;# {OfflineMessageModule} {} {Module to use for offline message storage} {OfflineMessageModule "Offline Message Module V2" *} - ;; Module to handle offline messaging. The core module requires an external - ;; web service to do this. See OpenSim wiki. - OfflineMessageModule = OfflineMessageModule - ;; Or, alternatively, use this one, which works for both standalones and grids - ; OfflineMessageModule = "Offline Message Module V2" - - ;# {OfflineMessageURL} {OfflineMessageModule:OfflineMessageModule Offline Message Module V2:Offline Message Module V2} {URL of offline messaging service} {} - ;; URL of web service for offline message storage. Leave it commented if your service is local to the sim. - ; OfflineMessageURL = ${Const|BaseURL}/Offline.php - OfflineMessageURL = ${Const|jOpensimURL}/components/com_opensim/interface.php - - -[DataSnapshot] - ;# {index_sims} {} {Enable data snapshotting (search)?} {true false} false - ;; The following set of configs pertains to search. - ;; Set index_sims to true to enable search engines to index your - ;; searchable data. - ;; If false, no data will be exposed, DataSnapshot module will be off, - ;; and you can ignore the rest of these search-related configs. - index_sims = true - - ;# {data_exposure} {index_sims:true} {How much data should be exposed?} {minimum all} minimum - ;; The variable data_exposure controls what the regions expose: - ;; minimum: exposes only things explicitly marked for search - ;; all: exposes everything - data_exposure = all - - ;; [Supported, but obsolete] - ;# {data_services} {index_sims:true} {Data service URLs to register with?} {} http://metaverseink.com/cgi-bin/register.py - ; This semicolon-separated string serves to notify specific data services - ; about the existence of this sim. Uncomment if you want to index your - ; data with this and/or other search providers. - data_services="${Const|jOpensimURL}/components/com_opensim/registersearch.php" - - -[Groups] - ;# {SecretKey} {ServicesConnectorModule:Groups Remote Service Connector} {Secret key between sim and remote group service} {} "" - ;; Used for V2 in Remote only. - SecretKey = "Kensentm3" - - -[Search] - SearchURL = ${Const|jOpensimURL}/components/com_opensim/interface.php - - -[AuthorizationService] - ; If you have regions with access restrictions - ; specify them here using the convention - ; Region_ = - ; Valid flags are: - ; DisallowForeigners -- HG visitors not allowed - ; DisallowResidents -- only Admins and Managers allowed - ; Example: - Region_Amazonas = "DisallowForeigners" - Region_Andros = "DisallowForeigners" - Region_Archangel = "DisallowForeigners" - Region_Blue_Moon = "DisallowForeigners" - Region_Blue_Water = "DisallowForeigners" - Region_Boiboi = "DisallowForeigners" -; Region_Castaway_Cay = "DisallowForeigners" - Region_Chen = "DisallowForeigners" - Region_Coruscant = "DisallowForeigners" - Region_Firefly = "DisallowForeigners" - Region_Haystack1 = "DisallowForeigners" - Region_Haystack2 = "DisallowForeigners" - Region_Isle_of_Beast = "DisallowForeigners" - Region_JaimieVille = "DisallowForeigners" - Region_Kikai_Gaki = "DisallowForeigners" - Region_KW1 = "DisallowForeigners" - Region_Lioneart = "DisallowForeigners" - Region_Lyra = "DisallowForeigners" - Region_MisFitz_Fairground = "DisallowForeigners" - Region_MisFitz_Residential_1 = "DisallowForeigners" - Region_MisFitz_Residential_2 = "DisallowForeigners" - Region_MisFitz_Sandbox = "DisallowForeigners" - Region_Neo_Kidopolis = "DisallowForeigners" - Region_Neverland = "DisallowForeigners" - Region_Ningaloo = "DisallowForeigners" - Region_Northland = "DisallowForeigners" - Region_Nucleus = "DisallowForeigners" - Region_Oreo_World = "DisallowForeigners" - Region_Parts_unKnown = "DisallowForeigners" - Region_Raja_Ampat = "DisallowForeigners" - Region_Red_Sea = "DisallowForeigners" - Region_Serenity = "DisallowForeigners" - Region_Silversmoke_Estate = "DisallowForeigners" - Region_SkyTec = "DisallowForeigners" - Region_Star_Dream = "DisallowForeigners" - Region_STS-Sandbox = "DisallowForeigners" - Region_Sweetland = "DisallowForeigners" - Region_Taboo_Too = "DisallowForeigners" - Region_TheExpanse = "DisallowForeigners" - Region_Ubercity = "DisallowForeigners" - Region_Undercity = "DisallowForeigners" - Region_White_Harbor = "DisallowForeigners" - Region_Traumland = "DisallowForeigners" - Region_Crazy_Family = "DisallowForeigners" - Region_Moonland = "DisallowForeigners" - Region_Lost_Mittens = "DisallowForeigners" - Region_The_Dugout = "DisallowForeigners" - Region_The_Sandlot = "DisallowForeigners" - Region_Wild_Shadow_Bay = "DisallowForeigners" - Region_Recreational_Hazard = "DisallowForeigners" - - -[Profile] - - ProfileServiceURL = ${Const|jOpensimURL}/components/com_opensim/interface.php - Module = "jOpenSimProfile" - - ; Optional: - Debug = true diff --git a/bin/config-include/config.ini.localhost_example b/bin/config-include/config.ini.localhost_example deleted file mode 100644 index aa26abd..0000000 --- a/bin/config-include/config.ini.localhost_example +++ /dev/null @@ -1,52 +0,0 @@ -; ** -; * The Const section allows us to define some basic information that we -; * will use throughout our configuration. We will provide examples for -; * setting the base url of the Robust server and the public and private ports -; * it uses. Changing the values of the constants will set the operating -; * parameters thoughout the configuration. Other constants that may prove -; * to be useful may be added to the followin section. They may be -; * referenced anywhere in the configuration by using ${Const|Name}. One -; * such use is providing a base path for setting locations that Robust -; * uses to write data. - -; Also put grid specific stuff here. - - -[Paths] - AssetsPath = "../../AssetFiles" - BackupPath = "../../backups" - CachePath = "../../caches" - DbPath = "../../db" - LogPath = "../../logs" - - -[Const] - MOTD = "Welcome to your local grid." - - GridName = "localhost Grid" - ShortGridName = "lg" - - ; For a grid these will usually be the externally accessible IP/DNS - ; name and use default public port 8002 and default private port 8003 - ; For a standalone this will usually be the externally accessible IP/DNS - ; name and use default public port 9000. The private port is not used - ; in the configuration for a standalone. - - BaseHostname = "127.0.0.1" - HostName = "localhost" - BaseURL = http://${Const|BaseHostname} - GridURL = http://${Const|BaseHostname} - - ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" - PublicPort = "8002" - - ;# {PrivatePort} {} {PrivatePort} {8003} "8003" - PrivatePort = "8003" - - - DataProvider = "OpenSim.Data.MySQL.dll" - ConnectionString = "Data Source=localhost;Database=****;User ID=****;Password=****;Old Guids=true;" - - - ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER - AssetServerPort = "8003" diff --git a/bin/config-include/config_IG.ini b/bin/config-include/config_IG.ini new file mode 100644 index 0000000..3ec215c --- /dev/null +++ b/bin/config-include/config_IG.ini @@ -0,0 +1,46 @@ + information that we +; will use throughout our configuration. We will provide examples for +; setting the base url of the ROBUST server and the public and private ports +; it uses. Changing the values of the constants will set the operating +; parameters thoughout the configuration. Other constants that may prove +; to be useful may be added to the followin section. They may be +; referenced anywhere in the configuration by using ${Const|Name}. One +; such use is providing a base path for setting locations that ROBUST +; uses to write data. + +; Also put grid specific stuff here. + + +[Paths] + AssetsPath = "../../AssetFiles" + BackupPath = "../../backups" + CachePath = "../../caches" + DbPath = "../../db" + LogPath = "../../logs" + + +[Const] + MOTD = "onefang needs a little coding or sysadmin work to keep IG going. Please help me find some." + + GridName = "Infinite Grid" + ShortGridName = "IG" + + ; For a grid these will usually be the externally accessible IP/DNS + ; name and use default public port 8002 and default private port 8003 + ; For a standalone this will usually be the externally accessible IP/DNS + ; name and use default public port 9000. The private port is not used + ; in the configuration for a standalone. + BaseHostname = "http://grid.infinitegrid.org" + HostName = "grid.infinitegrid.org" + BaseURL = ${Const|BaseHostname} + GridURL = ${Const|BaseHostname} + + PublicPort = "8002" + PrivatePort = "8003" + + ; The public port of the ROBUST asset server, which might be different. + AssetServerPort = "8003" + + ; Database credentials. + DataProvider = "OpenSim.Data.MySQL.dll" + ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" diff --git a/bin/config-include/config_MG.ini b/bin/config-include/config_MG.ini new file mode 100644 index 0000000..4f675d7 --- /dev/null +++ b/bin/config-include/config_MG.ini @@ -0,0 +1,172 @@ + information that we +; will use throughout our configuration. We will provide examples for +; setting the base url of the ROBUST server and the public and private ports +; it uses. Changing the values of the constants will set the operating +; parameters thoughout the configuration. Other constants that may prove +; to be useful may be added to the followin section. They may be +; referenced anywhere in the configuration by using ${Const|Name}. One +; such use is providing a base path for setting locations that ROBUST +; uses to write data. + +; Also put grid specific stuff here. + + +[Paths] + AssetsPath = "../../AssetFiles" + BackupPath = "../../backups" + CachePath = "../../caches" + DbPath = "../../db" + LogPath = "../../logs" + + +[Const] + MOTD = "All of the World is a Stage, and Everyone's a Critic." + + GridName = "Misfitz Grid" + ShortGridName = "MG" + + ; For a grid these will usually be the externally accessible IP/DNS + ; name and use default public port 8002 and default private port 8003 + ; For a standalone this will usually be the externally accessible IP/DNS + ; name and use default public port 9000. The private port is not used + ; in the configuration for a standalone. + BaseHostname = "http://misfitzgrid.com" + HostName = "misfitzgrid.com" + BaseURL = ${Const|BaseHostname} + GridURL = ${Const|BaseHostname} + + PublicPort = "8002" + PrivatePort = "8003" + + ; The public port of the ROBUST asset server, which might be different. + AssetServerPort = "8003" + + ; Database credentials. + DataProvider = "OpenSim.Data.MySQL.dll" + ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" + + ; jOpenSim URL + jOpensimURL = "http://misfitzgrid.com/members" + + +[Network] + ;# {ExternalHostNameForLSL} {} {Hostname to use for HTTP-IN URLs. This should be reachable from the internet.} {} + ;; Hostname to use in llRequestURL/llRequestSecureURL + ;; if not defined - llRequestURL/llRequestSecureURL are disabled + ExternalHostNameForLSL = "server2.misfitzgrid.com" + + +[Messaging] + ;# {OfflineMessageModule} {} {Module to use for offline message storage} {OfflineMessageModule "Offline Message Module V2" *} + ;; Module to handle offline messaging. The core module requires an external + ;; web service to do this. See OpenSim wiki. + OfflineMessageModule = OfflineMessageModule + ;; Or, alternatively, use this one, which works for both standalones and grids + ; OfflineMessageModule = "Offline Message Module V2" + + ;# {OfflineMessageURL} {OfflineMessageModule:OfflineMessageModule Offline Message Module V2:Offline Message Module V2} {URL of offline messaging service} {} + ;; URL of web service for offline message storage. Leave it commented if your service is local to the sim. + ; OfflineMessageURL = ${Const|BaseURL}/Offline.php + OfflineMessageURL = ${Const|jOpensimURL}/components/com_opensim/interface.php + + +[DataSnapshot] + ;# {index_sims} {} {Enable data snapshotting (search)?} {true false} false + ;; The following set of configs pertains to search. + ;; Set index_sims to true to enable search engines to index your + ;; searchable data. + ;; If false, no data will be exposed, DataSnapshot module will be off, + ;; and you can ignore the rest of these search-related configs. + index_sims = true + + ;# {data_exposure} {index_sims:true} {How much data should be exposed?} {minimum all} minimum + ;; The variable data_exposure controls what the regions expose: + ;; minimum: exposes only things explicitly marked for search + ;; all: exposes everything + data_exposure = all + + ;; [Supported, but obsolete] + ;# {data_services} {index_sims:true} {Data service URLs to register with?} {} http://metaverseink.com/cgi-bin/register.py + ; This semicolon-separated string serves to notify specific data services + ; about the existence of this sim. Uncomment if you want to index your + ; data with this and/or other search providers. + data_services="${Const|jOpensimURL}/components/com_opensim/registersearch.php" + + +[Groups] + ;# {SecretKey} {ServicesConnectorModule:Groups Remote Service Connector} {Secret key between sim and remote group service} {} "" + ;; Used for V2 in Remote only. + SecretKey = "Kensentm3" + + +[Search] + SearchURL = ${Const|jOpensimURL}/components/com_opensim/interface.php + + +[AuthorizationService] + ; If you have regions with access restrictions + ; specify them here using the convention + ; Region_ = + ; Valid flags are: + ; DisallowForeigners -- HG visitors not allowed + ; DisallowResidents -- only Admins and Managers allowed + ; Example: + Region_Amazonas = "DisallowForeigners" + Region_Andros = "DisallowForeigners" + Region_Archangel = "DisallowForeigners" + Region_Blue_Moon = "DisallowForeigners" + Region_Blue_Water = "DisallowForeigners" + Region_Boiboi = "DisallowForeigners" +; Region_Castaway_Cay = "DisallowForeigners" + Region_Chen = "DisallowForeigners" + Region_Coruscant = "DisallowForeigners" + Region_Firefly = "DisallowForeigners" + Region_Haystack1 = "DisallowForeigners" + Region_Haystack2 = "DisallowForeigners" + Region_Isle_of_Beast = "DisallowForeigners" + Region_JaimieVille = "DisallowForeigners" + Region_Kikai_Gaki = "DisallowForeigners" + Region_KW1 = "DisallowForeigners" + Region_Lioneart = "DisallowForeigners" + Region_Lyra = "DisallowForeigners" + Region_MisFitz_Fairground = "DisallowForeigners" + Region_MisFitz_Residential_1 = "DisallowForeigners" + Region_MisFitz_Residential_2 = "DisallowForeigners" + Region_MisFitz_Sandbox = "DisallowForeigners" + Region_Neo_Kidopolis = "DisallowForeigners" + Region_Neverland = "DisallowForeigners" + Region_Ningaloo = "DisallowForeigners" + Region_Northland = "DisallowForeigners" + Region_Nucleus = "DisallowForeigners" + Region_Oreo_World = "DisallowForeigners" + Region_Parts_unKnown = "DisallowForeigners" + Region_Raja_Ampat = "DisallowForeigners" + Region_Red_Sea = "DisallowForeigners" + Region_Serenity = "DisallowForeigners" + Region_Silversmoke_Estate = "DisallowForeigners" + Region_SkyTec = "DisallowForeigners" + Region_Star_Dream = "DisallowForeigners" + Region_STS-Sandbox = "DisallowForeigners" + Region_Sweetland = "DisallowForeigners" + Region_Taboo_Too = "DisallowForeigners" + Region_TheExpanse = "DisallowForeigners" + Region_Ubercity = "DisallowForeigners" + Region_Undercity = "DisallowForeigners" + Region_White_Harbor = "DisallowForeigners" + Region_Traumland = "DisallowForeigners" + Region_Crazy_Family = "DisallowForeigners" + Region_Moonland = "DisallowForeigners" + Region_Lost_Mittens = "DisallowForeigners" + Region_The_Dugout = "DisallowForeigners" + Region_The_Sandlot = "DisallowForeigners" + Region_Wild_Shadow_Bay = "DisallowForeigners" + Region_Recreational_Hazard = "DisallowForeigners" + + +[Profile] + + ProfileServiceURL = ${Const|jOpensimURL}/components/com_opensim/interface.php + Module = "jOpenSimProfile" + + ; Optional: + Debug = true diff --git a/bin/config-include/config_localhost.ini b/bin/config-include/config_localhost.ini new file mode 100644 index 0000000..31f2f2c --- /dev/null +++ b/bin/config-include/config_localhost.ini @@ -0,0 +1,46 @@ +; ** information that we +; will use throughout our configuration. We will provide examples for +; setting the base url of the ROBUST server and the public and private ports +; it uses. Changing the values of the constants will set the operating +; parameters thoughout the configuration. Other constants that may prove +; to be useful may be added to the followin section. They may be +; referenced anywhere in the configuration by using ${Const|Name}. One +; such use is providing a base path for setting locations that ROBUST +; uses to write data. + +; Also put grid specific stuff here. + + +[Paths] + AssetsPath = "../../AssetFiles" + BackupPath = "../../backups" + CachePath = "../../caches" + DbPath = "../../db" + LogPath = "../../logs" + + +[Const] + MOTD = "Welcome to your local grid." + + GridName = "localhost Grid" + ShortGridName = "lg" + + ; For a grid these will usually be the externally accessible IP/DNS + ; name and use default public port 8002 and default private port 8003 + ; For a standalone this will usually be the externally accessible IP/DNS + ; name and use default public port 9000. The private port is not used + ; in the configuration for a standalone. + BaseHostname = "127.0.0.1" + HostName = "localhost" + BaseURL = http://${Const|BaseHostname} + GridURL = http://${Const|BaseHostname} + + PublicPort = "8002" + PrivatePort = "8003" + + ; The public port of the ROBUST asset server, which might be different. + AssetServerPort = "8003" + + ; Database credentials. + DataProvider = "OpenSim.Data.MySQL.dll" + ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" diff --git a/example/caches/MeshCache/.keep b/example/caches/MeshCache/.keep new file mode 100644 index 0000000..e69de29 diff --git a/example/config/ROBUST/opensim-monit.conf b/example/config/ROBUST/opensim-monit.conf index 70190b9..adce46d 100644 --- a/example/config/ROBUST/opensim-monit.conf +++ b/example/config/ROBUST/opensim-monit.conf @@ -21,10 +21,10 @@ # # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. # -check process ROBUST with pidfile /var/run/opensim/ROBUST.pid - start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/ROBUST && /opt/opensim/config/ROBUST/start-sim -q'" +check process ROBUST with pidfile OS_PATH/caches/ROBUST.pid + start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd OS_PATH/config/ROBUST && OS_PATH/config/ROBUST/start-sim -q'" as uid root and gid root - stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/ROBUST && /opt/opensim/config/ROBUST/stop-sim'" with timeout 600 seconds + stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd OS_PATH/config/ROBUST && OS_PATH/config/ROBUST/stop-sim'" with timeout 600 seconds if cpu usage > 50% for 4 cycles then restart # if 5 restarts within 5 cycles then timeout # if failed url http://127.0.0.1:9005/jsonSimStats/ diff --git a/example/config/config.ini b/example/config/config.ini index 3890e66..510c8b6 100644 --- a/example/config/config.ini +++ b/example/config/config.ini @@ -1,13 +1,12 @@ -; ** -; * The Const section allows us to define some basic information that we -; * will use throughout our configuration. We will provide examples for -; * setting the base url of the Robust server and the public and private ports -; * it uses. Changing the values of the constants will set the operating -; * parameters thoughout the configuration. Other constants that may prove -; * to be useful may be added to the followin section. They may be -; * referenced anywhere in the configuration by using ${Const|Name}. One -; * such use is providing a base path for setting locations that Robust -; * uses to write data. +; The Const section allows us to define some basic information that we +; will use throughout our configuration. We will provide examples for +; setting the base url of the ROBUST server and the public and private ports +; it uses. Changing the values of the constants will set the operating +; parameters thoughout the configuration. Other constants that may prove +; to be useful may be added to the followin section. They may be +; referenced anywhere in the configuration by using ${Const|Name}. One +; such use is providing a base path for setting locations that ROBUST +; uses to write data. ; Also put grid specific stuff here. @@ -31,22 +30,17 @@ ; For a standalone this will usually be the externally accessible IP/DNS ; name and use default public port 9000. The private port is not used ; in the configuration for a standalone. - BaseHostname = "127.0.0.1" HostName = "localhost" BaseURL = http://${Const|BaseHostname} GridURL = http://${Const|BaseHostname} - ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" PublicPort = "8002" - - ;# {PrivatePort} {} {PrivatePort} {8003} "8003" PrivatePort = "8003" + ; The public port of the ROBUST asset server, which might be different. + AssetServerPort = "8003" + ; Database credentials. DataProvider = "OpenSim.Data.MySQL.dll" ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" - - - ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER - AssetServerPort = "8003" diff --git a/example/config/sim_skeleton/My_sim.xml b/example/config/sim_skeleton/My_sim.xml index c5723f3..f71df57 100644 --- a/example/config/sim_skeleton/My_sim.xml +++ b/example/config/sim_skeleton/My_sim.xml @@ -9,5 +9,12 @@ + + + + + + + diff --git a/example/config/sim_skeleton/ThisSim.ini b/example/config/sim_skeleton/ThisSim.ini index 2f691f0..140cf3b 100644 --- a/example/config/sim_skeleton/ThisSim.ini +++ b/example/config/sim_skeleton/ThisSim.ini @@ -2,9 +2,24 @@ mysim="SIM_NUMBER" [Startup] - PIDFile = "/var/run/opensim/sim${Const|mysim}.pid" - regionload_regionsdir="/opt/opensim/config/sim${Const|mysim}" - LogFile = "../logs/OpenSim_sim${Const|mysim}.log" + PIDFile = "${Paths|CachePath}/sim${Const|mysim}.pid" + LogFile = "${Paths|LogPath}/OpenSim_sim${Const|mysim}.log" + ConsoleHistoryFile = "${Paths|LogPath}/OpenSimConsoleHistory_sim${Const|mysim}.txt" + regionload_regionsdir="../../config/sim${Const|mysim}" + +[Map] + enablePosition = true + ; Only texture prims that have a diagonal size greater than this number. + TexturePrimSize = 1 [Network] http_listener_port = SIM_PORT + +[Performance] + ;; Select the performance characteristirs of OpenSim. + ; Include-Performance = "config-include/SimFast.ini" + Include-Performance = "config-include/SimBalanced.ini" + ; Include-Performance = "config-include/SimDefault.ini" + ; Include-Performance = "config-include/SimLean.ini" + │ 2621 mysql 20 0 4131620 483696 17640 S 0.3 2.9 8:07.82 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/x86_64-linux-gnu/mariadb18/plugin --user=m+ + \ No newline at end of file diff --git a/example/config/sim_skeleton/opensim-monit.conf b/example/config/sim_skeleton/opensim-monit.conf index ac50fc2..fd9220f 100644 --- a/example/config/sim_skeleton/opensim-monit.conf +++ b/example/config/sim_skeleton/opensim-monit.conf @@ -13,12 +13,12 @@ # # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. # -check process simSIM_NUMBER with pidfile /var/run/opensim/simSIM_NUMBER.pid - start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/simSIM_NUMBER && /opt/opensim/config/simSIM_NUMBER/start-sim -q'" +check process simSIM_NUMBER with pidfile OS_PATH/caches/simSIM_NUMBER.pid + start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd OS_PATH/config/simSIM_NUMBER && OS_PATH/config/simSIM_NUMBER/start-sim -q'" as uid root and gid root - stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/simSIM_NUMBER && /opt/opensim/config/simSIM_NUMBER/stop-sim'" with timeout 600 seconds + stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd OS_PATH/config/simSIM_NUMBER && OS_PATH/config/simSIM_NUMBER/stop-sim'" with timeout 600 seconds if cpu usage > 50% for 4 cycles then restart - if MEMORY usage > 25% for 4 cycles then restart + if MEMORY usage > 10% for 4 cycles then restart # if 5 restarts within 5 cycles then timeout # if failed url http://127.0.0.1:9005/jsonSimStats/ # and content != '"SimFPS":0.0,' for 4 cycles diff --git a/example/start.sh b/example/start.sh index ce36d59..d6ef48d 100755 --- a/example/start.sh +++ b/example/start.sh @@ -1,4 +1,4 @@ #!/bin/bash -cd /opt/opensim-IG/current/bin +cd /opt/opensim_SC/current/bin mono OpenSim.exe -inidirectory=../../config/simg01 diff --git a/scripts/backup-sims.sh b/scripts/backup-sims.sh index b14acca..cadb9a2 100755 --- a/scripts/backup-sims.sh +++ b/scripts/backup-sims.sh @@ -6,9 +6,9 @@ getPrgDir for i in $(seq -w 1 99) do j=$(num2name ${i}) - if [ -e "${PRGDIR}/../config/${j}" ] + if [ -e "${PRGDIR}/../../config/${j}" ] then - pushd ${PRGDIR}/../config/${j} >/dev/null + pushd ${PRGDIR}/../../config/${j} >/dev/null # Find out the size of the last backup, base our later sleep on that, but do it now before backup-sim packs it away. sizeSleep=`sleepPerSize o "$(getSimName ${i})"` ./backup-sim diff --git a/scripts/common.sh b/scripts/common.sh index 2ec19ce..c5a86ab 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,5 +1,7 @@ #!/bin/echo Don't run this file, it's for common functions." +OS_PATH="/opt/opensim_SC" +OS_USER="opensimsc" # Figure out where we are, most of this mess is to troll through soft links. # PRGDIR=$(getPrgDir) @@ -73,4 +75,3 @@ sleepPerSize() echo 200 fi } - diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 0681067..08cedba 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -1,6 +1,6 @@ #!/bin/bash -source common.sh +source ../common.sh getPrgDir NAME=$1 @@ -9,8 +9,7 @@ URL=$3 IP=$4 SIZE=$5 -OSPATH="/opt/opensim" -cd $OSPATH/config +cd ${OS_PATH}/config k=0 for i in $(seq -w 1 99) @@ -22,38 +21,37 @@ do fi done -if [ "x$NAME" = "x" ] +if [ "x${NAME}" = "x" ] then NAME="No name sim $RANDOM" # Should be unique per grid. - echo "WARNING setting the sim name to [$NAME], this may not be what you want." + echo "WARNING setting the sim name to [${NAME}], this may not be what you want." fi # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. -sim=$(sanitize $NAME) +sim=$(sanitize ${NAME}) -if [ "x$LOCATION" = "x" ] +if [ "x${LOCATION}" = "x" ] then LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! - echo "WARNING setting the Location to $LOCATION, this may not be what you want." + echo "WARNING setting the Location to ${LOCATION}, this may not be what you want." fi -if [ "x$IP" = "x" ] +if [ "x${IP}" = "x" ] then - # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. IP="0.0.0.0" - echo "WARNING setting the InternalAddress to $IP, this may not be what you want." + echo "WARNING setting the InternalAddress to ${IP}, this may not be what you want." # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. fi -if [ "x$URL" = "x" ] +if [ "x${URL}" = "x" ] then # Here we make use of an external IP finding service. Careful, it may move. # URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. URL="SYSTEMIP" - echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." + echo "WARNING setting the ExternalHostName to ${URL}, this may not be what you want." fi -if [ "x$SIZE" = "x" ] +if [ "x${SIZE}" = "x" ] then SIZE="256" fi @@ -68,29 +66,30 @@ fi PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. UUID=$(uuidgen) -echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." +echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}." -cp -r sim_skeleton sim$NUM +cp -r sim_skeleton sim${NUM} -cd sim$NUM +cd sim${NUM} mv My_sim.xml ${sim}.xml -sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml -sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml -sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml -sed -i "s@SIM_IP@$IP@g" ${sim}.xml -sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml -sed -i "s@SIM_URL@$URL@g" ${sim}.xml -sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml +sed -i "s@SIM_NAME@${NAME}@g" ${sim}.xml +sed -i "s@SIM_UUID@${UUID}@g" ${sim}.xml +sed -i "s@SIM_POS@${LOCATION}@g" ${sim}.xml +sed -i "s@SIM_IP@${IP}@g" ${sim}.xml +sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ${sim}.xml +sed -i "s@SIM_URL@${URL}@g" ${sim}.xml +sed -i "s@SIM_SIZE@${SIZE}@g" ${sim}.xml ln -s ../../current/scripts/common.sh common.sh ln -s ../../current/scripts/start-sim start-sim cp -P start-sim backup-sim cp -P start-sim stop-sim -sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini -sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini +sed -i "s@SIM_NUMBER@${NUM}@g" ThisSim.ini +sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini -sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf +sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf +sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf -sudo chown -R opensim:opensim .. +sudo chown -R ${OS_USER}:${OS_USER} .. sudo chmod -R g+w .. diff --git a/scripts/install/go_live.sh b/scripts/install/go_live.sh index 21d7072..c5ce90e 100755 --- a/scripts/install/go_live.sh +++ b/scripts/install/go_live.sh @@ -1,6 +1,6 @@ #!/bin/bash -OSPATH="/opt/opensim" +source common.sh for i in $(seq 99) do diff --git a/scripts/install/opensim-monit.conf b/scripts/install/opensim-monit.conf index 7785056..409b69e 100644 --- a/scripts/install/opensim-monit.conf +++ b/scripts/install/opensim-monit.conf @@ -9,23 +9,16 @@ # on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in # /etc/default/monit . the below assumes you've set it to 30 seconds. # -# if process dies, will restart sim within 30 seconds. if process -# dies 5 times in as many tries, will stop trying and send email -# alert. -# -# if SimFPS drops to 0 for 2 minutes, restart. -# -# if process CPU usage stays above 300% for 2 minutes, restart. -# # see ../README for configuration instructions. # # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. # -check process sim01 with pidfile /var/run/opensim/sim01.pid - start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/start-sim -q'" +check process simSIM_NUMBER with pidfile /OS_PATH/caches/simSIM_NUMBER.pid + start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /OS_PATH/config/simSIM_NUMBER && /OS_PATH/config/simSIM_NUMBER/start-sim -q'" as uid root and gid root - stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/stop-sim'" with timeout 600 seconds + stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /OS_PATH/config/simSIM_NUMBER && /OS_PATH/config/simSIM_NUMBER/stop-sim'" with timeout 600 seconds if cpu usage > 50% for 4 cycles then restart + if MEMORY usage > 10% for 4 cycles then restart # if 5 restarts within 5 cycles then timeout # if failed url http://127.0.0.1:9005/jsonSimStats/ # and content != '"SimFPS":0.0,' for 4 cycles @@ -33,4 +26,4 @@ check process sim01 with pidfile /var/run/opensim/sim01.pid # if failed url http://127.0.0.1:9008/jsonSimStats/ # and content == '"SimFPS":' for 4 cycles # then restart - + depends on ROBUST diff --git a/scripts/install/secure.sh b/scripts/install/secure.sh new file mode 100755 index 0000000..48255b6 --- /dev/null +++ b/scripts/install/secure.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +source ../common.sh + +echo "Securing OpenSim." +sudo chmod 600 ${OS_PATH}/config/*.ini +sudo chown -R ${OS_USER}:${OS_USER} ${OS_PATH} +sudo chmod -R 775 ${OS_PATH} +sudo chmod -R a-x ${OS_PATH} +sudo chmod -R a+X ${OS_PATH} +sudo chmod -R g+w ${OS_PATH} +sudo chmod -R a+x ${OS_PATH}/current/*.sh +sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh +sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh +sudo chmod a+x ${OS_PATH}/current/scripts/show-console +sudo chmod a+x ${OS_PATH}/current/scripts/start-sim + +sudo chmod ug+rwx ${OS_PATH}/config +sudo chmod g+s ${OS_PATH}/config +sudo chmod 600 ${OS_PATH}/config/*.ini diff --git a/scripts/start-sim b/scripts/start-sim index bd0815f..e82547a 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -38,11 +38,11 @@ fi if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) num="$(echo ${tgt} | cut -c 4-)" -elif [ -d "./$1" ]; then +elif [ -d "$1" ]; then tgt=$1 -elif [ -d "./sim$1" ]; then +elif [ -d "sim$1" ]; then num=$1 - tgt="./sim${num}" + tgt="sim${num}" else tgt=$1 inventory=$1 @@ -77,14 +77,14 @@ fi case $(basename $0) in "start-sim") - cmd="mono ${exe}.exe -inidirectory=${tgt} " + cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} " # Check if it's already running. if [ -e /var/run/opensim/${tgt}.pid ] then # Double check if it's REALLY running. - if [ "x$(ps -p $(cat /var/run/opensim/${tgt}.pid) --no-headers -o comm)" = "x" ]; then - $SUDO rm -f /var/run/opensim/${tgt}.pid + if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then + $SUDO rm -f ${PRGDIR}/../../caches/${tgt}.pid fi fi # Now see if it's really really running. lol @@ -92,9 +92,9 @@ case $(basename $0) in then if [ "x$tgt" = "xROBUST" ]; then # TODO - the problem here is that the > bit is executed as onefang, not as opensim. - $SUDO cat ../config/config.ini ../config/Robust.ini.template >../config/Robust.ini -# $SUDO chown -R opensim:opensim ../config/Robust.ini - chmod 640 ../config/Robust.ini + $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini +# $SUDO chown -R opensim:opensim ${PRGDIR}/../../config/Robust.ini + chmod 640 ${PRGDIR}/../../config/Robust.ini ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" else ${tmux_command} new-window -dn "${title}" -t "${tmux_session}:${num}" "${cmd}" -- cgit v1.1