Factorio RCON API
🏭 Fully implemented wrapper for Factorio headless server console as RESTful and gRPC for easier management through APIs
Features
- ✅ 100% type safe, no extra type conversion needed
- ↔️ Out of the box RESTful and gRPC support
- 🎺 Native RCON protocol
- 📖 Fully API Documented
Supported Commands
- Raw command
- Message
-
/alerts
-
/enable-research-queue
-
/mute-programmable-speaker
-
/perf-avg-frames
-
/permissions
-
/reset-tips
-
/evolution
-
/seed
-
/time
-
/toggle-action-logging
-
/toggle-heavy-mode
-
/unlock-shortcut-bar
-
/unlock-tips
-
/version
-
/admins
-
/ban
-
/bans
-
/config
-
/delete-blueprint-library
-
/demote
-
/ignore
-
/kick
-
/mute
-
/mutes
-
/promote
-
/purge
-
/server-save
-
/unban
-
/unignore
-
/unmute
-
/whisper
-
/whitelist
-
/cheat
-
/command
/ /c
-
/measured-command
-
/silent-command
Usage
Pull the image
docker pull ghcr.io/nekomeowww/factorio-rcon-api
Setup servers
When bootstraping the server, you need to specify the RCON port and password for the server to listen to with
--rcon-port
for the port number
--rcon-password
for the password
The command may look like this:
./factorio \
--start-server /path/to/saves/my-save.zip \
--rcon-port 27015 \
--rcon-password 123456
Or on macOS:
~/Library/Application\ Support/Steam/steamapps/common/Factorio/factorio.app/Contents/MacOS/factorio \
--start-server /path/to/saves/my-save.zip \
--rcon-port 27015 \
--rcon-password 123456
Once you are ready, go to the next step to start the API server.
Factorio server ran with Docker
This is kind of hard to make them communicate easily.
We will need to create dedicated network for the containers to communicate with each other.
docker network create factorio
Then, obtain the IP address of the Factorio server container.
docker container inspect factorio-server --format '{{ .NetworkSettings.Networks.factorio.IPAddress }}'
Then, start the API server with the following command with the IP address obtained:
docker run \
--rm \
-e FACTORIO_RCON_HOST=<factorio-server-ip> \
-e FACTORIO_RCON_PORT=27015 \
-e FACTORIO_RCON_PASSWORD=123456 \
-p 24180:24180 \
ghcr.io/nekomeowww/factorio-rcon-api:unstable
Factorio server not ran with Docker, Factorio RCON API ran with Docker
For running Factorio server and Factorio RCON API in a same server while not having Factorio server in Docker, you can start the API server with the following command:
docker run \
--rm \
-e FACTORIO_RCON_HOST=host.docker.internal \
-e FACTORIO_RCON_PORT=27015 \
-e FACTORIO_RCON_PASSWORD=123456 \
-p 24180:24180 \
ghcr.io/nekomeowww/factorio-rcon-api:unstable
Call the API
That's it, you can now call the API with the following command:
curl -X POST http://localhost:24180/api/v1/factorio/command/version
to get the version of the Factorio game server.
API
Star History
Contributors
Thanks to all the contributors!