Change font size
It is currently Wed Jan 23, 2019 2:47 am

Forum rules


{L_IMAGE}
Keep the training material related in some way to OSGrid and OpenSIM or tools that you would use externally to opensim such as image editors and database tools etc... but ultimately the material presented benefits OpenSIM and OSGrid.



Post a new topicPost a reply Page 8 of 9   [ 83 posts ]
Go to page Previous  1 ... 5, 6, 7, 8, 9  Next
Author Message
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Fri Mar 23, 2012 1:03 pm 
User avatar

Joined: Sun Nov 20, 2011 11:32 pm
Posts: 38
Location: Wichita, KS
Cam,

It is two whole minutes between monit loading and starting opensim, I just couldn't wait that long. LOL

Cam Chevalier {L_WROTE}:
Twisted,
This is interesting, I will give it a try, but I dont find much time lost between the booting of linux and the booting of opensim, what waiting are you referring to?
Although anything that reduces downtime is good :)

_________________
Cheers,
Twisted


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Mon Mar 26, 2012 9:49 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
Well I am just going through the tutorial now (sorry I got slow).

But I see in /etc/monit/monitrc:

{L_CODE}:
## Start Monit in the background (run as a daemon):
#
# set daemon 120             # check services at 2-minute intervals
#      with start delay 240  # optional: delay the first check by 4-minutes (by
#                            # default Monit check immediately after Monit start)

So Monit should check and start OpenSim immediately unless the 'start delay' is used.

Also I would think Monit has to run *after* MySql in the boot process or it could cause trouble with OpenSim.

Twisted Stickfigure {L_WROTE}:
Cam,

It is two whole minutes between monit loading and starting opensim, I just couldn't wait that long. LOL

Cam Chevalier {L_WROTE}:
Twisted,
This is interesting, I will give it a try, but I dont find much time lost between the booting of linux and the booting of opensim, what waiting are you referring to?
Although anything that reduces downtime is good :)


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Mon Mar 26, 2012 10:13 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
Hello Cam. I am going through the tutorial. So far it has been a BIG help.

I noticed in the two files 'opensim' and 'opensim.conf' some of the paths used were different from what was used in the body of the tutorial.

In the 'setup()' function in opensim (http://lets3d.com/monit/opensim):
- the PID var is pointing to /var/run/opensim/${SIM}.pid instead of /home/opensim/opensim.pid" as was setup in OpenSim.ini earlier in the tutorial.
- the OPENSIM_DIR var is set to /usr/lib/opensim instead of /home/opensim as was setup earlier also.
{L_CODE}:
if [ $SIM == "your_sim" ]; then
        MONO="/usr/bin/mono"
        PID="/var/run/opensim/${SIM}.pid"
        OPENSIM_DIR="/usr/lib/opensim"
        CONSOLE_PORT="9100"
        CONSOLE_USER="console_user"
        CONSOLE_PASS="console_pass"

In the opensim.conf file (http://lets3d.com/monit/opensim.conf)
- the pidfile points at /var/run/opensim/opensim.pid instead of /home/opensim/opensim.pid
- opensim is pointed at /usr/local/bin/opensim instead of /home/opensim/opensim
{L_CODE}:
check process your_sim with pidfile /var/run/opensim/opensim.pid
    start program = "/usr/local/bin/opensim start your_sim"
        as uid opensim and gid opensim
    stop program = "/usr/local/bin/opensim stop your_sim"

Also the 'opensim' file is a bash script. Shouldn't it be 'chmod +x' to be executable?

But anyway, so far the tutorial is very easy to follow and I am almost done woot! Thanks again!


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Mon Mar 26, 2012 11:25 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
Well I finished the tutorial but I have some issues to work through still.

a) monit isn't starting automatically when I reboot.

I tested the configuration with 'sudo monit -t' and everything is ok and I edited /etc/default/monit to change startup=0 to startup=1 but no start on boot.

But if I run 'sudo /etc/init.d/monit start' it will start up.

(*edit fixed* I checked in /etc/init and there is no .conf file for monit so I did the old way 'sudo update-rc.d monit enable' and now it starts at boot.)

b) Even if I run with 'sudo /etc/init.d/monit start' it never starts OpenSim. I must have something wrong with my configuration somewhere. I will check into this tomorrow more deeply.

c) I cannot connect to the httpd service at port 2812. I have the port open in the iptables firewall but the browser reports that the connection was reset when I try to access the service.

(*edit* I can connect with lynx using localhost on the ssh session 'lynx 127.0.0.1:2812 and then I input the user and password and it works)

(*edit2 fixed*) So I have to add the following line after 'set httpd port 2812 and' in /etc/monit/monitrc to get it to work from my home computer's web browser:
allow <xxx.xxx.xxx.xxx>
substituting the x's with my cable modem's external ip address.

Anyway so now I have to figure out why it is not starting OpenSim. I will look into it tomorrow. When I get it straightened out I will post here what I did.


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Tue Mar 27, 2012 2:37 am 
User avatar

Joined: Sun Nov 20, 2011 11:32 pm
Posts: 38
Location: Wichita, KS
Hi Fred,

Monit loads after the local file system and before mysql. If I do not use a delay it tries to load Opensim before mysql is up every time I restart. It is not a problem, just an annoyance. The Opensim init is not a necessity, it's just helping me get back online a little faster.

Fred Leftwich {L_WROTE}:
So Monit should check and start OpenSim immediately unless the 'start delay' is used.

Also I would think Monit has to run *after* MySql in the boot process or it could cause trouble with OpenSim.

_________________
Cheers,
Twisted


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Tue Mar 27, 2012 3:43 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 384
Location: Australia
Fred, thanks for your feedback,
Fred Leftwich {L_WROTE}:
I noticed in the two files 'opensim' and 'opensim.conf' some of the paths used were different from what was used in the body of the tutorial.

In the 'setup()' function in opensim (http://lets3d.com/monit/opensim):
- the PID var is pointing to /var/run/opensim/${SIM}.pid instead of /home/opensim/opensim.pid" as was setup in OpenSim.ini earlier in the tutorial.
- the OPENSIM_DIR var is set to /usr/lib/opensim instead of /home/opensim as was setup earlier also.

Yeah, I had my modified files with the original files and (oops) the obvious happened, I uploaded both the wrong files, so I am glad you are going thru this, it is helping me find the bugs in my tut ( I am replacing those files with the correct ones now)
{L_QUOTE}:
Also the 'opensim' file is a bash script. Shouldn't it be 'chmod +x' to be executable?
That sounds right, although I dont remember doing it on my system, I will add it to the tutorial.
{L_QUOTE}:
So I have to add the following line after 'set httpd port 2812 and' in /etc/monit/monitrc to get it to work from my home computer's web browser: allow <xxx.xxx.xxx.xxx>
substituting the x's with my cable modem's external ip address.

again I didnt have to do that with my system but it is worth looking at, I may have excess perms on mine which others wouldnt have so I will look into it.
{L_QUOTE}:
now I have to figure out why it is not starting OpenSim
Have you tried manually starting the opensim script (as user opensim) with " ./opensim start your_sim " to see if the script actually fires your opensim process?

I am glad you found it easy to follow
thanks again for the debug
Cam


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Tue Mar 27, 2012 9:56 am 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
{L_QUOTE}:
{L_QUOTE}:
now I have to figure out why it is not starting OpenSim
Have you tried manually starting the opensim script (as user opensim) with " ./opensim start your_sim " to see if the script actually fires your opensim process?

I am glad you found it easy to follow
thanks again for the debug
Cam

Yea it was late so I didn't try this last night, but when I ran the script manually today I see that it tries to start OpenSim.exe but fails. Turns out I missed an *important* step in your tutorial haha.
{L_CODE}:
chown -R opensim:opensim opensim

I had some files owned by root in the opensim directory so it couldn't run as user opensim. After the 'chown -R' I can now run it manually.

But Monit still wasn't starting it automatically. So I logged in to Monit with a Web Browser and it said the 'your_sim' process was 'unmonitored'.

So I pressed the button 'Enable Monitoring' and it worked! woot.

I will reboot the server now and make sure it starts up automatically.

*edit* Yep, it loaded OpenSim after boot and the region came up.

But it has an error reported in the Monit browser:
{L_CODE}:
Port Response time   connection failed to localhost:9100/jsonSimStats/ [HTTP via TCP]

So the condition:
{L_CODE}:
Port   If failed localhost:9100/jsonSimStats/ [HTTP via TCP] with timeout 5 seconds 4 times within 4 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert

Causes it to restart then enventually the condition:
{L_CODE}:
Timeout   If restarted 5 times within 5 cycle(s) then unmonitor

Causes the process to go unmonitored. So I need to figure out why jsonSimStats isn't working.

*edit fixed* In OpenSim.ini I had to uncomment the following setting under the [Network] section
(I set it to 9100 to match what is in /etc/monit/conf.d/opensim.conf)
{L_CODE}:
http_listener_port = 9100


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Tue Mar 27, 2012 12:19 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
So a few things about the support files for the monit with opensim tutorial.

/etc/monit/monitrc
{L_CODE}:
set httpd port 2812 and
   allow xxx.xxx.xxx.xxx
   allow localhost
   allow opensim:opensim

allow xxx.xxx.xxx.xxx - I had to add this line where the x's are the external ip of my cable modem. Couldn't connect to the web interface without that line. (Cam reports this wasn't necessary on his vps so it depends on the system)

allow localhost - not really needed but was useful to test with lynx on the ssh session

allow opensim:opensim - this is the user:password to access the monit page. *doesn't* have to be a valid linux user. It is just used by monit to allow access to the stats page. If it is left out, then anyone can access the stats without restriction.

/etc/monit/conf.d/opensim.conf
{L_CODE}:
if failed url http://localhost:9100/jsonSimStats/

It was suggested on this other thread viewtopic.php?f=14&t=3102&start=10 that monit will not show the web page if checking jsonSimStats using localhost so I was cautious that maybe it was giving me troubles, but it seems to work fine with my version of monit. I think maybe this was an issue that was fixed with the newest monit version.

/home/opensim/bin/OpenSim.ini
{L_CODE}:
ConsoleUser = "user"
ConsolePass = "password"
console_port = 0
http_listener_port = 9100

It seems there are 2 consoles in OpenSim. One is a seperate console client called 'rest' (OpenSim.ConsoleClient.exe) and the other is built-in to the OpenSim server. Unless the command line option '-console=rest' is used when OpenSim is started then the built-in console is used.

If the built-in console is used (like in the monit tutorial we are following) these three options seem to have no effect: ConsoleUser, ConsolePass and console_port. They can be set to anything and monit will still connect to jsonSimStats using the http_listener_port. *BUT* if the actual lines are missing from the ini file, then monit will fail to connect to the stats. Weird.

http_listener_port - this is the setting that allowed me to connect to jsonSimStats using monit. Without it I was unable to connect.

/home/opensim/opensim
In this script there are some vars set:
{L_CODE}:
CONSOLE_PORT
CONSOLE_USER
CONSOLE_PASS

Theses vars are only used in the the function do_console() and it is run if the user starts the script like this:
{L_CODE}:
opensim console your_sim

but this will hang because the server is started in the do_start() function without the -console=rest option. In other words that console option is meant to be used with the rest console not the built-in console.

so the CONSOLE_PORT, CONSOLE_USER and CONSOLE_PASS vars don't have any effect with this particular Monit tutorial since it is using the built-in console and they can be ignored.

Just want to say thanks again to Cam for posting the very helpful tutorial and Twisted for the suggestions also.


Last edited by Fred Leftwich on Tue Mar 27, 2012 8:57 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Tue Mar 27, 2012 8:26 pm 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 384
Location: Australia
{L_QUOTE}:
allow xxx.xxx.xxx.xxx - I had to add this line where the x's are the external ip of my cable modem. Couldn't connect to the web interface without that line. (Cam said this wasn't needed on his vps so it depends on the system)

allow localhost - not really needed but was useful to test with lynx on the ssh session

of course both of these lines make sense, I was doing all of this testing on localhost, so I shall include the allow external host also.
{L_QUOTE}:
If the built-in console is used (like in Cam's monit tutorial that we are following) these three options seem to have no effect:
The reason for this is that in my tutorial we are using "screen" instead of the rest console, I simply neglected to point out that these lines can be ignored. Perhaps Screen is using the console_port?
I am using port 9000 for http listening and 9100 for the console and this config works on my system
{L_CODE}:
http_listener_port = 9000
console_port = 9100

Happy you got it working, I have to admit I still dont fully understand exactly what is going on here, but I learn more each time, and I have learned heaps since you have been feeding back, thanks heaps Fred and thanks again Bo and Twisted, and I have to thank Dave Coyle for his original tutorial, which got me started.
See you all in the sandbox
Cam


Top
 Profile  
 
 Post subject: Re: Guide for OpenSim on a VPS virtual private server for OSGrid
PostPosted: Mon May 28, 2012 11:30 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
The newest monit version 5.4 lets you specify an 'uptime' check which is very helpful to restart the simulator every so many days (since there is some memory leaks in opensim it is recommended to restart periodically).

My server didn't have 5.4 available so I had to compile the source. The posts about it are over in this thread: viewtopic.php?f=14&t=4187


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 8 of 9   [ 83 posts ]
Go to page Previous  1 ... 5, 6, 7, 8, 9  Next


Who is online

Users browsing this forum: legacy_google [bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net