Skip to content

Screeps server in a Docker container (using MongoDB & Redis)

License

Notifications You must be signed in to change notification settings

bminnix/docker-screeps

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Screeps Server

There are two different type how to start a screeps server.

Create the world

If you do not have an existing server directory, just start the Docker container with the command line argument init, and everything gets done for you. The LOCAL_UID environment variable ensures that the files that are created in the mounted volume have the correct owner set. You can enter any valid (host) uid here or use $(id -u) to use the current uid of the logged in user.

docker run --rm -it -v $PWD:/screeps -e LOCAL_UID=$(id -u) -e STEAMKEY=YOUR_STEAM_KEY_HERE qnimbus/docker-screeps init

Now it's all set to run the Screeps server.

Running the server

Make sure you have a server directory (from aprevious installations or by running the 'init' command above).

You can use 'docker-compose' to start the screeps server, create the screeps_net bridged network and start the redis and mongodb instances.

docker-compose -f docker-compose.yml up -d

If you want to start each container manually follow the steps below.

  1. Make sure you are in the server directory
  2. Create the custom bridged network
  3. Start mongo & redis containers
  4. Run the server
docker run --rm -it --name screeps --network screeps_net -v $PWD:/screeps -p 21025:21025 -d -e LOCAL_UID=$(id -u) qnimbus/docker-screeps

Additional setup steps

Creating a bridged network for MongoDB and Redis

You need to add the screeps, mongo and redis containers to a custom bridged network so the container names are resolvable via DNS on the individual containers. If you do not have a separate custom bridged network you can create one as follows:

docker network create --attachable -d "bridge" --subnet 172.28.0.0/16 screeps_net

Note: The subnet can be changed to your individual needs as well as the network name ('screeps_net')

Starting and running MongoDB and Redis

docker run --rm --name redis --network screeps_net -d -v redis-volume:/data redis
docker run --rm --name mongo --network screeps_net -d -v mongo-volume:/data/db mongo

New screepsmod-mongo

This runs screepsmond-mongo by default using the custom_mods.json file. If kept, a new installation requires:

system.resetAllData()

to be ran from the Server CLI (See CLI section below) after installation is complete.

Creating a password

In order to push your code to your private server you need a password (using screepsmod-auth) for your user. You can configure a password by pointing your browser at http://[private-server-ip]:21025/authmod/password/ or by typing setPassword('your_password') into the screeps console when logged in on the screeps client.

Managing the server

Mods

Mods can be installed by running:

docker run --rm -v $PWD:/screeps qnimbus/docker-screeps yarn add screepsmod-auth

CLI

The CLI can be accessed by running:

docker exec -it screeps npx screeps cli

Stopping and starting the server

Stop: docker stop screeps
Start: docker start screeps

Updating

  1. Stop the server: docker stop screeps
  2. Remove the server: docker rm screeps
  3. Remove current image docker rmi qnimbus/docker-screeps
  4. Follow Running the server

About

Screeps server in a Docker container (using MongoDB & Redis)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 58.2%
  • Dockerfile 41.8%