1
0
Fork 0
hscloud/games/factorio/modproxy/README.md

39 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

Factorio modproxy
=================
The modproxy is a microservice that caches Factorio mods.
Usually, Factorio mods from the mod portal need credentials in order to be downloaded. As nobody is willing to share their credentials, or buy a HSWAW factorio license, this proxy got implemented.
.-------------------. .----------. .----------.
| mods.factorio.com |<-------| modproxy |<-------------.---|.----------.
'-------------------' HTTP '----------' gRPC :----| factorio |
| Local | '| server |
| files | '----------'
V | .----------.
.-'''-. '----| Account |
|-___-| | holder |
| CAS | Cached mods '----------'
'-___-'
Factorio servers run a `client` binary that attempts to synchronize local mods with a specified intent of wanted Factorio mods. Any mods that are missing are downloaded from the modproxy over gRPC. Regardless of the success of the downloads, the modproxy client will then continue running the Factorio server.
The modproxy, when asked for a mod (via a `ModProxy.Download` gRPC call), will either serve it (if it has a copy of it), or record that this selected mod was missing and store this request in memory.
Then, when an Account Holder connects and calls `ModProxy.Mirror`, the modproxy will go through its saved list of pending mods to download, and use the credentials provided to download them.
Deployment
----------
Factorio servers and the modproxy live in the `factorio` namespace on k0. Factorio servers created via jsonnet will automatically spawn a modproxy client on startup that will attempt to download whatever mods havve been specified in the jsonnet configuration (which is serialized to `config.pb.text`).
Synchronizing Mods as an Account Holder
---------------------------------------
If you have a Factorio account, you can connect over to the modproxy to feed it any mods that it wanted to download but couldn't. Currently this is done via a manual grpcurl call, an admin client might be introduced at some later point:
kubectl -n factorio port-forward deployment/proxy 4200
grpcurl -plaintext -format text -d 'username: "q3k" token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' 127.0.0.1:4200 modproxy.ModProxy.Mirror
The reuslt will be empty if no mods had to be synchronized.