Code Monkey home page Code Monkey logo

openttd's Introduction

Docker Image CI
dockeri.co

Usage

File locations

This image is supplied with a user named openttd.
Openttd server is run as this user and subsequently its home folder will be /home/openttd.
Openttd on linux uses .openttd in the users homefolder to store configurations, savefiles and other miscellaneous files.
If you want to your local files accessible to openttd server inside the container you need to mount them inside with -v parameter (see https://docs.docker.com/engine/reference/commandline/run/ for more details on -v)

Environment variables

These environment variables can be altered to change the behavior of the application inside the container.
To set a new value to an enviroment variable use docker's -e parameter (see https://docs.docker.com/engine/reference/commandline/run/ for more details)

Env Default Meaning
savepath "/home/openttd" The path to which autosave wil save
loadgame null load game has 4 settings. false, true, last-autosave and exit.
- false: this will just start server and create a new game.
- true: if true is set you also need to set savename. savename needs to be the name of the saved game file. This will load the given saved game.
- last-autosave: This will load the last autosaved game located in <$savepath>/autosave folder.
- exit: This will load the exit.sav file located in <$savepath>/autosave/.
savename null Set this when allong with loadgame=true to the value of your save game file-name
PUID "911" This is the ID of the user inside the container. If you mount in (-v </path/of/your/choosing>:</path/inside/container>) you would need for the user inside the container to have the same ID as your user outside (so that you can save files for example).
PGID "911" Same thing here, except Group ID. Your user has a group, and it needs to map to the same ID inside the container.
debug null Set debug things. see openttd for debug options

Networking

By default docker does not expose the containers on your network. This must be done manually with -p parameter (see here for more details on -p). If your openttd config is set up to listen on port 3979 you need to map the container port to your machines network like so -p 3979:3979 where the first reference is the host machines port and the second the container port.

Examples

Run Openttd and expose the default ports.

docker run -d -p 3979:3979/tcp -p 3979:3979/udp bateau/openttd:latest

Run Openttd with random port assignment.

docker run -d -P bateau/openttd:latest

Its set up to not load any games by default (new game) and it can be run without mounting a .openttd folder.
However, if you want to save/load your games, mounting a .openttd folder is required.

docker run -v /path/to/your/.openttd:/home/openttd/.openttd -p 3979:3979/tcp -p 3979:3979/udp bateau/openttd:latest

Set UID and GID of user in container to be the same as your user outside with seting env PUID and PGID. For example

docker run -e PUID=1000 -e PGID=1000 -v /path/to/your/.openttd:/home/openttd/.openttd -p 3979:3979/tcp -p 3979:3979/udp bateau/openttd:latest

For other save games use (/home/openttd/.openttd/save/ is appended to savename when passed to openttd command)

docker run -e "loadgame=true" -e "savename=game.sav" -v /path/to/your/.openttd:/home/openttd/.openttd -p 3979:3979/tcp -p 3979:3979/udp bateau/openttd:latest

For example to run server and load my savename game.sav:

docker run -d -p 3979:3979/tcp -p 3979:3979/udp -v /home/<your_username>/.openttd:/home/openttd/.openttd -e PUID=<your_userid> -e PGID=<your_groupid> -e "loadgame=true" -e "savename=game.sav" bateau/openttd:latest

Kubernetes

Supplied some example for deploying on kubernetes cluster. "k8s_openttd.yml" just run

kubectl apply openttd.yaml

and it will apply configmap with openttd.cfg, deployment and service listening on port 31979 UDP/TCP.

Other tags

openttd's People

Contributors

adaamz avatar bateau84 avatar djgummikuh avatar euch avatar frodus avatar gregdek avatar leehmanqq avatar s-konijn avatar spacexcheesewheel avatar zoltantamasvajda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.