Backend for updating the shared airtable for the event.
Generate a secret and token pair with
node gentoken
and note down the output, the secret is used for the main server and the token for the remote game servers. Generate a TLS key and certificate pair with
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj /CN=localhost -addext "subjectAltName=IP:192.0.2.4"
Modify the IP to be that of the Main server.
For the main server with the lobby create a .env file with the following content:
Is_lobby=true
Api_key=Airtable API key
Base_key=Airtable base id
Servers=Path to servers.json
secret=Secret generated by gentoken
key=key.pem
cert=cert.pem
port=1234
bind_ip=Leave blank unless you know what you're doing.
Create a servers.json file for the local servers, see last section for what it should contain. Then run the server with
node main
For remote servers hosting extra Factorio game servers create a .env file with the following content.
Is_lobby=false
Api_key=Airtable API key
Base_key=Airtable base id
Servers=Path to servers.json
token=token generated by gentoken
url=WebSocket URL to connect to (e.g. wss://192.0.2.4:1234/)
cert=cert.pem
If you generated a self signed cert with openssl you need to copy the generated cert.pem certificate to the remote game servers and specify it in .env.
A JSON object where keys are ip:port the Factorio server and the value is an object containing dir, Rcon_pass, Rcon_port and is_lobby. See example below. For the main server there must be exactly one server with is_lobby set to true. For the remote game servers no server can be the lobby.
{
"192.0.2.4:5001": {
"dir": "/opt/factorio/lobby/script-output/mini_games/",
"Rcon_pass": "rcon",
"Rcon_port": 5101,
"is_lobby": true
},
"192.0.2.4:5002": {
"dir": "/opt/factorio/game1/script-output/mini_games/",
"Rcon_pass": "rcon",
"Rcon_port": 5102,
"is_lobby": false
}
}