News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

playing with docker

Started by sdog, August 31, 2020, 04:55:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sdog

I'll be toying around with Docker and Alpine Linux a bit and thought Simutrans (S) might be a good subject. Some first thoughts on what to do:

see if S compiles against musl instead of glibc

get binary to run in container

get S's logs and errors to STDOUT and STDERR, respectively

move all relevant settings from config to env vars

automate build for container images in dev container

Do we provide headless Paksets? I remember a patch from Dwachs from about 2012 where (then new) headless servers stopped loading pngs from paksets. For this it would be nice to strip the pictures entirely to keep image size (or download) low.

prissi

Why would you pack a 5 MB size executable that is known to run and compile on almost any Linux platform into a docker container? Fells to me to go shopping with a steamroller ...

Matthew

I noticed that ceeac is also trying to use Docker as part of his effort to use Github Actions:



Now, obviously he is trying to use it a s a build system whereas you are trying to use it to run a server. And no Windows builds are actually being output yet, so it seems like this is still a work in progress.

But I just make that connection in case there's anything there that might help you along the way.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Ters

Quote from: prissi on September 01, 2020, 02:00:21 AM
Why would you pack a 5 MB size executable that is known to run and compile on almost any Linux platform into a docker container? Fells to me to go shopping with a steamroller ...
To run it on cloud platforms, possibly.

Quote from: sdog on August 31, 2020, 04:55:16 PMmove all relevant settings from config to env vars
It this is about simuconf.tab, I think there are too many of them to be wieldy as environment variables. Having them in a configuration file that is either embedded in a derived image, or mounted at runtime, seems a better solution.

prissi

Quote from: Ters on September 01, 2020, 05:27:26 AM
To run it on cloud platforms, possibly.
It this is about simuconf.tab, I think there are too many of them to be wieldy as environment variables. Having them in a configuration file that is either embedded in a derived image, or mounted at runtime, seems a better solution.
Still you can have a docker image with GCC etc. (there are few dependcies for a server). ./configure make and you are done. It is probably even easier than fiddle with docker in the first case ... Ok, on windows this would be different, but I am not sure you do windows based cloud computing without a good reason to actually do so.

sdog

Quote from: prissi on September 01, 2020, 02:00:21 AM
Why would you pack a 5 MB size executable that is known to run and compile on almost any Linux platform into a docker container? Fells to me to go shopping with a steamroller ...

To see if I can do it?

There is also a bit of benefit to it. As Ters said, deplyoing it to cloud services. Renting a root server slot is on the way out.

It would be easy of course to run an Arch image, run a terminal and just pull Simutrans with a package manager, configure it, bind mount a volume for save games, and write a start script. But then I'd be done already in the time it took to write this posting. And it wouldn't do any good for anyone else. That's why I'm playing around with building docker images that run Simutrans.

Simutrans is a good for such a toy project. First it's in C++, second it is not large, third there's nothing really usable out there.

Docker is of course also outmoded and on its way out. But Docker experience in part translates to Kubernetes. Plus it might take a while untill most organisations migrate to the latter.

ps.: I see now how I mislead you. I should have called this toying with docker since it is about playing with docker, not about playing Simutrans.

sdog

Quote from: Ters on September 01, 2020, 05:27:26 AM
Quotemove all relevant settings from config to env vars
It this is about simuconf.tab, I think there are too many of them to be wieldy as environment variables. Having them in a configuration file that is either embedded in a derived image, or mounted at runtime, seems a better solution.
I thought only about a few settings (eg autosave, bits_per_month) that are often changed between servers. However, I think it might be easier to make all simuconf.tab settings changeable by envs. If an env exists override the setting. Either through once with a script on server startup or permanently through a daemon.