Skip to content

Commit e6bef3e

Browse files
committed
Merge remote-tracking branch 'mroote/develop' into Feature/Update-adminLTE
2 parents 1df341e + dea2c91 commit e6bef3e

21 files changed

+5365
-104
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ mix-manifest.json
1616
/app/**/vendor/
1717
/app/*.js*
1818
/app/*.css*
19+
.vscode

.travis.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
language: go
2-
os:
3-
- linux
4-
- windows
5-
6-
go:
7-
- 1.10.x
8-
- 1.11.x
9-
- 1.12.x
10-
- 1.x
11-
12-
install:
13-
- go get github.com/apexskier/httpauth
14-
- go get github.com/go-ini/ini
15-
- go get github.com/gorilla/mux
16-
- go get github.com/hpcloud/tail
17-
- go get github.com/gorilla/websocket
18-
- go get github.com/majormjr/rcon
19-
20-
script:
21-
- go test -v ./...
1+
jobs:
2+
include:
3+
- stage: deploy
4+
go: 1.x
5+
language: minimal
6+
before_install:
7+
- docker build -f "docker/Dockerfile-build" -t factorio-server-manager docker
8+
script:
9+
- mkdir /home/travis/build/mroote/build
10+
- docker run -t -e FAC_BRANCH=$TRAVIS_BRANCH -v /home/travis/build/mroote/build:/build factorio-server-manager
11+
- mv /home/travis/build/mroote/build/factorio-server-manager-linux.zip /home/travis/factorio-server-manager-linux-${TRAVIS_TAG}.zip
12+
- mv /home/travis/build/mroote/build/factorio-server-manager-windows.zip /home/travis/factorio-server-manager-windows-${TRAVIS_TAG}.zip
13+
deploy:
14+
provider: releases
15+
api_key: "${GITHUB_TOKEN}"
16+
draft: true
17+
skip_cleanup: true
18+
on:
19+
tags: true
20+
file:
21+
- /home/travis/factorio-server-manager-linux-${TRAVIS_TAG}.zip
22+
- /home/travis/factorio-server-manager-windows-${TRAVIS_TAG}.zip

Makefile

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,41 @@ endif
1212

1313
build: $(release)
1414

15-
$(shell mkdir -p build)
16-
build/factorio-server-manager-%.zip: app/bundle.js factorio-server-manager-%
15+
build/factorio-server-manager-%.zip: clean app/bundle factorio-server-manager-%
16+
@mkdir -p build/
1717
@echo "Packaging Build - $@"
1818
@cp -r app/ factorio-server-manager/
1919
@cp conf.json.example factorio-server-manager/conf.json
2020
@zip -r $@ factorio-server-manager > /dev/null
21-
@rm -r factorio-server-manager
2221

2322
app/bundle:
2423
@echo "Building Frontend"
2524
@npm install && npm run build
2625

27-
factorio-server-manager-linux: godeps
26+
factorio-server-manager-linux:
2827
@echo "Building Backend - Linux"
29-
@GOPATH="${GOPATH}:${PDW}"
3028
@mkdir -p factorio-server-manager
31-
@GOOS=linux GOARCH=amd64 go build -o factorio-server-manager/factorio-server-manager ./src
29+
@cd src; \
30+
GOOS=linux GOARCH=amd64 go build -o ../factorio-server-manager/factorio-server-manager .
3231

33-
factorio-server-manager-windows: godeps
32+
factorio-server-manager-windows:
3433
@echo "Building Backend - Windows"
35-
@GOPATH="${GOPATH}:${PDW}"
3634
@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
35+
@cd src; \
36+
GOOS=windows GOARCH=386 go build -o ../factorio-server-manager/factorio-server-manager.exe .
4237

4338
gen_release: build/factorio-server-manager-linux.zip build/factorio-server-manager-windows.zip
4439
@echo "Done"
4540

4641
clean:
4742
@echo "Cleaning"
48-
@rm -r build/
49-
@rm app/bundle.js
50-
@rm app/bundle.css
51-
@rm app/fonts/vendor
52-
@rm app/images/vendor
43+
@-rm -r build/
44+
@-rm app/bundle.js
45+
@-rm app/bundle.js.map
46+
@-rm app/style.css
47+
@-rm app/style.css.map
48+
@-rm -r app/fonts/vendor/
49+
@-rm -r app/images/vendor/
50+
@-rm -r node_modules/
51+
@-rm -r pkg/
52+
@-rm -r factorio-server-manager

README.md

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ This tool runs on a Factorio server and allows management of the Factorio server
4343
4. Visit [localhost:8080](localhost:8080) in your web browser.
4444

4545
## Usage
46-
Run the UI server and specify the directory of your Factorio server installation and the interface to run the HTTP server on. Edit the conf.json file with your desired credentials for authentication.
46+
Run the UI server and specify the directory of your Factorio server installation and the interface to run the HTTP server on. Edit the conf.json file with your desired credentials for authentication.
4747
```
4848
Usage of ./factorio-server-manager:
4949
-bin string
@@ -60,11 +60,21 @@ Usage of ./factorio-server-manager:
6060
Maximum filesize for uploaded files (default 20MB). (default 20971520)
6161
-port string
6262
Specify a port for the server. (default "8080")
63-
63+
-glibc-custom string
64+
Specify if custom glibc is used (default false) [true/false]
65+
-glibc-loc string
66+
Path to the glibc ld.so file (default "/opt/glibc-2.18/lib/ld-2.18.so")
67+
-glibc-lib-loc
68+
Path to the glibc lib folder (default "/opt/glibc-2.18/lib")
69+
6470
Example:
6571
6672
./factorio-server-manager --dir /home/user/.factorio --host 10.0.0.1
6773
74+
Custom glibc example:
75+
76+
./factorio-server-manager --dir /home/user/.factorio --host 10.0.0.1 --glibc-custom true --glibc-loc /opt/glibc-2.18/lib/ld-2.18.so --glibc-lib-loc /opt/glibc-2.18/lib
77+
6878
```
6979

7080
## Manage Factorio Server
@@ -89,8 +99,8 @@ It also acts as the webserver to serve the front end react application
8999
All api actions are accessible with the /api route. The frontend is accessible from /.
90100

91101
#### Requirements
92-
+ Go 1.7
93-
+ NodeJS 4.2.6
102+
+ Go 1.11
103+
+ NodeJS
94104

95105
#### Building Releases
96106
Creates a release zip for windows and linux: (this will install the dependencies listed in gopkgdeps)
@@ -121,7 +131,7 @@ make app/bundle
121131
```
122132

123133
##### For development
124-
The frontend is completly build by npm with laravel-mix. All plugins are buld into the compiled files. No plugins need to be load fro external sources.
134+
The frontend is completely build by npm with laravel-mix. All plugins are build into the compiled files. No plugins need to be load fro external sources.
125135

126136
It has different variants to build the frontend, provided by laravel-mix:
127137
- `npm run dev` Build the code for development. This will also generate map-files, so the browser, can show, what line and file causes the output.
@@ -134,46 +144,31 @@ In every of those cases, also images and fonts will be copied to the app-folder.
134144
1. Download the latest release source zip file
135145
* [https://github.com/mroote/factorio-server-manager/releases](https://github.com/mroote/factorio-server-manager/releases)
136146
2. Unzip the Factorio Standalone server and move it to a known directory.
137-
3. Download and install Go 1.7 or newer. https://golang.org/dl/
138-
4. Download and install NodeJS 4.2.6 64-bit or 32-bit depending on your operating system, if unsure download 32-bit
139-
* https://nodejs.org/download/release/v4.2.6/node-v4.2.6-x64.msi 64-bit
140-
* https://nodejs.org/download/release/v4.2.6/node-v4.2.6-x86.msi 32-bit
141-
5. Download and install NVM, when asked if you want it to use NodeJS 4.2.6 accept
142-
* https://github.com/coreybutler/nvm-windows/releases/download/1.1.1/nvm-setup.zip
143-
6. You will need to setup GOPATH in environmental settings in windows. You will want to go into Control Panel\System and Security\System From there on the left hand side click "Advanced system settings". A window will open and you need to click Environment Variables.
144-
7. Under System Variables click New. For Variable name use GOPATH and Variable value C:\Go\
147+
3. Download and install Go 1.11 or newer. https://golang.org/dl/
148+
4. Download and install NodeJS 64-bit or 32-bit depending on your operating system, most users need 64-bit nowadays.
149+
* https://nodejs.org/dist/v12.13.0/node-v12.13.0-x64.msi 64-bit
150+
* https://nodejs.org/dist/v12.13.0/node-v12.13.0-x86.msi 32-bit
145151

146152
Once everything is installed and ready to go you will need to compile the source for windows
147153

148154
1. Open the folder where ever you unzipped from step #2 above.
149155
2. My folder structure is like this "C:\FS\factorio-server-manager\" C:\FS is where my factorio files are located C:\FS\factorio-server-manager\ is where the server manager files are.
150-
3. You will now need to install some dependencies for Go. You will need to open up a command prompt and one at a time type each of these and hit enter before typing the next one.
151-
152-
```
153-
go get github.com/apexskier/httpauth
154-
go get github.com/go-ini/ini
155-
go get github.com/gorilla/mux
156-
go get github.com/hpcloud/tail
157-
go get github.com/gorilla/websocket
158-
go get github.com/majormjr/rcon
159-
```
160-
161-
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"
156+
3. Now you will want to go into the src folder for example "C:\FS\factorio-server-manager\src" once there hold down shift and right click an empty area of the folder. Then click "Open command windows here"
162157
4. Type this into the command prompt then hit enter:
163158

164159
```
165160
go build
166161
```
167162

168163
5. Once finished you will now see src.exe or src file inside the folder. You need to move that file to the C:\FS\factorio-server-manager\ or the folder that is before your src folder.
169-
6. From here you need to build the web front-end by going into your ui folder for me its C:\FS\factorio-server-manager\ui\ and again hold shift and left click in an empty area then select open command prompt here. You then need to type this:
164+
6. From here you need to build the web front-end. Again hold shift and right click in an empty area then select open command prompt here. You then need to type this:
170165

171166
```
172167
npm install
173168
npm run build
174169
```
175170

176-
7. Now execute the src file created in step #4 above
171+
7. Now execute the src file created in step #4 above. You have to specify the directory, where the factorio-server is located, as parameter. More about the parameter under [Usage](#Usage)
177172
8. You can now Visit [localhost:8080](localhost:8080) in your web browser to start using the Factorio server Manager
178173

179174
## Contributing
@@ -188,7 +183,7 @@ go build
188183
* **Mitch Roote** - [roote.ca](https://roote.ca)
189184

190185
## Special Thanks
191-
- **[All Contributions]**(https://github.com/mroote/factorio-server-manager/graphs/contributors)
186+
- **[All Contributions](https://github.com/mroote/factorio-server-manager/graphs/contributors)**
192187
- **mickael9** for reverseengineering the factorio-save-file: https://forums.factorio.com/viewtopic.php?f=5&t=8568#
193188

194189
## License

docker/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# glibc is required for Factorio Server binaries to run
22
FROM frolvlad/alpine-glibc
33

4-
MAINTAINER Mitch Roote <mitch@r00t.ca>
5-
64
ENV FACTORIO_VERSION=latest \
7-
MANAGER_VERSION=0.8.1 \
5+
MANAGER_VERSION=0.8.2 \
86
ADMIN_PASSWORD=factorio
97

108
VOLUME /opt/factorio/saves /opt/factorio/mods /opt/factorio/config /security
@@ -16,7 +14,8 @@ WORKDIR /opt/
1614
RUN curl -s -L -S -k https://www.factorio.com/get-download/$FACTORIO_VERSION/headless/linux64 -o /tmp/factorio_$FACTORIO_VERSION.tar.xz && \
1715
tar Jxf /tmp/factorio_$FACTORIO_VERSION.tar.xz && \
1816
rm /tmp/factorio_$FACTORIO_VERSION.tar.xz && \
19-
curl -s -L -S -k https://github.com/mroote/factorio-server-manager/releases/download/$MANAGER_VERSION/factorio-server-manager-linux.zip --cacert /opt/github.pem -o /tmp/factorio-server-manager-linux_$MANAGER_VERSION.zip && \
17+
curl -sLSk https://github.com/mroote/factorio-server-manager/releases/download/$MANAGER_VERSION/factorio-server-manager-linux-${MANAGER_VERSION}.zip \
18+
--cacert /opt/github.pem -o /tmp/factorio-server-manager-linux_$MANAGER_VERSION.zip && \
2019
unzip -qq /tmp/factorio-server-manager-linux_$MANAGER_VERSION.zip && \
2120
rm /tmp/factorio-server-manager-linux_$MANAGER_VERSION.zip && \
2221
mkdir -p /run/nginx && \

docker/Dockerfile-build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM alpine:latest
2+
3+
RUN apk add --no-cache git make musl-dev go nodejs npm zip
4+
5+
ENV FAC_BRANCH=develop
6+
ENV GOROOT /usr/lib/go
7+
ENV GOPATH /go
8+
ENV PATH /go/bin:$PATH
9+
ENV FAC_ROOT /go/src/factorio-server-manager
10+
11+
COPY build.sh /usr/local/bin/build.sh
12+
13+
RUN mkdir -p ${GOPATH}/bin
14+
RUN chmod u+x /usr/local/bin/build.sh
15+
16+
WORKDIR $FAC_ROOT
17+
18+
VOLUME /build
19+
20+
CMD ["/usr/local/bin/build.sh"]

docker/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ SECURITY_PATH ?= $(FACTORIO_PATH)/security
55
SAVES_PATH ?= $(FACTORIO_PATH)/saves
66
MODS_PATH ?= $(FACTORIO_PATH)/mods
77
PORT_FORWARD ?= -p 80:80 -p 443:443 -p 34197:34197/udp
8+
FACTORIO_BRANCH ?= develop
89

910
build:
11+
docker build --build-arg FAC_BRANCH=$FACTORIO_BRANCH -f Dockerfile-build -t fsm-build .
1012
docker build -t factorio-server-manager .
1113

1214
logs:
13-
docker logs factorio-server
14-
echo "Nginx Access Logs"
15-
docker exec -it factorio-server cat /var/log/nginx/access.log
16-
echo "Nginx Error Logs"
17-
docker exec -it factorio-server cat /var/log/nginx/error.log
15+
docker logs factorio-server -f
1816

1917
run:
2018
docker run -d --name factorio-server -v $(SECURITY_PATH):/security -v $(SAVES_PATH):/opt/factorio/saves -v $(MODS_PATH):/opt/factorio/mods $(PORT_FORWARD) factorio-server-manager
@@ -25,3 +23,5 @@ stop:
2523

2624
clean:
2725
docker rmi factorio-server-manager
26+
docker stop fsm-build
27+
docker rmi fsm-build

docker/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
echo "Cloning ${FAC_BRANCH}"
4+
git clone -b ${FAC_BRANCH} https://github.com/mroote/factorio-server-manager.git ${FAC_ROOT}
5+
echo "Creating build..."
6+
make gen_release
7+
echo "Copying build artifacts..."
8+
cp -v build/* /build/

gopkglist

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/factorio_save.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func OpenArchiveFile(path string, name string) (r io.ReadCloser, err error) {
4646
}
4747
}
4848

49+
archive.Close()
4950
return nil, errors.New("file not found")
5051
}
5152

0 commit comments

Comments
 (0)