aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2011-11-27 19:31:33 +1000
committerDavid Walter Seikel2011-11-27 19:31:33 +1000
commitd8b6646a004060edf073b96065fdbb979baa2f68 (patch)
tree4f8d9af35f9758037cca167d255eaecb8e02c97e
parentRename the start up script. (diff)
downloadIGnoble-d8b6646a004060edf073b96065fdbb979baa2f68.zip
IGnoble-d8b6646a004060edf073b96065fdbb979baa2f68.tar.gz
IGnoble-d8b6646a004060edf073b96065fdbb979baa2f68.tar.bz2
IGnoble-d8b6646a004060edf073b96065fdbb979baa2f68.tar.xz
Trying to make things safer for upgrades and some general tweaks.
-rw-r--r--README11
-rw-r--r--common.ini21
-rwxr-xr-xcreate_region.sh45
-rwxr-xr-xgo_live.sh12
-rwxr-xr-xinstall_opensim.sh81
-rw-r--r--opensim-monit.conf2
-rwxr-xr-xstart-sim6
7 files changed, 127 insertions, 51 deletions
diff --git a/README b/README
index d5edc4b..8636f21 100644
--- a/README
+++ b/README
@@ -60,3 +60,14 @@ this directory) -
60 60
61./go_live.sh 61./go_live.sh
62 62
63
64NOTES -
65
66This attempts to use only one copy of the OS install for all sims. We
67are running one instance of OS for each sim though, as this prevents one
68sim crashing from bringing down the others. OS however really wants to
69write data to directories within it's own bin directory. I'm not at all
70certian if that data can be shared. For the same reason, so far I've
71not been able to get to thepoint where we can make the OS directory read
72only. This complicates things during upgrades.
73
diff --git a/common.ini b/common.ini
new file mode 100644
index 0000000..b76bcae
--- /dev/null
+++ b/common.ini
@@ -0,0 +1,21 @@
1[DatabaseService]
2 StorageProvider = "OpenSim.Data.MySQL.dll"
3 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
4[AssetService]
5 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
6[InventoryService]
7 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
8[AvatarService]
9 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
10[AuthenticationService]
11 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
12[UserAccountService]
13 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
14[GridUserService]
15 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
16[FriendsService]
17 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=MYSQL_PASSWORD;"
18[Network]
19 ConsoleUser = "REST_USER"
20 ConsolePass = "REST_PASSWORD"
21
diff --git a/create_region.sh b/create_region.sh
index ba9de5a..5c27052 100755
--- a/create_region.sh
+++ b/create_region.sh
@@ -4,7 +4,9 @@ NAME=$1
4LOCATION=$2 4LOCATION=$2
5URL=$3 5URL=$3
6IP=$4 6IP=$4
7cd /opt/opensim/config 7
8OSPATH="/opt/opensim"
9cd $OSPATH/config
8 10
9k=0 11k=0
10for i in $(seq 99) 12for i in $(seq 99)
@@ -28,12 +30,8 @@ then
28 echo "WARNING setting the Location to $LOCATION, this may not be what you want." 30 echo "WARNING setting the Location to $LOCATION, this may not be what you want."
29fi 31fi
30 32
31if [ "x$URL" = "x" ] 33# Here we make use of an external IP finding service. Careful, it may move.
32then 34# We later reuse the same IP for the default URL, coz that should work at least.
33 URL=$(hostname) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too.
34 echo "WARNING setting the ExternalHostName to $URL, this may not be what you want."
35fi
36
37if [ "x$IP" = "x" ] 35if [ "x$IP" = "x" ]
38then 36then
39 # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. 37 # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP.
@@ -42,6 +40,12 @@ then
42 echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." 40 echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP."
43fi 41fi
44 42
43if [ "x$URL" = "x" ]
44then
45 URL=$IP # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too.
46 echo "WARNING setting the ExternalHostName to $URL, this may not be what you want."
47fi
48
45NUM=$(printf "%02d" $(($k + 1)) ) 49NUM=$(printf "%02d" $(($k + 1)) )
46PORT=$(( 9005 + ($k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. 50PORT=$(( 9005 + ($k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000.
47UUID=$(uuidgen) 51UUID=$(uuidgen)
@@ -60,21 +64,40 @@ AllowAlternatePorts = False
60ExternalHostName = $URL 64ExternalHostName = $URL
61zzzzEOFzzzz 65zzzzEOFzzzz
62 66
63ln -s ../../setup/start-sim-in-rest start-sim-in-rest 67ln -s ../../setup/start-sim start-sim
64cp ../../current/bin/OpenSim.exe.config OpenSim.exe.config 68cp ../../current/bin/OpenSim.exe.config OpenSim.exe.config
69sed -i 's@<appender name="LogFileAppender" type="log4net.Appender.FileAppender">@<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">@' OpenSim.exe.config
65sed -i "s@<file value=\"OpenSim.log\" />@<file value=\"/var/log/opensim/sim$NUM.log\" />@" OpenSim.exe.config 70sed -i "s@<file value=\"OpenSim.log\" />@<file value=\"/var/log/opensim/sim$NUM.log\" />@" OpenSim.exe.config
66 71
67cat > ThisSim.ini << zzzzEOFzzzz 72cat > ThisSim.ini << zzzzEOFzzzz
68[Startup] 73[Startup]
69 PIDFile = "/var/run/opensim/sim$NUM.pid" 74 PIDFile = "/var/run/opensim/sim$NUM.pid"
70 regionload_regionsdir="/opt/opensim/config/sim$NUM/Regions" 75 regionload_regionsdir="$OSPATH/config/sim$NUM/Regions"
76 DecodedSculptMapPath = "caches/sim$NUM/j2kDecodeCache"
71 77
72[Network] 78[Network]
73 console_port = $(( $PORT + 2 )) 79 console_port = $(( $PORT + 2 ))
74 http_listener_port = $(( $PORT + 0)) 80 http_listener_port = $(( $PORT + 0))
75zzzzEOFzzzz
76 81
77cp ../../current/bin/OpenSim.ConsoleClient.ini OpenSim.ConsoleClient.ini 82[AssetCache]
83 ;; Damn, this gets overidden later by the FlotsamCache.ini file.
84 ;; At least it says it can be shared by multiple instances.
85 ; CacheDirectory = "caches/sim$NUM/assetcache"
86
87[XEngine]
88 ScriptEnginesPath = "caches/sim$NUM/ScriptEngines"
89
90[GridService]
91 MapTileDirectory = "caches/sim$NUM/maptiles"
92
93[DataSnapshot]
94 snapshot_cache_directory = "caches/sim$NUM/DataSnapshot"
95
96[Includes]
97 Include-Common = config/common.ini
98
99zzzzEOFzzzz
100cp ../OpenSim.ConsoleClient.ini OpenSim.ConsoleClient.ini
78sed -i "s@; port = 9002@port = $(( $PORT + 2 ))@" OpenSim.ConsoleClient.ini 101sed -i "s@; port = 9002@port = $(( $PORT + 2 ))@" OpenSim.ConsoleClient.ini
79 102
80cp ../../setup/opensim-monit.conf opensim-monit.conf 103cp ../../setup/opensim-monit.conf opensim-monit.conf
diff --git a/go_live.sh b/go_live.sh
index 65e4a08..856b4ce 100755
--- a/go_live.sh
+++ b/go_live.sh
@@ -1,17 +1,19 @@
1#!/bin/bash 1#!/bin/bash
2 2
3OSPATH="/opt/opensim"
4
3for i in $(seq 99) 5for i in $(seq 99)
4do 6do
5 j=$(printf "sim%02d" $i) 7 j=$(printf "sim%02d" $i)
6 if [ -e "/opt/opensim/config/$j" ] 8 if [ -e "$OSPATH/config/$j" ]
7 then 9 then
8 sudo chown -R opensim:opensim /opt/opensim/config/$j 10 sudo chown -R opensim:opensim $OSPATH/config/$j
9 sudo ln -s /opt/opensim/config/$j/opensim-monit.conf /etc/monit/conf.d/$j.conf 11 sudo ln -s $OSPATH/config/$j/opensim-monit.conf /etc/monit/conf.d/$j.conf
10 fi 12 fi
11done 13done
12 14
13sudo chmod 755 /var/log/opensim 15sudo chmod 755 /var/log/opensim
14sudo chmod 755 /var/run/opensim 16sudo chmod 755 /var/run/opensim
15sudo chown -R opensim:opensim /opt/opensim/opensim-0.7.1.1-infinitegrid-03 17sudo chown -R opensim:opensim $OSPATH/opensim-0.7.1.1-infinitegrid-03
16sudo chown -R opensim:opensim /opt/opensim/modules 18sudo chown -R opensim:opensim $OSPATH/modules
17 19
diff --git a/install_opensim.sh b/install_opensim.sh
index 0800523..4163132 100755
--- a/install_opensim.sh
+++ b/install_opensim.sh
@@ -6,6 +6,10 @@ then
6else 6else
7 MYSQL_PASSWORD=$1 7 MYSQL_PASSWORD=$1
8fi 8fi
9REST_USER="RestingUser"
10REST_PASSWORD="SecretRestingPlace"
11
12OSPATH="/opt/opensim"
9USER=$(whoami) 13USER=$(whoami)
10VERSION_CONTROL="off" 14VERSION_CONTROL="off"
11 15
@@ -36,41 +40,33 @@ sudo chmod 757 /var/log/opensim
36sudo mkdir -p /var/run/opensim 40sudo mkdir -p /var/run/opensim
37sudo chown opensim:opensim /var/run/opensim 41sudo chown opensim:opensim /var/run/opensim
38sudo chmod 757 /var/run/opensim 42sudo chmod 757 /var/run/opensim
39sudo mkdir -p /opt/opensim/config /opt/opensim/modules /opt/opensim/setup 43sudo mkdir -p $OSPATH/config $OSPATH/setup $OSPATH/caches/assetcache
40sudo chown opensim:opensim /opt/opensim 44sudo chown opensim:opensim $OSPATH
41sudo chown -R opensim:opensim /opt/opensim 45sudo chown -R opensim:opensim $OSPATH
42sudo chmod -R 757 /opt/opensim 46sudo chmod -R 757 $OSPATH
43cp start-sim-in-rest /opt/opensim/setup 47cp * $OSPATH/setup
44cp opensim-monit.conf /opt/opensim/setup 48cp common.ini $OSPATH/config
49sed -i "s@MYSQL_PASSWORD@$MYSQL_PASSWORD@g" $OSPATH/config/common.ini
50sed -i "s@REST_PASSWORD@$REST_PASSWORD@g" $OSPATH/config/common.ini
51sed -i "s@REST_USER@$REST_USER@g" $OSPATH/config/common.ini
45cat opensim-crontab.txt | sudo crontab -u opensim - 52cat opensim-crontab.txt | sudo crontab -u opensim -
46 53
47cd /opt/opensim 54cd $OSPATH
48if [ ! -e opensim-0.7.1.1-infinitegrid-03.tar.bz2 ] 55if [ ! -e opensim-0.7.1.1-infinitegrid-03.tar.bz2 ]
49then 56then
50 wget https://github.com/downloads/infinitegrid/InfiniteGrid-Opensim/opensim-0.7.1.1-infinitegrid-03.tar.bz2 57 wget https://github.com/downloads/infinitegrid/InfiniteGrid-Opensim/opensim-0.7.1.1-infinitegrid-03.tar.bz2
51fi 58fi
52
53if [ ! -e opensim-0.7.1.1-infinitegrid-03 ] 59if [ ! -e opensim-0.7.1.1-infinitegrid-03 ]
54then 60then
55 tar xjf opensim-0.7.1.1-infinitegrid-03.tar.bz2 61 tar xjf opensim-0.7.1.1-infinitegrid-03.tar.bz2
56fi 62fi
57ln -fs opensim-0.7.1.1-infinitegrid-03 current 63ln -fs opensim-0.7.1.1-infinitegrid-03 current
58 64
59cd current/bin 65# Create the REST client config file.
60mv -f OpenSim.Forge.Currency.dll ../../modules/ 66cat > config/OpenSim.ConsoleClient.ini << zzzzEOFzzzz
61ln -fs ../../modules/OpenSim.Forge.Currency.dll OpenSim.Forge.Currency.dll
62mv -f OpenSimSearch.Modules.dll ../../modules/
63ln -fs ../../modules/OpenSimSearch.Modules.dll OpenSimSearch.Modules.dll
64mv -f NSLModules.Messaging.MuteList.dll ../../modules/
65ln -fs ../../modules/NSLModules.Messaging.MuteList.dll NSLModules.Messaging.MuteList.dll
66mv -f OpenSimProfile.Modules.dll ../../modules/
67ln -fs ../../modules/OpenSimProfile.Modules.dll OpenSimProfile.Modules.dll
68ln -fs ../../config config
69
70cat > OpenSim.ConsoleClient.ini << zzzzEOFzzzz
71[Startup] 67[Startup]
72 ; Set here or use the -user command-line switch 68 ; Set here or use the -user command-line switch
73 user = RestingUser 69 user = $REST_USER
74 70
75 ; Set here or use the -host command-line switch 71 ; Set here or use the -host command-line switch
76 host = localhost 72 host = localhost
@@ -81,18 +77,37 @@ cat > OpenSim.ConsoleClient.ini << zzzzEOFzzzz
81 ; Set here or use the -pass command-line switch 77 ; Set here or use the -pass command-line switch
82 ; Please be aware that this is not secure since the password is in the clear 78 ; Please be aware that this is not secure since the password is in the clear
83 ; we recommend the use of -pass wherever possible 79 ; we recommend the use of -pass wherever possible
84 pass = SecretRestingPLace 80 pass = $REST_PASSWORD
85zzzzEOFzzzz 81zzzzEOFzzzz
86 82
87sed -i 's@<appender name="LogFileAppender" type="log4net.Appender.FileAppender">@<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">@' OpenSim.exe.config 83cd current/bin
88sed -i 's@; ConsoleUser = "Test"@ConsoleUser = "RestingUser"@' OpenSim.ini 84# Not sure why we are moving these. Hopefully we can get rid of having to move them.
89sed -i 's@; ConsolePass = "secret"@ConsolePass = "SecretRestingPlace"@' OpenSim.ini 85# Comenting them out, until Alice or Rizzy remember why they seed to be moved. See if things still work.
86#mv -f OpenSim.Forge.Currency.dll ../../modules/
87#ln -fs ../../modules/OpenSim.Forge.Currency.dll OpenSim.Forge.Currency.dll
88#mv -f OpenSimSearch.Modules.dll ../../modules/
89#ln -fs ../../modules/OpenSimSearch.Modules.dll OpenSimSearch.Modules.dll
90#mv -f NSLModules.Messaging.MuteList.dll ../../modules/
91#ln -fs ../../modules/NSLModules.Messaging.MuteList.dll NSLModules.Messaging.MuteList.dll
92#mv -f OpenSimProfile.Modules.dll ../../modules/
93#ln -fs ../../modules/OpenSimProfile.Modules.dll OpenSimProfile.Modules.dll
94
95ln -fs ../../config config
96mv -f addon-modules ../../config
97ln -fs ../../config/addon-modules addon-modules
98
99# Try to make the OS distro directory suited to being read only.
100ln -fs ../../caches caches
101mv -f ScriptEngines ../../caches
102ln -fs ../../caches/ScriptEngines ScriptEngines
103# Grumble, OS has it's own silly ideas, and recreates this.
104# "Cannot create /opt/opensim/opensim-0.7.1.1-infinitegrid-03/bin/addin-db-001 because a file with the same name already exists."
105#ln -fs ../../caches/addin-db-001 addin-db-001
90 106
91cd config-include/ 107cd config-include/
108# Damn, can't overide these, we could change them for the next IG OS release.
92sed -i 's@Include-Storage = "config-include/storage/SQLiteStandalone.ini";@; Include-Storage = "config-include/storage/SQLiteStandalone.ini";@' GridCommon.ini 109sed -i 's@Include-Storage = "config-include/storage/SQLiteStandalone.ini";@; Include-Storage = "config-include/storage/SQLiteStandalone.ini";@' GridCommon.ini
93sed -i 's@; StorageProvider = "OpenSim.Data.MySQL.dll"@StorageProvider = "OpenSim.Data.MySQL.dll"@' GridCommon.ini 110sed -i 's@CacheDirectory = ./assetcache@CacheDirectory = caches/assetcache@' FlotsamCache.ini
94sed -i "s@; ConnectionString = \"Data Source=localhost;Database=opensim;User ID=opensim;Password=\*\*\*\*;\"@ConnectionString = \"Data Source=localhost;Database=opensim;User ID=opensim;Password=$MYSQL_PASSWORD;\"@" GridCommon.ini
95
96cd ../../.. 111cd ../../..
97 112
98# Setting screen to be suid. EWWWWWW!!! Security hole!! 113# Setting screen to be suid. EWWWWWW!!! Security hole!!
@@ -105,9 +120,9 @@ then
105 sudo chown root:utmp /var/run/screen 120 sudo chown root:utmp /var/run/screen
106fi 121fi
107 122
108sudo chown -R opensim:opensim /opt/opensim 123sudo chown -R opensim:opensim $OSPATH
109sudo chmod -R a-x /opt/opensim 124sudo chmod -R a-x $OSPATH
110sudo chmod -R a+X /opt/opensim 125sudo chmod -R a+X $OSPATH
111sudo chmod -R g+w /opt/opensim 126sudo chmod -R g+w $OSPATH
112sudo chmod a+x /opt/opensim/setup/start-sim-in-rest 127sudo chmod a+x $OSPATH/setup/start-sim
113 128
diff --git a/opensim-monit.conf b/opensim-monit.conf
index f28c76c..c98ad91 100644
--- a/opensim-monit.conf
+++ b/opensim-monit.conf
@@ -20,7 +20,7 @@
20# see ../README for configuration instructions. 20# see ../README for configuration instructions.
21# 21#
22check process sim01 with pidfile /var/run/opensim/sim01.pid 22check process sim01 with pidfile /var/run/opensim/sim01.pid
23 start program = "/bin/bash -c 'cd /opt/opensim/config/sim01 && /opt/opensim/sim01/start-sim-in-rest -q'" 23 start program = "/bin/bash -c 'cd /opt/opensim/config/sim01 && /opt/opensim/sim01/start-sim -q'"
24 as uid opensim and gid opensim 24 as uid opensim and gid opensim
25 stop program = "/bin/kill -9 `cat /var/run/opensim/sim01.pid`" 25 stop program = "/bin/kill -9 `cat /var/run/opensim/sim01.pid`"
26# if cpu usage > 300% for 4 cycles then restart 26# if cpu usage > 300% for 4 cycles then restart
diff --git a/start-sim b/start-sim
index 3313f57..dbb1beb 100755
--- a/start-sim
+++ b/start-sim
@@ -44,7 +44,11 @@ else
44 SUDO="sudo -Hu opensim" 44 SUDO="sudo -Hu opensim"
45fi 45fi
46 46
47# Would be nice if this worked.
48export MONO_PATH=${bindir}
49# Then we would not have to do this, and subsequently write all over the damn bin directory.
47cd ${bindir} 50cd ${bindir}
51
48if [ "x$Screaming" = "xtrue" ] 52if [ "x$Screaming" = "xtrue" ]
49then 53then
50 if ($screen_check | grep -q ${console_name}); then 54 if ($screen_check | grep -q ${console_name}); then
@@ -63,7 +67,7 @@ else
63fi 67fi
64 68
65inidir=/opt/opensim/config/${tgt} 69inidir=/opt/opensim/config/${tgt}
66cmd="/usr/bin/mono ${exe}.exe -inidirectory=${inidir} -logconfig=${inidir}/${exe}.exe.config $NeedARest" 70cmd="/usr/bin/mono ${bindir}/${exe}.exe -inidirectory=${inidir} -logconfig=${inidir}/${exe}.exe.config $NeedARest"
67title=$(head -n 1 ${inidir}/Regions/sim.ini ) 71title=$(head -n 1 ${inidir}/Regions/sim.ini )
68 72
69# Check if it's already running. 73# Check if it's already running.