aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/install
diff options
context:
space:
mode:
authoronefang2019-05-21 04:41:57 +1000
committeronefang2019-05-21 04:41:57 +1000
commit8723177732fe0843116a81b5c935cb440799e243 (patch)
tree94b2018d492c321c6ae69c79e812353a1d831fbf /scripts/install
parentTypo-- (diff)
downloadopensim-SC_OLD-8723177732fe0843116a81b5c935cb440799e243.zip
opensim-SC_OLD-8723177732fe0843116a81b5c935cb440799e243.tar.gz
opensim-SC_OLD-8723177732fe0843116a81b5c935cb440799e243.tar.bz2
opensim-SC_OLD-8723177732fe0843116a81b5c935cb440799e243.tar.xz
Move install related scripts and stuff into their own directory.
Diffstat (limited to 'scripts/install')
-rwxr-xr-xscripts/install/create_sim.sh96
-rwxr-xr-xscripts/install/go_live.sh12
-rw-r--r--scripts/install/group_migrate.sql48
-rw-r--r--scripts/install/opensim-monit.conf36
-rw-r--r--scripts/install/opensim.tmux.conf52
5 files changed, 244 insertions, 0 deletions
diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh
new file mode 100755
index 0000000..0681067
--- /dev/null
+++ b/scripts/install/create_sim.sh
@@ -0,0 +1,96 @@
1#!/bin/bash
2
3source common.sh
4getPrgDir
5
6NAME=$1
7LOCATION=$2
8URL=$3
9IP=$4
10SIZE=$5
11
12OSPATH="/opt/opensim"
13cd $OSPATH/config
14
15k=0
16for i in $(seq -w 1 99)
17do
18 j=$(num2name "$i")
19 if [ -e "$j" ]
20 then
21 k=$i
22 fi
23done
24
25if [ "x$NAME" = "x" ]
26then
27 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."
29fi
30# Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows.
31sim=$(sanitize $NAME)
32
33if [ "x$LOCATION" = "x" ]
34then
35 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."
37fi
38
39if [ "x$IP" = "x" ]
40then
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"
43 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."
45# According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine.
46fi
47
48if [ "x$URL" = "x" ]
49then
50# 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.
52 URL="SYSTEMIP"
53 echo "WARNING setting the ExternalHostName to $URL, this may not be what you want."
54fi
55
56if [ "x$SIZE" = "x" ]
57then
58 SIZE="256"
59fi
60
61# Wow, the hoops we have to jump through to avoid octal.
62if [ 9 -gt $k ]; then
63 NUM=$(printf '0%1s' $(( 10#$k + 1 )) )
64else
65 NUM=$(printf '%2s' $(( 10#$k + 1 )) )
66fi
67
68PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000.
69UUID=$(uuidgen)
70
71echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME."
72
73cp -r sim_skeleton sim$NUM
74
75cd sim$NUM
76mv My_sim.xml ${sim}.xml
77sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml
78sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml
79sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml
80sed -i "s@SIM_IP@$IP@g" ${sim}.xml
81sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml
82sed -i "s@SIM_URL@$URL@g" ${sim}.xml
83sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml
84
85ln -s ../../current/scripts/common.sh common.sh
86ln -s ../../current/scripts/start-sim start-sim
87cp -P start-sim backup-sim
88cp -P start-sim stop-sim
89
90sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini
91sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini
92
93sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf
94
95sudo chown -R opensim:opensim ..
96sudo chmod -R g+w ..
diff --git a/scripts/install/go_live.sh b/scripts/install/go_live.sh
new file mode 100755
index 0000000..21d7072
--- /dev/null
+++ b/scripts/install/go_live.sh
@@ -0,0 +1,12 @@
1#!/bin/bash
2
3OSPATH="/opt/opensim"
4
5for i in $(seq 99)
6do
7 j=$(printf "sim%02d" $i)
8 if [ -e "$OSPATH/config/$j" ]
9 then
10 sudo ln -s $OSPATH/config/$j/opensim-monit.conf /etc/monit/conf.d/$j.conf
11 fi
12done
diff --git a/scripts/install/group_migrate.sql b/scripts/install/group_migrate.sql
new file mode 100644
index 0000000..6c15011
--- /dev/null
+++ b/scripts/install/group_migrate.sql
@@ -0,0 +1,48 @@
1INSERT INTO `griddy`.`os_groups_groups`
2(GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList,
3AllowPublish, MaturePublish, OwnerRoleID)
4SELECT GroupID, Name, Charter, InsigniaID, FounderID, MemberShipFee, OpenEnrollment, ShowInList, AllowPublish,
5MaturePublish, OwnerRoleID
6FROM `griddy`.osgroup;
7
8/*fill os_groups_invites in ROBUST database with values from osgroupinvite
9or FlotSam osgroupinvite*/
10INSERT INTO `griddy`.`os_groups_invites`
11(InviteID, GroupID, RoleID, PrincipalID, TMStamp)
12SELECT InviteID, GroupID, RoleID, AgentID, TMStamp
13FROM `griddy`.osgroupinvite;
14
15/*fill os_groups_membership in ROBUST database with values from osgroupmembership
16or FlotSam osgroupmembership*/
17INSERT INTO `griddy`.`os_groups_membership`
18(GroupID, PrincipalID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices)
19SELECT GroupID, AgentID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices
20FROM `griddy`.osgroupmembership;
21
22/*fill os_groups_notices in ROBUST database with values from osgroupnotice
23or FlotSam osgroupnotice*/
24INSERT INTO `griddy`.`os_groups_notices`
25(GroupID, NoticeID, TMStamp, FromName, Subject, Message)
26SELECT GroupID, NoticeID, Timestamp, FromName, Subject, Message
27FROM `griddy`.osgroupnotice;
28
29/*fill os_groups_principals in ROBUST database with values from osagent
30or FlotSam osagent*/
31INSERT INTO `griddy`.`os_groups_principals`
32(PrincipalID, ActiveGroupID)
33SELECT AgentID, ActiveGroupID
34FROM `griddy`.osagent;
35
36/*fill os_groups_rolemembership in ROBUST database with values from osrolemembership
37or FlotSam osgrouprolemembership*/
38INSERT INTO `griddy`.os_groups_rolemembership
39(GroupID, RoleID, PrincipalID)
40SELECT GroupID, RoleID, AgentID
41FROM `griddy`.osgrouprolemembership;
42
43/*fill os_groups_roles in ROBUST database with values from osroles
44or FlotSam osrole*/
45INSERT INTO `griddy`.os_groups_roles
46(GroupID, RoleID, Name, Description, Title, Powers)
47SELECT GroupID, RoleID, Name, Description, Title, Powers
48FROM `griddy`.osrole;
diff --git a/scripts/install/opensim-monit.conf b/scripts/install/opensim-monit.conf
new file mode 100644
index 0000000..7785056
--- /dev/null
+++ b/scripts/install/opensim-monit.conf
@@ -0,0 +1,36 @@
1# manage the OpenSim process for Your Sim
2#
3# usage:
4# monit start your_sim
5# monit stop your_sim
6# monit restart your_sim
7#
8# see 'daemon' setting in /etc/monit/monitrc for the cycle length.
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.
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.
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.
23#
24check process sim01 with pidfile /var/run/opensim/sim01.pid
25 start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/start-sim -q'"
26 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
28 if cpu usage > 50% for 4 cycles then restart
29# if 5 restarts within 5 cycles then timeout
30# if failed url http://127.0.0.1:9005/jsonSimStats/
31# and content != '"SimFPS":0.0,' for 4 cycles
32# then restart
33# if failed url http://127.0.0.1:9008/jsonSimStats/
34# and content == '"SimFPS":' for 4 cycles
35# then restart
36
diff --git a/scripts/install/opensim.tmux.conf b/scripts/install/opensim.tmux.conf
new file mode 100644
index 0000000..ea342a2
--- /dev/null
+++ b/scripts/install/opensim.tmux.conf
@@ -0,0 +1,52 @@
1# Tmux has a habit of changing what these options are for each version, so this is a bit of a mess.
2
3set-option -g prefix C-a
4unbind-key C-b
5bind-key C-a send-prefix
6
7# r reloads the configuration, handy
8bind r source-file ~/.tmux.conf
9
10unbind % # Remove default binding since we’re replacing them.
11bind | split-window -h
12bind - split-window -v
13
14set-option -g bell-action any
15set-option -g bell-on-alert on
16
17set-option -g history-limit 100000
18
19# These three wont work under Ubuntu 16.04.
20set-option -g mouse-resize-pane on
21set-option -g mouse-select-pane on
22set-option -g mouse-select-window on
23set-option -g mouse-utf8 on
24
25#set-option -g set-remain-on-exit on
26set-option -g set-titles on
27set-option -g set-titles-string '#W'
28
29set-option -g status-interval 1
30set-option -g status-justify centre
31set-option -g status-utf8 on
32
33set-option -g status-left-length 80
34set-option -g status-left '[#H #S #F]'
35set-option -g status-right-length 80
36set-option -g status-right '%F #(uptime)'<-----># &F is ISO date, uptime starts with the current time, and ends with the load average. B-)
37
38set-option -g visual-activity on
39set-option -g visual-content on
40set-option -g visual-silence on
41
42set-option -gw clock-mode-style 24
43# This wont work under Ubuntu 16.04.
44set-option -gw mode-mouse on
45# Instead do this (also defaults to turning on the above three mouse things) -
46#set-option -gw mouse on
47
48# Highlight active window
49set-option -gw window-status-current-bg red
50
51# Set window notifications
52set-option -gw monitor-activity on