Dirtsand on a VPS

Announcements and discussion regarding any projects related to Cyan Worlds' Plasma Engine including (but not limited to) CyanWorlds.com Engine, Drizzle, OfflineKI, PyPRP, and libHSPlasma.

Re: Dirtsand on a VPS

Postby Surta » Tue Aug 11, 2020 6:25 pm

In other news, I have the connection working between PostgreSQL and PHP :D For the interested, it involved following this tutorial.

However, the code you gave me doesn't work yet Hoikas... I mean I can connect to the database (if I change the password, it spits out an error right away) but all I get is "The server is currently down. Please check back later!" when it's obviously up and running. I did copy the two required files ds-config.ini.php and ds-functions.php but alas... no dice yet.
Is there a way in which I can test the connection with an easier query to see why it can't see my server as online?

Edit: With a little bit of cheating I managed to force the "So many explorers in the cavern" message.

Show Spoiler


That works perfectly. So we KNOW the web page connects to the database, it's just that somehow the "Shard is offline" message seems to override everything else!
Surta
 
Posts: 88
Joined: Fri Mar 29, 2019 1:13 pm

Re: Dirtsand on a VPS

Postby Tsar Hoikas » Wed Aug 12, 2020 6:12 pm

If you're running the web server in a different container than the dirtsand server itself, the ds_running() function won't be able to handle that -- it's just a dumb process check call. You might have to use curl or... something... to try to contact DirtSand's built-in status server, which IIRC runs on port 8080 by default.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Dirtsand on a VPS

Postby Surta » Wed Aug 12, 2020 6:18 pm

Oh I see, well in that case I can just keep the "cheat" and leave it the way it is (that works). After all, when I do maintenance on my server, that usually brings everything down anyway including the web page. So in theory, the "shard is down" message is never going to show anyway :) (of course you have given me a challenge now. Since `ps -C dirtsand` works fine, I now have to find a way to make it work from within a docker container. Fun!)

I meant to ask: how to I access all the other "stuff" such as the shard status with red/green light, pellet score etc? Or is all that deprecated? Edit: ok, I figured that one out :D Just add ?type=etc to the URL. I have temporarily sorted the offline message by changing "false" to "true" in

Code: Select all
function ds_running()
{
    $output = exec('ps -C dirtsand');
    # return strpos($output, 'dirtsand') !== false;
   return strpos($output, 'dirtsand') !== true;
}


But yeah, I'll keep looking for a solution there as well!

Oh, and, another bug? When I choose type=stats I'm getting

Warning: pg_fetch_result(): Unable to jump to row 0 on PostgreSQL result index 139930292462216 in /app/live/ds-functions.php on line 37
Surta
 
Posts: 88
Joined: Fri Mar 29, 2019 1:13 pm

Re: Dirtsand on a VPS

Postby Tsar Hoikas » Thu Aug 13, 2020 12:36 pm

:shock: (and I know that that's not a very useful response - it's just all I can say)
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Dirtsand on a VPS

Postby Surta » Thu Aug 13, 2020 3:36 pm

You just summed up my entire life :lol: :lol: :lol:

It doesn't matter one bit, I just was toying with all the options and thought I'd point it out (since you kindly allow me to use the code). The bit where it shows who is online works flawlessly, I have prettied up the type=pretty part just because I can (and for learning purposes).

This is like going down a rabbit hole - the deeper you go, the more fun it becomes!

(I haven't even started yet about adding fan content, another item on my long term wish list)

Meanwhile, for the interested, I solved the "is the shard online" problem with the help of a geeky friend who loves a good challenge :D I'll quote his solution:

Server

Have a cron job that runs “ps -C dirtsand > /tmp/dirtsand” every minute
Create a volume link of /tmp/dirtsand to /tmp/dirtsand in the Apache container’s YAML (in other words, the PS command’s output is going to a file that will be seen within the container)

Container

Change the PHP code to “cat” the contents of /tmp/dirtsand INSTEAD of checking “ps -C dirtsand” but essentially behave accordingly


It will be easier when Dirtsand runs in docker of course, because then I can just include it in the Compose health check script. But for now, this works!
Surta
 
Posts: 88
Joined: Fri Mar 29, 2019 1:13 pm

Re: Dirtsand on a VPS

Postby Surta » Tue Aug 18, 2020 3:58 pm

Hoikas, just a heads up that the stats are working perfectly. It was just that no one had yet baked any pellets, apparently... or something else because I just finished the entire game up to the Myst library and it's no longer giving an error. I figured you'd want to know :)

Something else: I just found some attempts from an unknown IP address (China) to access the shard... How dangerous is that? Is there a Dirtsand event log file somewhere to check how often this occurs?
Surta
 
Posts: 88
Joined: Fri Mar 29, 2019 1:13 pm

Previous

Return to Plasma Development

Who is online

Users browsing this forum: No registered users and 3 guests

cron