Skip to content

Commit 17fcc88

Browse files
authored
Merge branch 'master' into feature/advanced_mod_installation
2 parents 6e84bab + c21e648 commit 17fcc88

File tree

9 files changed

+191
-113
lines changed

9 files changed

+191
-113
lines changed

Makefile

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
11
# Build tool for Factorio Server Manager
2-
#
32

43
NODE_ENV:=production
54

6-
build:
7-
# make sure this project is located within GOPATH, I.E. $GOPATH/src/factorio-server-manager
8-
9-
# Build Linux release
10-
mkdir build
11-
GOOS=linux GOARCH=amd64 go build -o factorio-server-manager/factorio-server-manager factorio-server-manager/src
12-
# ui/node_modules/webpack/bin/webpack.js ui/webpack.config.js app/bundle.js --progress --profile --colors
13-
cp -r app/ factorio-server-manager/
14-
cp conf.json.example factorio-server-manager/conf.json
15-
zip -r build/factorio-server-manager-linux-x64.zip factorio-server-manager
16-
rm -rf factorio-server-manager
17-
# Build Windows release
18-
GOOS=windows GOARCH=386 go build -o factorio-server-manager/factorio-server-manager.exe factorio-server-manager/src
19-
cp -r app/ factorio-server-manager/
20-
cp conf.json.example factorio-server-manager/conf.json
21-
zip -r build/factorio-server-manager-windows.zip factorio-server-manager
22-
rm -rf factorio-server-manager
23-
24-
dev:
25-
mkdir dev
26-
GOOS=linux GOARCH=amd64 go build -o factorio-server-linux/factorio-server-manager factorio-server-manager/src
27-
cp -r app/ dev/
28-
cp conf.json.example dev/conf.json
29-
mv factorio-server-linux/factorio-server-manager dev/factorio-server-manager
5+
#TODO add support for a mac build maybe?
6+
UNAME := $(shell uname)
7+
ifeq ($(UNAME), Linux)
8+
release := build/factorio-server-manager-linux.zip
9+
else
10+
release := build/factorio-server-manager-windows.zip
11+
endif
12+
13+
build: $(release)
14+
15+
$(shell mkdir -p build)
16+
build/factorio-server-manager-%.zip: app/bundle.js factorio-server-manager-%
17+
@echo "Packaging Build - $@"
18+
@cp -r app/ factorio-server-manager/
19+
@cp conf.json.example factorio-server-manager/conf.json
20+
@zip -r $@ factorio-server-manager > /dev/null
21+
@rm -r factorio-server-manager
22+
23+
app/bundle.js:
24+
@echo "Building Frontend"
25+
@cd ui && npm install && npm run build
26+
27+
factorio-server-manager-linux: godeps
28+
@echo "Building Backend - Linux"
29+
@GOPATH="${GOPATH}:${PDW}"
30+
@mkdir -p factorio-server-manager
31+
@GOOS=linux GOARCH=amd64 go build -o factorio-server-manager/factorio-server-manager ./src
32+
33+
factorio-server-manager-windows: godeps
34+
@echo "Building Backend - Windows"
35+
@GOPATH="${GOPATH}:${PDW}"
36+
@mkdir -p factorio-server-manager
37+
@GOOS=windows GOARCH=386 go build -o factorio-server-manager/factorio-server-manager.exe ./src
38+
39+
godeps:
40+
@echo "Installing Packages"
41+
@cat gopkglist | xargs go get
42+
43+
gen_release: build/factorio-server-manager-linux.zip build/factorio-server-manager-windows.zip
44+
@echo "Done"
45+
46+
clean:
47+
@echo "Cleaning"
48+
@rm -r build/
49+
@rm app/bundle.js

README.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/mroote/factorio-server-manager.svg?branch=master)](https://travis-ci.org/mroote/factorio-server-manager)
1+
[![Build Status](https://travis-ci.org/mroote/factorio-server-manager.svg?branch=master)](https://travis-ci.org/mroote/factorio-server-manager)
22

33
# Factorio Server Manager
44

@@ -27,16 +27,16 @@ This tool runs on a Factorio server and allows management of the Factorio server
2727

2828
## Installation Linux
2929
1. Download the latest release
30-
* [https://github.com/MajorMJR/factorio-server-manager/releases](https://github.com/MajorMJR/factorio-server-manager/releases)
31-
2. Download the Factorio Standalone server and install to a known directory.
30+
* [https://github.com/mroote/factorio-server-manager/releases](https://github.com/mroote/factorio-server-manager/releases)
31+
2. Download the Factorio Standalone server and install to a known directory.
3232
3. Run the server binary file, use the --dir flag to point the management server to your Factorio installation.
3333
* ```./factorio-server-manager --dir /home/user/.factorio ```
3434
4. Visit [localhost:8080](localhost:8080) in your web browser.
3535

3636
## Installation Windows
3737
1. Download the latest release
38-
* [https://github.com/MajorMJR/factorio-server-manager/releases](https://github.com/MajorMJR/factorio-server-manager/releases)
39-
2. Download the Factorio Standalone server and install to a known directory.
38+
* [https://github.com/mroote/factorio-server-manager/releases](https://github.com/mroote/factorio-server-manager/releases)
39+
2. Download the Factorio Standalone server and install to a known directory.
4040
3. Run the server binary file via cmd or Powershell, use the --dir flag to point the management server to your Factorio installation.
4141
* ```.\factorio-server-manager --dir C:/Users/username/Factorio```
4242
4. Visit [localhost:8080](localhost:8080) in your web browser.
@@ -59,7 +59,7 @@ Usage of ./factorio-server-manager:
5959
Maximum filesize for uploaded files (default 20MB). (default 20971520)
6060
-port string
6161
Specify a port for the server. (default "8080")
62-
62+
6363
Example:
6464
6565
./factorio-server-manager --dir /home/user/.factorio --host 10.0.0.1
@@ -81,7 +81,7 @@ Example:
8181

8282

8383
## Development
84-
The backend is built as a REST API via the Go web application.
84+
The backend is built as a REST API via the Go web application.
8585

8686
It also acts as the webserver to serve the front end react application
8787

@@ -91,19 +91,23 @@ All api actions are accessible with the /api route. The frontend is accessible
9191
+ Go 1.6
9292
+ NodeJS 4.2.6
9393

94-
#### Building the Go backend
95-
Go Application which manages the Factorio server.
96-
97-
API requests for managing the Factorio server are sent to /api.
94+
#### Building Releases
95+
Creates a release zip for windows and linux: (this will install the dependencies listed in gopkgdeps)
96+
```
97+
git clone https://github.com/mroote/factorio-server-manager.git
98+
cd factorio-server-manager
99+
make gen_release
100+
```
98101

99-
The frontend code is served by a HTTP file server running on /.
102+
#### Building a Testing Binary:
100103
```
101-
git clone https://github.com/MajorMJR/factorio-server-manager.git
104+
git clone https://github.com/mroote/factorio-server-manager.git
102105
cd factorio-server-manager
103-
make build
106+
make
107+
./factorio-server-manager/factorio-server-manager
104108
```
105109

106-
#### Building the React frontend
110+
#### Building the React Frontend alone
107111
Frontend is built using React and the AdminLTE CSS framework. See app/dist/ for AdminLTE included files and license.
108112

109113
The root of the UI application is served at app/index.html. Run the npm build script and the Go application during development to get live rebuilding of the UI code.
@@ -112,15 +116,13 @@ All necessary CSS and Javascript files are included for running the UI.
112116

113117
Transpiled bundle.js application is output to app/bundle.js, 'npm run build' script starts webpack to build the React application for development.
114118
```
115-
cd ui/
116-
npm install
117-
npm run build
119+
make app/bundle.js
118120
```
119121

120122
### Building for Windows
121123
1. Download the latest release source zip file
122-
* [https://github.com/MajorMJR/factorio-server-manager/releases](https://github.com/MajorMJR/factorio-server-manager/releases)
123-
2. Unzip the Factorio Standalone server and move it to a known directory.
124+
* [https://github.com/mroote/factorio-server-manager/releases](https://github.com/mroote/factorio-server-manager/releases)
125+
2. Unzip the Factorio Standalone server and move it to a known directory.
124126
3. Download and install Go 1.6 64-bit or 32-bit depending on your operating system, if unsure download 32-bit
125127
* https://storage.googleapis.com/golang/go1.6.windows-amd64.msi 64-bit
126128
* https://storage.googleapis.com/golang/go1.6.windows-386.msi 32-bit
@@ -147,7 +149,7 @@ go get github.com/gorilla/websocket
147149
go get github.com/majormjr/rcon
148150
```
149151

150-
3. Now you will want to go into the src folder for example "C:\FS\factorio-server-manager\src" once there hold down left shift and right click an empty area of the folder. Then click "Open command windows here"
152+
3. Now you will want to go into the src folder for example "C:\FS\factorio-server-manager\src" once there hold down left shift and right click an empty area of the folder. Then click "Open command windows here"
151153
4. Type this into the command prompt then hit enter:
152154

153155
```

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM frolvlad/alpine-glibc
44
MAINTAINER Mitch Roote <[email protected]>
55

66
ENV FACTORIO_VERSION=latest \
7-
MANAGER_VERSION=0.6.0 \
7+
MANAGER_VERSION=0.6.1 \
88
ADMIN_PASSWORD=factorio
99

1010
VOLUME /opt/factorio/saves /opt/factorio/mods /opt/factorio/config /security

gopkglist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
github.com/apexskier/httpauth
2+
github.com/go-ini/ini
3+
github.com/gorilla/mux
4+
github.com/gorilla/websocket
5+
github.com/hpcloud/tail
6+
github.com/majormjr/rcon

src/factorio_server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type FactorioServer struct {
2323
Cmd *exec.Cmd `json:"-"`
2424
Savefile string `json:"savefile"`
2525
Latency int `json:"latency"`
26+
BindIP string `json:"bindip"`
2627
Port int `json:"port"`
2728
Running bool `json:"running"`
2829
StdOut io.ReadCloser `json:"-"`
@@ -105,10 +106,11 @@ func (f *FactorioServer) Run() error {
105106
}
106107

107108
args := []string{
109+
"--bind", (f.BindIP),
108110
"--port", strconv.Itoa(f.Port),
109111
"--server-settings", filepath.Join(config.FactorioConfigDir, "server-settings.json"),
110112
"--rcon-port", strconv.Itoa(config.FactorioRconPort),
111-
"--rcon-pass", config.FactorioRconPass,
113+
"--rcon-password", config.FactorioRconPass,
112114
}
113115

114116
if f.Savefile == "Load Latest" {

src/handlers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ func CheckServer(w http.ResponseWriter, r *http.Request) {
419419
status["status"] = "running"
420420
status["port"] = strconv.Itoa(FactorioServ.Port)
421421
status["savefile"] = FactorioServ.Savefile
422+
status["address"] = FactorioServ.BindIP
422423
resp.Data = status
423424
if err := json.NewEncoder(w).Encode(resp); err != nil {
424425
log.Printf("Error encoding config file JSON reponse: %s", err)

src/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Config struct {
2323
FactorioRconPort int `json:"rcon_port"`
2424
FactorioRconPass string `json:"rcon_pass"`
2525
FactorioCredentialsFile string `json:"factorio_credentials_file"`
26+
FactorioIP string `json:"factorio_ip"`
2627
ServerIP string `json:"server_ip"`
2728
ServerPort string `json:"server_port"`
2829
MaxUploadSize int64 `json:"max_upload_size"`
@@ -65,7 +66,8 @@ func loadServerConfig(f string) {
6566
func parseFlags() {
6667
confFile := flag.String("conf", "./conf.json", "Specify location of Factorio Server Manager config file.")
6768
factorioDir := flag.String("dir", "./", "Specify location of Factorio directory.")
68-
factorioIP := flag.String("host", "0.0.0.0", "Specify IP for webserver to listen on.")
69+
serverIP := flag.String("host", "0.0.0.0", "Specify IP for webserver to listen on.")
70+
factorioIP := flag.String("game-bind-address", "0.0.0.0", "Specify IP for Fcatorio gamer server to listen on.")
6971
factorioPort := flag.String("port", "8080", "Specify a port for the server.")
7072
factorioConfigFile := flag.String("config", "config/config.ini", "Specify location of Factorio config.ini file")
7173
factorioMaxUpload := flag.Int64("max-upload", 1024*1024*20, "Maximum filesize for uploaded files (default 20MB).")
@@ -75,7 +77,8 @@ func parseFlags() {
7577

7678
config.ConfFile = *confFile
7779
config.FactorioDir = *factorioDir
78-
config.ServerIP = *factorioIP
80+
config.ServerIP = *serverIP
81+
config.FactorioIP = *factorioIP
7982
config.ServerPort = *factorioPort
8083
config.FactorioSavesDir = filepath.Join(config.FactorioDir, "saves")
8184
config.FactorioModsDir = filepath.Join(config.FactorioDir, "mods")

0 commit comments

Comments
 (0)