mirror of
				https://github.com/factoriotools/factorio-docker.git
				synced 2025-10-31 00:48:07 +01:00 
			
		
		
		
	Add an IP bind param to the entrypoint (#447)
* Add an IP bind param to the entrypoint * Add an example usage to readme * Rename to BIND
This commit is contained in:
		
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							| @@ -262,6 +262,7 @@ These are the environment variables which can be specified at container run time | ||||
| | GENERATE_NEW_SAVE | Generate a new save if one does not exist before starting the server  | false | 0.17+ | | ||||
| | LOAD_LATEST_SAVE | Load latest when true. Otherwise load SAVE_NAME | true | 0.17+ | | ||||
| | PORT | UDP port the server listens on | 34197 | 0.15+ | | ||||
| | BIND | IP address (v4 or v6) the server listens on (IP\[:PORT]) | | 0.15+ | | ||||
| | RCON_PORT | TCP port the rcon server listens on | 27015 | 0.15+ | | ||||
| | SAVE_NAME | Name to use for the save file | _autosave1 | 0.17+ | | ||||
| | TOKEN | factorio.com token | | 0.17+ | | ||||
| @@ -383,6 +384,21 @@ For LAN games the VM needs an internal IP in order for clients to connect. One w | ||||
|  | ||||
| If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Factorio Server Deployment (CloudFormation) repository](https://github.com/m-chandler/factorio-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use. | ||||
|  | ||||
| ## Using a reverse proxy | ||||
|  | ||||
| If you need to use a reverse proxy you can use the following nginx snippet: | ||||
|  | ||||
| ``` | ||||
| stream { | ||||
|   server { | ||||
|       listen 34197 udp reuseport; | ||||
|       proxy_pass my.upstream.host:34197; | ||||
|   } | ||||
| } | ||||
| ``` | ||||
|  | ||||
| If your factorio host uses multiple IP addresses (very common with IPv6), you might additionally need to bind Factorio to a single IP (otherwise the UDP proxy might get confused with IP mismatches). To do that pass the `BIND` envvar to the container: `docker run --network=host -e BIND=2a02:1234::5678 ...` | ||||
|  | ||||
| ## Troubleshooting | ||||
|  | ||||
| ### My server is listed in the server browser, but nobody can connect | ||||
|   | ||||
| @@ -20,3 +20,4 @@ services: | ||||
| #      - USERNAME=FactorioUsername | ||||
| #      - TOKEN=FactorioToken | ||||
| #      - PORT=34198 | ||||
| #      - ADDR=::1 | ||||
|   | ||||
| @@ -5,6 +5,7 @@ FACTORIO_VOL=/factorio | ||||
| LOAD_LATEST_SAVE="${LOAD_LATEST_SAVE:-true}" | ||||
| GENERATE_NEW_SAVE="${GENERATE_NEW_SAVE:-false}" | ||||
| SAVE_NAME="${SAVE_NAME:-""}" | ||||
| BIND="${BIND:-""}" | ||||
|  | ||||
| mkdir -p "$FACTORIO_VOL" | ||||
| mkdir -p "$SAVES" | ||||
| @@ -88,6 +89,10 @@ FLAGS=(\ | ||||
|   --server-id /factorio/config/server-id.json \ | ||||
| ) | ||||
|  | ||||
| if [ -n "$BIND" ]; then | ||||
|   FLAGS+=( --bind "$BIND" ) | ||||
| fi | ||||
|  | ||||
| if [[ $LOAD_LATEST_SAVE == true ]]; then | ||||
|     FLAGS+=( --start-server-load-latest ) | ||||
| else | ||||
|   | ||||
		Reference in New Issue
	
	Block a user