Sign inSign up

jarnotmichal/factorio-with-http-controls

By jarnotmichal

•Updated about 1 year ago

Docker container with Factorio server and NestJS HTTP API for RCON management.

Image
Developer tools
Web servers
0

634

jarnotmichal/factorio-with-http-controls repository overview

https://github.com/developer239/factoriotools-factorio-http-controls⁠

⁠Factorio With HTTP Controls

Docker container with Factorio server and NestJS HTTP API for RCON management.

⁠Setup

⁠1. Build Docker Image

Build the Docker image with default Factorio version (2.0.55):

docker build -t factorio-with-http-controls .

Build with specific Factorio version:

# Build with Factorio 1.1.110
docker build --build-arg FACTORIO_VERSION=1.1.110 -t factorio-with-http-controls .

# Build with Factorio 1.1.109
docker build --build-arg FACTORIO_VERSION=1.1.109 -t factorio-with-http-controls .

Note: Check factoriotools/factorio⁠ for all available versions.

⁠2. Environment Configuration

Copy the example environment file and customize:

cp .env.example .env
⁠3. Run the Container

Run the all-in-one container (includes both Factorio server and HTTP API):

docker run -d \
  --name factorio-server \
  --env-file .env \
  -p 34197:34197/udp \
  -p 8080:8080 \
  -v factorio-saves:/factorio/saves \
  factorio-with-http-controls

⁠Connecting to the Server

Direct IP Connection:

  1. In Factorio, go to "Play" → "Multiplayer"
  2. Click "Connect to address"
  3. Enter your server's IP address and port: your-server-ip:34197 for example 127.0.0.1:34197
  4. The server will not appear in the public server browser

Server Configuration:

  • Game Port: 34197/udp (for Factorio client connections)
  • HTTP API Port: 8080/tcp (for RCON management)
  • RCON Port: 27015/tcp (internal only)

⁠Server Management

The container runs both services automatically. No manual Factorio server setup required.

⁠API Usage

⁠Available Endpoints

Get Server Time:

curl http://localhost:8080/factorio/time

Get Server Status (Player List):

curl http://localhost:8080/factorio/status

Slow Down Time:

curl -X POST http://localhost:8080/factorio/speed/slow

Set Normal Speed:

curl -X POST http://localhost:8080/factorio/speed/normal

Speed Up Time:

curl -X POST http://localhost:8080/factorio/speed/fast

Pause Game:

curl -X POST http://localhost:8080/factorio/pause

Unpause Game:

curl -X POST http://localhost:8080/factorio/unpause

Trigger Save:

curl -X POST http://localhost:8080/factorio/save

List Save Files:

curl http://localhost:8080/factorio/saves

Load Specific Save:

curl -X POST http://localhost:8080/factorio/load/default
curl -X POST http://localhost:8080/factorio/load/_autosave4

Load Local Save File:

curl -X POST http://localhost:8080/factorio/upload-save \
  -F "saveFile=@/Users/michaljarnot/Library/Application Support/factorio/saves/example-to-load-on-server.zip" \
  -F "autoLoad=true"

⁠Docker Hub Deployment

⁠Publishing to Docker Hub

1. Build and Tag for Docker Hub:

# Build with specific Factorio version
docker build --build-arg FACTORIO_VERSION=2.0.55 -t jarnotmichal/factorio-with-http-controls:2.0.55 .

# Build latest tag (uses default version 2.0.55)
docker build -t jarnotmichal/factorio-with-http-controls:latest .

2. Push to Docker Hub:

# Push latest tag
docker push jarnotmichal/factorio-with-http-controls:latest

# Push specific version
docker push jarnotmichal/factorio-with-http-controls:2.0.55

3. Once published, others can use your image directly:

# Pull and run from Docker Hub (from project directory with .env file)
docker run -d \
  --name factorio-server \
  --env-file .env \
  -p 34197:34197/udp \
  -p 8080:8080 \
  -v factorio-saves:/factorio/saves \
  jarnotmichal/factorio-with-http-controls:latest

Tag summary

Content type

Image

Digest

sha256:da691598e…

Size

258.4 MB

Last updated

about 1 year ago

docker pull jarnotmichal/factorio-with-http-controls