diff options
author | onefang | 2019-05-22 19:14:35 +1000 |
---|---|---|
committer | onefang | 2019-05-22 19:14:35 +1000 |
commit | ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5 (patch) | |
tree | 9b4dfc525c31a88014a8d7d6c223e7cd452749c6 | |
parent | Renamed branch to SledjChisl. (diff) | |
download | opensim-SC_OLD-ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5.zip opensim-SC_OLD-ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5.tar.gz opensim-SC_OLD-ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5.tar.bz2 opensim-SC_OLD-ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5.tar.xz |
Major tweaking of the scripts to suit the new setup.
Diffstat (limited to '')
-rw-r--r-- | INSTALL.md | 11 | ||||
-rwxr-xr-x | InstallItAll.sh | 137 | ||||
-rw-r--r-- | bin/config-include/config.ini.IG_example | 54 | ||||
-rw-r--r-- | bin/config-include/config_IG.ini | 46 | ||||
-rw-r--r-- | bin/config-include/config_MG.ini (renamed from bin/config-include/config.ini.MG_example) | 36 | ||||
-rw-r--r-- | bin/config-include/config_localhost.ini (renamed from bin/config-include/config.ini.localhost_example) | 32 | ||||
-rw-r--r-- | example/caches/MeshCache/.keep | 0 | ||||
-rw-r--r-- | example/config/ROBUST/opensim-monit.conf | 6 | ||||
-rw-r--r-- | example/config/config.ini | 30 | ||||
-rw-r--r-- | example/config/sim_skeleton/My_sim.xml | 7 | ||||
-rw-r--r-- | example/config/sim_skeleton/ThisSim.ini | 21 | ||||
-rw-r--r-- | example/config/sim_skeleton/opensim-monit.conf | 8 | ||||
-rwxr-xr-x | example/start.sh | 2 | ||||
-rwxr-xr-x | scripts/backup-sims.sh | 4 | ||||
-rwxr-xr-x | scripts/common.sh | 3 | ||||
-rwxr-xr-x | scripts/install/create_sim.sh | 55 | ||||
-rwxr-xr-x | scripts/install/go_live.sh | 2 | ||||
-rw-r--r-- | scripts/install/opensim-monit.conf | 17 | ||||
-rwxr-xr-x | scripts/install/secure.sh | 20 | ||||
-rwxr-xr-x | scripts/start-sim | 18 |
20 files changed, 256 insertions, 253 deletions
@@ -8,7 +8,9 @@ from Linux. | |||
8 | 8 | ||
9 | It's only been tested on Ubuntu 10.04, 11.04, 12.04, 16.04, as well as | 9 | It's only been tested on Ubuntu 10.04, 11.04, 12.04, 16.04, as well as |
10 | Debian 8, and Devuan 9, YMMV. This is also a WIP, use it at your own | 10 | Debian 8, and Devuan 9, YMMV. This is also a WIP, use it at your own |
11 | risk. It's been used to set up a few freshly installed servers though. | 11 | risk. It's been used to set up a few freshly installed servers though. |
12 | It should work on recent Debian based Linux distros. | ||
13 | |||
12 | 14 | ||
13 | The directory layout. | 15 | The directory layout. |
14 | --------------------- | 16 | --------------------- |
@@ -76,12 +78,7 @@ following script, from inside the OpenSim directory - | |||
76 | 78 | ||
77 | ./InstallItAll.sh DatabasePassword | 79 | ./InstallItAll.sh DatabasePassword |
78 | 80 | ||
79 | This will do most of the work for you, except for creating sims. There | 81 | This will do most of the work for you, except for creating sims. |
80 | is a final step that needs to be done manually for now. Edit | ||
81 | /etc/rc.local, make sure it has the following line in it somewhere, | ||
82 | probably at the end - | ||
83 | |||
84 | /opt/opensim/current/scripts/fix_var_run.sh | ||
85 | 82 | ||
86 | 83 | ||
87 | Creating sims. | 84 | Creating sims. |
diff --git a/InstallItAll.sh b/InstallItAll.sh index 0568709..6467ff8 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh | |||
@@ -1,42 +1,26 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | OSPATH="/opt/opensim" | ||
4 | MYSQL_HOST="localhost" | 3 | MYSQL_HOST="localhost" |
5 | MYSQL_DB="InfiniteGrid" | 4 | MYSQL_DB="opensim_SC" |
6 | MYSQL_USER="opensim" | 5 | MYSQL_USER="opensim_SC" |
7 | OS_USER="opensim" | 6 | |
8 | 7 | OS_VER="0.9.0.1" | |
9 | OSVER="0.9.0.1" | 8 | |
10 | 9 | source scripts/common.sh | |
11 | 10 | getPrgDir | |
12 | # Figure out where we are, most of this mess is to troll through soft links. | ||
13 | PRG="$0" | ||
14 | while [ -h "${PRG}" ] ; do | ||
15 | ls=$(ls -ld "${PRG}") | ||
16 | link=`expr "${ls}" : '.*-> \(.*\)$'` | ||
17 | if expr "${link}" : '.*/.*' > /dev/null; then | ||
18 | PRG="${link}" | ||
19 | else | ||
20 | PRG=$(dirname "${PRG}")/"${link}" | ||
21 | fi | ||
22 | done | ||
23 | PRGDIR=$(dirname "${PRG}") | ||
24 | pushd ${PRGDIR} >/dev/null | ||
25 | PRGDIR=$(pwd) | ||
26 | popd >/dev/null | ||
27 | 11 | ||
28 | # This should all be safe for pre existing installs that are being updated. | 12 | # This should all be safe for pre existing installs that are being updated. |
29 | 13 | ||
30 | MYSQL_PASSWORD=$1 | 14 | MYSQL_PASSWORD=$1 |
31 | # Try to get old database credentials if they exist. | 15 | # Try to get old database credentials if they exist. |
32 | if [ -f ${OSPATH}/config/config.ini ]; then | 16 | if [ -f ${OS_PATH}/config/config.ini ]; then |
33 | # Get the database credentials. | 17 | # Get the database credentials. |
34 | declare -A creds | 18 | declare -A creds |
35 | while read -d ';' p; do | 19 | while read -d ';' p; do |
36 | k=$(echo ${p} | cut -d '=' -f 1) | 20 | k=$(echo ${p} | cut -d '=' -f 1) |
37 | v=$(echo ${p} | cut -d '=' -f 2) | 21 | v=$(echo ${p} | cut -d '=' -f 2) |
38 | creds[${k}]="${v}" | 22 | creds[${k}]="${v}" |
39 | done < <(sudo grep ConnectionString ${OSPATH}/config/config.ini | cut -d '"' -f 2) | 23 | done < <(sudo grep ConnectionString ${OS_PATH}/config/config.ini | cut -d '"' -f 2) |
40 | # The above seems the best way to get bash to let the creds assignments survive outside the loop. | 24 | # The above seems the best way to get bash to let the creds assignments survive outside the loop. |
41 | 25 | ||
42 | MYSQL_HOST="${creds[Data Source]}" | 26 | MYSQL_HOST="${creds[Data Source]}" |
@@ -50,76 +34,89 @@ fi | |||
50 | 34 | ||
51 | USER=$(whoami) | 35 | USER=$(whoami) |
52 | 36 | ||
53 | echo "Installing software." | 37 | echo "Installing into ${OS_PATH}, as user ${OS_USER} ." |
54 | sudo apt-get install mysql-server tmux mono-complete mono-gmcs nunit uuid-runtime monit mc | 38 | echo "Using MySQL host:${MYSQL_HOST} database:${MYSQL_DB} user:${MYSQL_USER} password:${MYSQL_PASSWORD} ." |
39 | |||
40 | |||
41 | echo "Installing and compiling software." | ||
42 | sudo apt-get install mariadb-server tmux mono-complete mono-devel nunit uuid-runtime monit | ||
55 | # nant is done separately, coz it was removed from Debian for some mysterious reason. | 43 | # nant is done separately, coz it was removed from Debian for some mysterious reason. |
56 | sudo apt-get install nant | 44 | sudo apt-get install nant |
57 | sudo /etc/init.d/mysql restart | 45 | sudo /etc/init.d/mysql restart |
58 | 46 | ||
59 | echo "Setting up OpenSim users." | 47 | |
48 | echo "Setting up OpenSim users. This next prompt asks for your MySQL root users password." | ||
60 | # "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. | 49 | # "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. |
61 | mysql -u root -p -h localhost << zzzzEOFzzz | 50 | mysql -u root -p -h localhost << zzzzEOFzzz |
62 | create database if not exists $MYSQL_DB; | 51 | create database if not exists $MYSQL_DB; |
63 | create user $OS_USER identified by '$MYSQL_PASSWORD'; | 52 | create user '$OS_USER' identified by '$MYSQL_PASSWORD'; |
64 | create user $OS_USER@localhost identified by '$MYSQL_PASSWORD'; | 53 | create user '$OS_USER'@localhost identified by '$MYSQL_PASSWORD'; |
65 | grant all on $MYSQL_DB.* to $OS_USER; | 54 | grant all on $MYSQL_DB.* to '$OS_USER'; |
66 | grant all on $MYSQL_DB.* to $OS_USER@localhost; | 55 | grant all on $MYSQL_DB.* to '$OS_USER'@localhost; |
67 | FLUSH PRIVILEGES; | 56 | FLUSH PRIVILEGES; |
68 | zzzzEOFzzz | 57 | zzzzEOFzzz |
69 | 58 | ||
70 | echo "Setting up OpenSim." | 59 | sudo adduser --system --shell /bin/false --group ${OS_USER} |
71 | sudo adduser --system --shell /bin/false --group $OS_USER | 60 | sudo addgroup ${USER} ${OS_USER} |
72 | sudo addgroup $USER $OS_USER | ||
73 | 61 | ||
74 | echo "Building OpenSim." | ||
75 | ./BuildIt.sh | ||
76 | 62 | ||
77 | echo "Setting up OpenSim." | 63 | echo "Setting up OpenSim." |
78 | sudo rm -fr $OSPATH/opensim-IG_* | 64 | sudo rm -fr ${OS_PATH}/opensim-SC_* |
79 | sudo mkdir -p $OSPATH/opensim-IG_$OSVER | 65 | sudo mkdir -p ${OS_PATH}/opensim-SC_${OS_VER} |
80 | sudo cp -fr $PRGDIR/* $OSPATH/opensim-IG_$OSVER | 66 | sudo cp -fr $PRGDIR/* ${OS_PATH}/opensim-SC_${OS_VER} |
81 | 67 | cd ${OS_PATH} | |
82 | cd $OSPATH | 68 | if [ ! -h current ]; then |
83 | sudo ln -fs opensim-IG_$OSVER current | 69 | sudo ln -fs opensim-SC_${OS_VER} current |
70 | fi | ||
84 | 71 | ||
85 | cd current | 72 | cd current |
86 | |||
87 | for dir in AssetFiles backups caches config db logs | 73 | for dir in AssetFiles backups caches config db logs |
88 | do | 74 | do |
89 | if [ ! -f ../$dir ]; then | 75 | if [ ! -d ../$dir ]; then |
90 | sudo cp -fr example/$dir .. | 76 | sudo cp -fr example/$dir .. |
91 | fi | 77 | fi |
92 | done | 78 | done |
93 | 79 | ||
94 | pushd config/ROBUST >/dev/null | 80 | pushd ../config/ROBUST >/dev/null |
95 | sudo ln -fs ../../current/scripts/common.sh common.sh | 81 | sudo ln -fs ../../current/scripts/common.sh common.sh |
96 | sudo ln -fs ../../current/scripts/start-sim start-sim | 82 | sudo ln -fs ../../current/scripts/start-sim start-sim |
97 | sudo ln -fs ../../current/scripts/start-sim stop-sim | 83 | sudo ln -fs ../../current/scripts/start-sim stop-sim |
84 | sudo sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf | ||
98 | popd >/dev/null | 85 | popd >/dev/null |
99 | 86 | ||
100 | echo "Securing OpenSim." | 87 | sudo cp bin/config-include/config_* ../config/ |
101 | sudo chown -R $OS_USER:$OS_USER $OSPATH | 88 | sudo ln -fs config_localhost.ini ../config/config.ini |
102 | sudo chmod -R 775 $OSPATH | 89 | sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_IG.ini |
103 | sudo chmod -R a-x $OSPATH | 90 | sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_IG.ini |
104 | sudo chmod -R a+X $OSPATH | 91 | sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_IG.ini |
105 | sudo chmod -R g+w $OSPATH | 92 | |
106 | sudo chmod -R a+x $OSPATH/current/scripts/*.sh | 93 | sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_MG.ini |
107 | sudo chmod a+x $OSPATH/current/scripts/show-console | 94 | sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_MG.ini |
108 | sudo chmod a+x $OSPATH/current/scripts/start-sim | 95 | sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_MG.ini |
109 | 96 | ||
110 | sudo chmod ug+rwx $OSPATH/config | 97 | sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_localhost.ini |
111 | sudo chmod g+s $OSPATH/config | 98 | sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_localhost.ini |
112 | sudo chmod 600 $OSPATH/config/config.ini | 99 | sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_localhost.ini |
113 | 100 | ||
114 | sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" config/config.ini | 101 | sudo chmod 600 ../config/*.ini |
115 | sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" config/config.ini | 102 | sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_IG.ini |
116 | sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" config/config.ini | 103 | sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_MG.ini |
117 | sudo chmod 600 config/config.ini | 104 | sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_localhost.ini |
118 | sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" config/config.ini | 105 | sudo chmod 600 ../config/*.ini |
119 | sudo chmod 600 config/config.ini | 106 | |
120 | 107 | if [ ! -f /home/${OS_USER}/.tmux.conf ]; then | |
121 | sudo cp scripts/opensim.tmux.conf /home/$OS_USER/.tmux.conf | 108 | sudo cp scripts/install/opensim.tmux.conf /home/${OS_USER}/.tmux.conf |
122 | sudo chown $USER /home/$OS_USER/.tmux.conf | 109 | sudo chown ${OS_USER}:${OS_USR} /home/${OS_USER}/.tmux.conf |
123 | sudo chmod 644 /home/$OS_USER/.tmux.conf | 110 | sudo chmod 644 /home/${OS_USER}/.tmux.conf |
111 | fi | ||
112 | |||
113 | |||
114 | echo "Building OpenSim." | ||
115 | sudo chown -R ${USER}:${USER} ${OS_PATH} * | ||
116 | ./BuildIt.sh | ||
117 | |||
118 | |||
119 | cd scripts/install | ||
120 | sudo ./secure.sh | ||
124 | 121 | ||
125 | echo "Done installing OpenSim." | 122 | 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 @@ | |||
1 | ; ** | ||
2 | ; * The Const section allows us to define some basic information that we | ||
3 | ; * will use throughout our configuration. We will provide examples for | ||
4 | ; * setting the base url of the Robust server and the public and private ports | ||
5 | ; * it uses. Changing the values of the constants will set the operating | ||
6 | ; * parameters thoughout the configuration. Other constants that may prove | ||
7 | ; * to be useful may be added to the followin section. They may be | ||
8 | ; * referenced anywhere in the configuration by using ${Const|Name}. One | ||
9 | ; * such use is providing a base path for setting locations that Robust | ||
10 | ; * uses to write data. | ||
11 | |||
12 | ; Also put grid specific stuff here. | ||
13 | |||
14 | |||
15 | [Paths] | ||
16 | AssetsPath = "../../AssetFiles" | ||
17 | BackupPath = "../../backups" | ||
18 | CachePath = "../../caches" | ||
19 | DbPath = "../../db" | ||
20 | LogPath = "../../logs" | ||
21 | |||
22 | |||
23 | [Const] | ||
24 | ; MOTD = "onefang needs a little coding or sysadmin work to keep IG going. Please help me find some." | ||
25 | MOTD = "More members are coming, slowly. Invite your friends to." | ||
26 | |||
27 | GridName = "Infinite Grid" | ||
28 | ShortGridName = "IG" | ||
29 | |||
30 | ; For a grid these will usually be the externally accessible IP/DNS | ||
31 | ; name and use default public port 8002 and default private port 8003 | ||
32 | ; For a standalone this will usually be the externally accessible IP/DNS | ||
33 | ; name and use default public port 9000. The private port is not used | ||
34 | ; in the configuration for a standalone. | ||
35 | |||
36 | ;# {BaseURL} {} {BaseURL} {"http://example.com" "http://127.0.0.1"} "http://127.0.0.1" | ||
37 | BaseHostname = "http://grid.infinitegrid.org" | ||
38 | HostName = "grid.infinitegrid.org" | ||
39 | BaseURL = http://grid.infinitegrid.org | ||
40 | GridURL = http://grid.infinitegrid.org | ||
41 | |||
42 | ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" | ||
43 | PublicPort = "8002" | ||
44 | |||
45 | ;# {PrivatePort} {} {PrivatePort} {8003} "8003" | ||
46 | PrivatePort = "8003" | ||
47 | |||
48 | |||
49 | DataProvider = "OpenSim.Data.MySQL.dll" | ||
50 | ConnectionString = "Data Source=localhost;Database=****;User ID=****;Password=****;Old Guids=true;" | ||
51 | |||
52 | |||
53 | ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER | ||
54 | 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 @@ | |||
1 | information that we | ||
2 | ; will use throughout our configuration. We will provide examples for | ||
3 | ; setting the base url of the ROBUST server and the public and private ports | ||
4 | ; it uses. Changing the values of the constants will set the operating | ||
5 | ; parameters thoughout the configuration. Other constants that may prove | ||
6 | ; to be useful may be added to the followin section. They may be | ||
7 | ; referenced anywhere in the configuration by using ${Const|Name}. One | ||
8 | ; such use is providing a base path for setting locations that ROBUST | ||
9 | ; uses to write data. | ||
10 | |||
11 | ; Also put grid specific stuff here. | ||
12 | |||
13 | |||
14 | [Paths] | ||
15 | AssetsPath = "../../AssetFiles" | ||
16 | BackupPath = "../../backups" | ||
17 | CachePath = "../../caches" | ||
18 | DbPath = "../../db" | ||
19 | LogPath = "../../logs" | ||
20 | |||
21 | |||
22 | [Const] | ||
23 | MOTD = "onefang needs a little coding or sysadmin work to keep IG going. Please help me find some." | ||
24 | |||
25 | GridName = "Infinite Grid" | ||
26 | ShortGridName = "IG" | ||
27 | |||
28 | ; For a grid these will usually be the externally accessible IP/DNS | ||
29 | ; name and use default public port 8002 and default private port 8003 | ||
30 | ; For a standalone this will usually be the externally accessible IP/DNS | ||
31 | ; name and use default public port 9000. The private port is not used | ||
32 | ; in the configuration for a standalone. | ||
33 | BaseHostname = "http://grid.infinitegrid.org" | ||
34 | HostName = "grid.infinitegrid.org" | ||
35 | BaseURL = ${Const|BaseHostname} | ||
36 | GridURL = ${Const|BaseHostname} | ||
37 | |||
38 | PublicPort = "8002" | ||
39 | PrivatePort = "8003" | ||
40 | |||
41 | ; The public port of the ROBUST asset server, which might be different. | ||
42 | AssetServerPort = "8003" | ||
43 | |||
44 | ; Database credentials. | ||
45 | DataProvider = "OpenSim.Data.MySQL.dll" | ||
46 | 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.ini.MG_example b/bin/config-include/config_MG.ini index 737bff4..4f675d7 100644 --- a/bin/config-include/config.ini.MG_example +++ b/bin/config-include/config_MG.ini | |||
@@ -1,13 +1,12 @@ | |||
1 | ; ** | 1 | information that we |
2 | ; * The Const section allows us to define some basic information that we | 2 | ; will use throughout our configuration. We will provide examples for |
3 | ; * will use throughout our configuration. We will provide examples for | 3 | ; setting the base url of the ROBUST server and the public and private ports |
4 | ; * setting the base url of the Robust server and the public and private ports | 4 | ; it uses. Changing the values of the constants will set the operating |
5 | ; * it uses. Changing the values of the constants will set the operating | 5 | ; parameters thoughout the configuration. Other constants that may prove |
6 | ; * parameters thoughout the configuration. Other constants that may prove | 6 | ; to be useful may be added to the followin section. They may be |
7 | ; * to be useful may be added to the followin section. They may be | 7 | ; referenced anywhere in the configuration by using ${Const|Name}. One |
8 | ; * referenced anywhere in the configuration by using ${Const|Name}. One | 8 | ; such use is providing a base path for setting locations that ROBUST |
9 | ; * such use is providing a base path for setting locations that Robust | 9 | ; uses to write data. |
10 | ; * uses to write data. | ||
11 | 10 | ||
12 | ; Also put grid specific stuff here. | 11 | ; Also put grid specific stuff here. |
13 | 12 | ||
@@ -31,28 +30,23 @@ | |||
31 | ; For a standalone this will usually be the externally accessible IP/DNS | 30 | ; For a standalone this will usually be the externally accessible IP/DNS |
32 | ; name and use default public port 9000. The private port is not used | 31 | ; name and use default public port 9000. The private port is not used |
33 | ; in the configuration for a standalone. | 32 | ; in the configuration for a standalone. |
34 | |||
35 | ;# {BaseURL} {} {BaseURL} {"http://example.com" "http://127.0.0.1"} "http://127.0.0.1" | ||
36 | BaseHostname = "http://misfitzgrid.com" | 33 | BaseHostname = "http://misfitzgrid.com" |
37 | HostName = "misfitzgrid.com" | 34 | HostName = "misfitzgrid.com" |
38 | BaseURL = http://misfitzgrid.com | 35 | BaseURL = ${Const|BaseHostname} |
39 | GridURL = http://misfitzgrid.com | 36 | GridURL = ${Const|BaseHostname} |
40 | 37 | ||
41 | ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" | ||
42 | PublicPort = "8002" | 38 | PublicPort = "8002" |
43 | |||
44 | ;# {PrivatePort} {} {PrivatePort} {8003} "8003" | ||
45 | PrivatePort = "8003" | 39 | PrivatePort = "8003" |
46 | 40 | ||
41 | ; The public port of the ROBUST asset server, which might be different. | ||
42 | AssetServerPort = "8003" | ||
47 | 43 | ||
44 | ; Database credentials. | ||
48 | DataProvider = "OpenSim.Data.MySQL.dll" | 45 | DataProvider = "OpenSim.Data.MySQL.dll" |
49 | ConnectionString = "Data Source=localhost;Database=****;User ID=****;Password=****;Old Guids=true;" | 46 | ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" |
50 | |||
51 | 47 | ||
52 | ; jOpenSim URL | 48 | ; jOpenSim URL |
53 | jOpensimURL = "http://misfitzgrid.com/members" | 49 | jOpensimURL = "http://misfitzgrid.com/members" |
54 | ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER | ||
55 | AssetServerPort = "8004" | ||
56 | 50 | ||
57 | 51 | ||
58 | [Network] | 52 | [Network] |
diff --git a/bin/config-include/config.ini.localhost_example b/bin/config-include/config_localhost.ini index aa26abd..31f2f2c 100644 --- a/bin/config-include/config.ini.localhost_example +++ b/bin/config-include/config_localhost.ini | |||
@@ -1,13 +1,12 @@ | |||
1 | ; ** | 1 | ; ** information that we |
2 | ; * The Const section allows us to define some basic information that we | 2 | ; will use throughout our configuration. We will provide examples for |
3 | ; * will use throughout our configuration. We will provide examples for | 3 | ; setting the base url of the ROBUST server and the public and private ports |
4 | ; * setting the base url of the Robust server and the public and private ports | 4 | ; it uses. Changing the values of the constants will set the operating |
5 | ; * it uses. Changing the values of the constants will set the operating | 5 | ; parameters thoughout the configuration. Other constants that may prove |
6 | ; * parameters thoughout the configuration. Other constants that may prove | 6 | ; to be useful may be added to the followin section. They may be |
7 | ; * to be useful may be added to the followin section. They may be | 7 | ; referenced anywhere in the configuration by using ${Const|Name}. One |
8 | ; * referenced anywhere in the configuration by using ${Const|Name}. One | 8 | ; such use is providing a base path for setting locations that ROBUST |
9 | ; * such use is providing a base path for setting locations that Robust | 9 | ; uses to write data. |
10 | ; * uses to write data. | ||
11 | 10 | ||
12 | ; Also put grid specific stuff here. | 11 | ; Also put grid specific stuff here. |
13 | 12 | ||
@@ -31,22 +30,17 @@ | |||
31 | ; For a standalone this will usually be the externally accessible IP/DNS | 30 | ; For a standalone this will usually be the externally accessible IP/DNS |
32 | ; name and use default public port 9000. The private port is not used | 31 | ; name and use default public port 9000. The private port is not used |
33 | ; in the configuration for a standalone. | 32 | ; in the configuration for a standalone. |
34 | |||
35 | BaseHostname = "127.0.0.1" | 33 | BaseHostname = "127.0.0.1" |
36 | HostName = "localhost" | 34 | HostName = "localhost" |
37 | BaseURL = http://${Const|BaseHostname} | 35 | BaseURL = http://${Const|BaseHostname} |
38 | GridURL = http://${Const|BaseHostname} | 36 | GridURL = http://${Const|BaseHostname} |
39 | 37 | ||
40 | ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" | ||
41 | PublicPort = "8002" | 38 | PublicPort = "8002" |
42 | |||
43 | ;# {PrivatePort} {} {PrivatePort} {8003} "8003" | ||
44 | PrivatePort = "8003" | 39 | PrivatePort = "8003" |
45 | 40 | ||
41 | ; The public port of the ROBUST asset server, which might be different. | ||
42 | AssetServerPort = "8003" | ||
46 | 43 | ||
44 | ; Database credentials. | ||
47 | DataProvider = "OpenSim.Data.MySQL.dll" | 45 | DataProvider = "OpenSim.Data.MySQL.dll" |
48 | ConnectionString = "Data Source=localhost;Database=****;User ID=****;Password=****;Old Guids=true;" | 46 | ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" |
49 | |||
50 | |||
51 | ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER | ||
52 | AssetServerPort = "8003" | ||
diff --git a/example/caches/MeshCache/.keep b/example/caches/MeshCache/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/example/caches/MeshCache/.keep | |||
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 @@ | |||
21 | # | 21 | # |
22 | # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. | 22 | # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. |
23 | # | 23 | # |
24 | check process ROBUST with pidfile /var/run/opensim/ROBUST.pid | 24 | check process ROBUST with pidfile OS_PATH/caches/ROBUST.pid |
25 | start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/ROBUST && /opt/opensim/config/ROBUST/start-sim -q'" | 25 | start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd OS_PATH/config/ROBUST && OS_PATH/config/ROBUST/start-sim -q'" |
26 | as uid root and gid root | 26 | as uid root and gid root |
27 | 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 | 27 | 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 |
28 | if cpu usage > 50% for 4 cycles then restart | 28 | if cpu usage > 50% for 4 cycles then restart |
29 | # if 5 restarts within 5 cycles then timeout | 29 | # if 5 restarts within 5 cycles then timeout |
30 | # if failed url http://127.0.0.1:9005/jsonSimStats/ | 30 | # 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 @@ | |||
1 | ; ** | 1 | ; The Const section allows us to define some basic information that we |
2 | ; * The Const section allows us to define some basic information that we | 2 | ; will use throughout our configuration. We will provide examples for |
3 | ; * will use throughout our configuration. We will provide examples for | 3 | ; setting the base url of the ROBUST server and the public and private ports |
4 | ; * setting the base url of the Robust server and the public and private ports | 4 | ; it uses. Changing the values of the constants will set the operating |
5 | ; * it uses. Changing the values of the constants will set the operating | 5 | ; parameters thoughout the configuration. Other constants that may prove |
6 | ; * parameters thoughout the configuration. Other constants that may prove | 6 | ; to be useful may be added to the followin section. They may be |
7 | ; * to be useful may be added to the followin section. They may be | 7 | ; referenced anywhere in the configuration by using ${Const|Name}. One |
8 | ; * referenced anywhere in the configuration by using ${Const|Name}. One | 8 | ; such use is providing a base path for setting locations that ROBUST |
9 | ; * such use is providing a base path for setting locations that Robust | 9 | ; uses to write data. |
10 | ; * uses to write data. | ||
11 | 10 | ||
12 | ; Also put grid specific stuff here. | 11 | ; Also put grid specific stuff here. |
13 | 12 | ||
@@ -31,22 +30,17 @@ | |||
31 | ; For a standalone this will usually be the externally accessible IP/DNS | 30 | ; For a standalone this will usually be the externally accessible IP/DNS |
32 | ; name and use default public port 9000. The private port is not used | 31 | ; name and use default public port 9000. The private port is not used |
33 | ; in the configuration for a standalone. | 32 | ; in the configuration for a standalone. |
34 | |||
35 | BaseHostname = "127.0.0.1" | 33 | BaseHostname = "127.0.0.1" |
36 | HostName = "localhost" | 34 | HostName = "localhost" |
37 | BaseURL = http://${Const|BaseHostname} | 35 | BaseURL = http://${Const|BaseHostname} |
38 | GridURL = http://${Const|BaseHostname} | 36 | GridURL = http://${Const|BaseHostname} |
39 | 37 | ||
40 | ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" | ||
41 | PublicPort = "8002" | 38 | PublicPort = "8002" |
42 | |||
43 | ;# {PrivatePort} {} {PrivatePort} {8003} "8003" | ||
44 | PrivatePort = "8003" | 39 | PrivatePort = "8003" |
45 | 40 | ||
41 | ; The public port of the ROBUST asset server, which might be different. | ||
42 | AssetServerPort = "8003" | ||
46 | 43 | ||
44 | ; Database credentials. | ||
47 | DataProvider = "OpenSim.Data.MySQL.dll" | 45 | DataProvider = "OpenSim.Data.MySQL.dll" |
48 | ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" | 46 | ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" |
49 | |||
50 | |||
51 | ; The public port of the Robust server -- THIS IS SPECIAL PORT FOR ASSSET SERVER | ||
52 | 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 @@ | |||
9 | <Key Name="RegionType" Value="private sim" /> | 9 | <Key Name="RegionType" Value="private sim" /> |
10 | <Key Name="SizeX" Value="SIM_SIZE" /> | 10 | <Key Name="SizeX" Value="SIM_SIZE" /> |
11 | <Key Name="SizeY" Value="SIM_SIZE" /> | 11 | <Key Name="SizeY" Value="SIM_SIZE" /> |
12 | <Key Name="SizeZ" Value="16384" /> | ||
13 | <Key Name="MaxAgents" Value="100" /> | ||
14 | <Key Name="MaxPrims" Value="45000" /> | ||
15 | <Key Name="PhysicalPrimMax" Value="640" /> | ||
16 | <Key Name="NonphysicalPrimMax" Value="2560" /> | ||
17 | <Key Name="ClampPrimSize" Value="False" /> | ||
18 | <Key Name="MaptileStaticUUID" Value="00000000-0000-0000-0000-000000000000" /> | ||
12 | </Section> | 19 | </Section> |
13 | </Nini> | 20 | </Nini> |
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 @@ | |||
2 | mysim="SIM_NUMBER" | 2 | mysim="SIM_NUMBER" |
3 | 3 | ||
4 | [Startup] | 4 | [Startup] |
5 | PIDFile = "/var/run/opensim/sim${Const|mysim}.pid" | 5 | PIDFile = "${Paths|CachePath}/sim${Const|mysim}.pid" |
6 | regionload_regionsdir="/opt/opensim/config/sim${Const|mysim}" | 6 | LogFile = "${Paths|LogPath}/OpenSim_sim${Const|mysim}.log" |
7 | LogFile = "../logs/OpenSim_sim${Const|mysim}.log" | 7 | ConsoleHistoryFile = "${Paths|LogPath}/OpenSimConsoleHistory_sim${Const|mysim}.txt" |
8 | regionload_regionsdir="../../config/sim${Const|mysim}" | ||
9 | |||
10 | [Map] | ||
11 | enablePosition = true | ||
12 | ; Only texture prims that have a diagonal size greater than this number. | ||
13 | TexturePrimSize = 1 | ||
8 | 14 | ||
9 | [Network] | 15 | [Network] |
10 | http_listener_port = SIM_PORT | 16 | http_listener_port = SIM_PORT |
17 | |||
18 | [Performance] | ||
19 | ;; Select the performance characteristirs of OpenSim. | ||
20 | ; Include-Performance = "config-include/SimFast.ini" | ||
21 | Include-Performance = "config-include/SimBalanced.ini" | ||
22 | ; Include-Performance = "config-include/SimDefault.ini" | ||
23 | ; Include-Performance = "config-include/SimLean.ini" | ||
24 | │ 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+ | ||
25 | \ 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 @@ | |||
13 | # | 13 | # |
14 | # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. | 14 | # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. |
15 | # | 15 | # |
16 | check process simSIM_NUMBER with pidfile /var/run/opensim/simSIM_NUMBER.pid | 16 | check process simSIM_NUMBER with pidfile OS_PATH/caches/simSIM_NUMBER.pid |
17 | start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/simSIM_NUMBER && /opt/opensim/config/simSIM_NUMBER/start-sim -q'" | 17 | start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd OS_PATH/config/simSIM_NUMBER && OS_PATH/config/simSIM_NUMBER/start-sim -q'" |
18 | as uid root and gid root | 18 | as uid root and gid root |
19 | 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 | 19 | 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 |
20 | if cpu usage > 50% for 4 cycles then restart | 20 | if cpu usage > 50% for 4 cycles then restart |
21 | if MEMORY usage > 25% for 4 cycles then restart | 21 | if MEMORY usage > 10% for 4 cycles then restart |
22 | # if 5 restarts within 5 cycles then timeout | 22 | # if 5 restarts within 5 cycles then timeout |
23 | # if failed url http://127.0.0.1:9005/jsonSimStats/ | 23 | # if failed url http://127.0.0.1:9005/jsonSimStats/ |
24 | # and content != '"SimFPS":0.0,' for 4 cycles | 24 | # 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 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | cd /opt/opensim-IG/current/bin | 3 | cd /opt/opensim_SC/current/bin |
4 | mono OpenSim.exe -inidirectory=../../config/simg01 | 4 | 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 | |||
6 | for i in $(seq -w 1 99) | 6 | for i in $(seq -w 1 99) |
7 | do | 7 | do |
8 | j=$(num2name ${i}) | 8 | j=$(num2name ${i}) |
9 | if [ -e "${PRGDIR}/../config/${j}" ] | 9 | if [ -e "${PRGDIR}/../../config/${j}" ] |
10 | then | 10 | then |
11 | pushd ${PRGDIR}/../config/${j} >/dev/null | 11 | pushd ${PRGDIR}/../../config/${j} >/dev/null |
12 | # Find out the size of the last backup, base our later sleep on that, but do it now before backup-sim packs it away. | 12 | # Find out the size of the last backup, base our later sleep on that, but do it now before backup-sim packs it away. |
13 | sizeSleep=`sleepPerSize o "$(getSimName ${i})"` | 13 | sizeSleep=`sleepPerSize o "$(getSimName ${i})"` |
14 | ./backup-sim | 14 | ./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 @@ | |||
1 | #!/bin/echo Don't run this file, it's for common functions." | 1 | #!/bin/echo Don't run this file, it's for common functions." |
2 | 2 | ||
3 | OS_PATH="/opt/opensim_SC" | ||
4 | OS_USER="opensimsc" | ||
3 | 5 | ||
4 | # Figure out where we are, most of this mess is to troll through soft links. | 6 | # Figure out where we are, most of this mess is to troll through soft links. |
5 | # PRGDIR=$(getPrgDir) | 7 | # PRGDIR=$(getPrgDir) |
@@ -73,4 +75,3 @@ sleepPerSize() | |||
73 | echo 200 | 75 | echo 200 |
74 | fi | 76 | fi |
75 | } | 77 | } |
76 | |||
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 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | source common.sh | 3 | source ../common.sh |
4 | getPrgDir | 4 | getPrgDir |
5 | 5 | ||
6 | NAME=$1 | 6 | NAME=$1 |
@@ -9,8 +9,7 @@ URL=$3 | |||
9 | IP=$4 | 9 | IP=$4 |
10 | SIZE=$5 | 10 | SIZE=$5 |
11 | 11 | ||
12 | OSPATH="/opt/opensim" | 12 | cd ${OS_PATH}/config |
13 | cd $OSPATH/config | ||
14 | 13 | ||
15 | k=0 | 14 | k=0 |
16 | for i in $(seq -w 1 99) | 15 | for i in $(seq -w 1 99) |
@@ -22,38 +21,37 @@ do | |||
22 | fi | 21 | fi |
23 | done | 22 | done |
24 | 23 | ||
25 | if [ "x$NAME" = "x" ] | 24 | if [ "x${NAME}" = "x" ] |
26 | then | 25 | then |
27 | NAME="No name sim $RANDOM" # Should be unique per grid. | 26 | NAME="No name sim $RANDOM" # Should be unique per grid. |
28 | echo "WARNING setting the sim name to [$NAME], this may not be what you want." | 27 | echo "WARNING setting the sim name to [${NAME}], this may not be what you want." |
29 | fi | 28 | fi |
30 | # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. | 29 | # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. |
31 | sim=$(sanitize $NAME) | 30 | sim=$(sanitize ${NAME}) |
32 | 31 | ||
33 | if [ "x$LOCATION" = "x" ] | 32 | if [ "x${LOCATION}" = "x" ] |
34 | then | 33 | then |
35 | LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! | 34 | LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! |
36 | echo "WARNING setting the Location to $LOCATION, this may not be what you want." | 35 | echo "WARNING setting the Location to ${LOCATION}, this may not be what you want." |
37 | fi | 36 | fi |
38 | 37 | ||
39 | if [ "x$IP" = "x" ] | 38 | if [ "x${IP}" = "x" ] |
40 | then | 39 | then |
41 | # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. | ||
42 | IP="0.0.0.0" | 40 | IP="0.0.0.0" |
43 | echo "WARNING setting the InternalAddress to $IP, this may not be what you want." | 41 | echo "WARNING setting the InternalAddress to ${IP}, this may not be what you want." |
44 | # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." | 42 | # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." |
45 | # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. | 43 | # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. |
46 | fi | 44 | fi |
47 | 45 | ||
48 | if [ "x$URL" = "x" ] | 46 | if [ "x${URL}" = "x" ] |
49 | then | 47 | then |
50 | # Here we make use of an external IP finding service. Careful, it may move. | 48 | # Here we make use of an external IP finding service. Careful, it may move. |
51 | # 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. | 49 | # 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. |
52 | URL="SYSTEMIP" | 50 | URL="SYSTEMIP" |
53 | echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." | 51 | echo "WARNING setting the ExternalHostName to ${URL}, this may not be what you want." |
54 | fi | 52 | fi |
55 | 53 | ||
56 | if [ "x$SIZE" = "x" ] | 54 | if [ "x${SIZE}" = "x" ] |
57 | then | 55 | then |
58 | SIZE="256" | 56 | SIZE="256" |
59 | fi | 57 | fi |
@@ -68,29 +66,30 @@ fi | |||
68 | PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. | 66 | PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. |
69 | UUID=$(uuidgen) | 67 | UUID=$(uuidgen) |
70 | 68 | ||
71 | echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." | 69 | echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}." |
72 | 70 | ||
73 | cp -r sim_skeleton sim$NUM | 71 | cp -r sim_skeleton sim${NUM} |
74 | 72 | ||
75 | cd sim$NUM | 73 | cd sim${NUM} |
76 | mv My_sim.xml ${sim}.xml | 74 | mv My_sim.xml ${sim}.xml |
77 | sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml | 75 | sed -i "s@SIM_NAME@${NAME}@g" ${sim}.xml |
78 | sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml | 76 | sed -i "s@SIM_UUID@${UUID}@g" ${sim}.xml |
79 | sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml | 77 | sed -i "s@SIM_POS@${LOCATION}@g" ${sim}.xml |
80 | sed -i "s@SIM_IP@$IP@g" ${sim}.xml | 78 | sed -i "s@SIM_IP@${IP}@g" ${sim}.xml |
81 | sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml | 79 | sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ${sim}.xml |
82 | sed -i "s@SIM_URL@$URL@g" ${sim}.xml | 80 | sed -i "s@SIM_URL@${URL}@g" ${sim}.xml |
83 | sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml | 81 | sed -i "s@SIM_SIZE@${SIZE}@g" ${sim}.xml |
84 | 82 | ||
85 | ln -s ../../current/scripts/common.sh common.sh | 83 | ln -s ../../current/scripts/common.sh common.sh |
86 | ln -s ../../current/scripts/start-sim start-sim | 84 | ln -s ../../current/scripts/start-sim start-sim |
87 | cp -P start-sim backup-sim | 85 | cp -P start-sim backup-sim |
88 | cp -P start-sim stop-sim | 86 | cp -P start-sim stop-sim |
89 | 87 | ||
90 | sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini | 88 | sed -i "s@SIM_NUMBER@${NUM}@g" ThisSim.ini |
91 | sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini | 89 | sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini |
92 | 90 | ||
93 | sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf | 91 | sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf |
92 | sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf | ||
94 | 93 | ||
95 | sudo chown -R opensim:opensim .. | 94 | sudo chown -R ${OS_USER}:${OS_USER} .. |
96 | sudo chmod -R g+w .. | 95 | 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 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | OSPATH="/opt/opensim" | 3 | source common.sh |
4 | 4 | ||
5 | for i in $(seq 99) | 5 | for i in $(seq 99) |
6 | do | 6 | 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 @@ | |||
9 | # on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in | 9 | # on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in |
10 | # /etc/default/monit . the below assumes you've set it to 30 seconds. | 10 | # /etc/default/monit . the below assumes you've set it to 30 seconds. |
11 | # | 11 | # |
12 | # if process dies, will restart sim within 30 seconds. if process | ||
13 | # dies 5 times in as many tries, will stop trying and send email | ||
14 | # alert. | ||
15 | # | ||
16 | # if SimFPS drops to 0 for 2 minutes, restart. | ||
17 | # | ||
18 | # if process CPU usage stays above 300% for 2 minutes, restart. | ||
19 | # | ||
20 | # see ../README for configuration instructions. | 12 | # see ../README for configuration instructions. |
21 | # | 13 | # |
22 | # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. | 14 | # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. |
23 | # | 15 | # |
24 | check process sim01 with pidfile /var/run/opensim/sim01.pid | 16 | check process simSIM_NUMBER with pidfile /OS_PATH/caches/simSIM_NUMBER.pid |
25 | start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/start-sim -q'" | 17 | start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /OS_PATH/config/simSIM_NUMBER && /OS_PATH/config/simSIM_NUMBER/start-sim -q'" |
26 | as uid root and gid root | 18 | as uid root and gid root |
27 | 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 | 19 | 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 |
28 | if cpu usage > 50% for 4 cycles then restart | 20 | if cpu usage > 50% for 4 cycles then restart |
21 | if MEMORY usage > 10% for 4 cycles then restart | ||
29 | # if 5 restarts within 5 cycles then timeout | 22 | # if 5 restarts within 5 cycles then timeout |
30 | # if failed url http://127.0.0.1:9005/jsonSimStats/ | 23 | # if failed url http://127.0.0.1:9005/jsonSimStats/ |
31 | # and content != '"SimFPS":0.0,' for 4 cycles | 24 | # and content != '"SimFPS":0.0,' for 4 cycles |
@@ -33,4 +26,4 @@ check process sim01 with pidfile /var/run/opensim/sim01.pid | |||
33 | # if failed url http://127.0.0.1:9008/jsonSimStats/ | 26 | # if failed url http://127.0.0.1:9008/jsonSimStats/ |
34 | # and content == '"SimFPS":' for 4 cycles | 27 | # and content == '"SimFPS":' for 4 cycles |
35 | # then restart | 28 | # then restart |
36 | 29 | 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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | source ../common.sh | ||
4 | |||
5 | echo "Securing OpenSim." | ||
6 | sudo chmod 600 ${OS_PATH}/config/*.ini | ||
7 | sudo chown -R ${OS_USER}:${OS_USER} ${OS_PATH} | ||
8 | sudo chmod -R 775 ${OS_PATH} | ||
9 | sudo chmod -R a-x ${OS_PATH} | ||
10 | sudo chmod -R a+X ${OS_PATH} | ||
11 | sudo chmod -R g+w ${OS_PATH} | ||
12 | sudo chmod -R a+x ${OS_PATH}/current/*.sh | ||
13 | sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh | ||
14 | sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh | ||
15 | sudo chmod a+x ${OS_PATH}/current/scripts/show-console | ||
16 | sudo chmod a+x ${OS_PATH}/current/scripts/start-sim | ||
17 | |||
18 | sudo chmod ug+rwx ${OS_PATH}/config | ||
19 | sudo chmod g+s ${OS_PATH}/config | ||
20 | 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 | |||
38 | if [ "x$1" = "x" ]; then | 38 | if [ "x$1" = "x" ]; then |
39 | tgt=$(basename $(pwd)) | 39 | tgt=$(basename $(pwd)) |
40 | num="$(echo ${tgt} | cut -c 4-)" | 40 | num="$(echo ${tgt} | cut -c 4-)" |
41 | elif [ -d "./$1" ]; then | 41 | elif [ -d "$1" ]; then |
42 | tgt=$1 | 42 | tgt=$1 |
43 | elif [ -d "./sim$1" ]; then | 43 | elif [ -d "sim$1" ]; then |
44 | num=$1 | 44 | num=$1 |
45 | tgt="./sim${num}" | 45 | tgt="sim${num}" |
46 | else | 46 | else |
47 | tgt=$1 | 47 | tgt=$1 |
48 | inventory=$1 | 48 | inventory=$1 |
@@ -77,14 +77,14 @@ fi | |||
77 | 77 | ||
78 | case $(basename $0) in | 78 | case $(basename $0) in |
79 | "start-sim") | 79 | "start-sim") |
80 | cmd="mono ${exe}.exe -inidirectory=${tgt} " | 80 | cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} " |
81 | 81 | ||
82 | # Check if it's already running. | 82 | # Check if it's already running. |
83 | if [ -e /var/run/opensim/${tgt}.pid ] | 83 | if [ -e /var/run/opensim/${tgt}.pid ] |
84 | then | 84 | then |
85 | # Double check if it's REALLY running. | 85 | # Double check if it's REALLY running. |
86 | if [ "x$(ps -p $(cat /var/run/opensim/${tgt}.pid) --no-headers -o comm)" = "x" ]; then | 86 | if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then |
87 | $SUDO rm -f /var/run/opensim/${tgt}.pid | 87 | $SUDO rm -f ${PRGDIR}/../../caches/${tgt}.pid |
88 | fi | 88 | fi |
89 | fi | 89 | fi |
90 | # Now see if it's really really running. lol | 90 | # Now see if it's really really running. lol |
@@ -92,9 +92,9 @@ case $(basename $0) in | |||
92 | then | 92 | then |
93 | if [ "x$tgt" = "xROBUST" ]; then | 93 | if [ "x$tgt" = "xROBUST" ]; then |
94 | # TODO - the problem here is that the > bit is executed as onefang, not as opensim. | 94 | # TODO - the problem here is that the > bit is executed as onefang, not as opensim. |
95 | $SUDO cat ../config/config.ini ../config/Robust.ini.template >../config/Robust.ini | 95 | $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini |
96 | # $SUDO chown -R opensim:opensim ../config/Robust.ini | 96 | # $SUDO chown -R opensim:opensim ${PRGDIR}/../../config/Robust.ini |
97 | chmod 640 ../config/Robust.ini | 97 | chmod 640 ${PRGDIR}/../../config/Robust.ini |
98 | ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" | 98 | ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" |
99 | else | 99 | else |
100 | ${tmux_command} new-window -dn "${title}" -t "${tmux_session}:${num}" "${cmd}" | 100 | ${tmux_command} new-window -dn "${title}" -t "${tmux_session}:${num}" "${cmd}" |