-
Notifications
You must be signed in to change notification settings - Fork 141
Development
The backend is built as a REST API via the Go web application.
It also acts as the webserver to serve the front end react application
All api actions are accessible with the /api route. The frontend is accessible from /.
To authenticate with the API and get access to its functionality, you need to login first.
Here is a small example showing how to do it with a local install using default credentials, via the tool curl:
curl --cookie-jar cookie.txt --insecure --data '{"username":"admin","password":"factorio"}' -H "Content-Type: application/json" -X POST https://localhost/api/login
curl --cookie cookie.txt --insecure https://localhost/api/server/status
- Go 1.11
- NodeJS >10.13.0
Creates a release zip for windows and linux: (this will install the dependencies listed in gopkgdeps)
git clone git@github.com:OpenFactorioServerManager/factorio-server-manager.git
cd factorio-server-manager
make gen_release
git clone git@github.com:OpenFactorioServerManager/factorio-server-manager.git
cd factorio-server-manager
make
./factorio-server-manager/factorio-server-manager
Frontend is built using React and the AdminLTE CSS framework.
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.
All necessary CSS and Javascript files are included for running the UI.
Transpiled bundle.js application is output to app/bundle.js, 'npm run build' script starts webpack to build the React application for development.
make app/bundle
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.
It has different variants to build the frontend, provided by laravel-mix:
-
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. -
npm run watch
Build the code for development like the dev-command. This will not stop and automatically rebuild, when files are changed and saved. -
npm run hot
Build the code for development. It has the same behaviour like the watch-command and also causes a hotReload of the files inside the browser (in theory) -
npm run build
Build the code for deployment. It will generate no map-files and also minifies the bundle-files. In every of those cases, also images and fonts will be copied to the app-folder.
- Download the latest release source zip file
- Unzip the Factorio Standalone server and move it to a known directory.
- Download and install Go 1.11 or newer. https://golang.org/dl/
- Download and install NodeJS 64-bit or 32-bit depending on your operating system, most users need 64-bit nowadays.
- https://nodejs.org/dist/v12.13.0/node-v12.13.0-x64.msi 64-bit
- https://nodejs.org/dist/v12.13.0/node-v12.13.0-x86.msi 32-bit
Once everything is installed and ready to go you will need to compile the source for windows
- Open the folder where ever you unzipped from step #2 above.
- 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.
- 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"
- Type this into the command prompt then hit enter:
go build
- 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.
- 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:
npm install
npm run build
- 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
- You can now Visit localhost:8080 in your web browser to start using the Factorio server Manager