Hornwitser
3dfed4d2ad
Remove master.factorio_directory config
...
Remove old config entry for the old locale API that was removed with the
introduction of the new export system in 260f976 .
2020-06-15 00:13:25 +02:00
Hornwitser
c3179f0423
Move ControlConfig to lib/config/definitions.js
...
Move the definition of the control config to lib/config so that the
master code can use it.
2020-06-15 00:13:25 +02:00
Hornwitser
931ad4816f
Update config of running Factorio instances
...
Monitor the factorio.settings config for changes and apply them to
running instances via the /config set command.
2020-05-31 22:28:51 +02:00
Hornwitser
5b043524b4
Implement setProp in configs
...
Add setProp method for selectively changing one property of an object
field in a config group.
2020-05-31 16:08:21 +02:00
Hornwitser
8c9daff0bb
Add name shortcut for ConfigGroup instances
...
Add .name shortcut to get the groupName class property of config group
instances.
2020-05-31 14:16:06 +02:00
Hornwitser
67ca8dcc4d
Implement config notification event
...
Add fieldChanged event to config objects that is triggered when the
value of a field in a group belonging to it is changed.
2020-05-30 14:27:59 +02:00
Hornwitser
fc3686b865
Invoke plugin hooks via common function
...
Use a common function to iterate through and invoke the given hook in
every plugin, and ignore errors thrown by plugins from these hooks.
2020-05-30 14:27:59 +02:00
Hornwitser
36cf14074e
Automatically upload export to master server
...
Upload the created export data zip file to a new /api/upload-export
endpoint on the master server which unpacks it into the appropriate
directory on the master.
2020-05-26 15:31:42 +02:00
Hornwitser
260f976fa3
Implement export of item icons and locale
...
Add mod and command for exporting the Factorio locale including mods,
and item icons assemled into a sprite sheet including mods.
2020-05-26 01:11:49 +02:00
Hornwitser
203f2d2a14
Fix Windows stop logic
...
Handle the Factorio server not exiting when encountering an error on
Windows and fix the hang detection for .stop().
2020-05-21 18:06:20 +02:00
Hornwitser
3211fbe985
Notify master about instance status update
...
Send updates to the master server when the running status of instances
change and add onInstanceStatusChanged hook to master plugins.
2020-05-11 18:10:11 +02:00
Hornwitser
a194508f52
Filter plugin messages forwarded to links
...
Drop events forwarded to a slave or instance that does not have the
plugin the event is defined in. Reject requests for the same reason.
2020-05-11 18:04:03 +02:00
Hornwitser
1b427af5f0
Fix client send buffer not being sent on ready
...
Fix WebSocketClientConnector not sending the send buffer queued up
between starting the connection and the master server sending the ready
signal for it.
2020-05-09 16:34:46 +02:00
Hornwitser
04ee3d3f96
Fix WebSocketClientConnector lifecycle events
...
Fix drop being repeatedly emitted while reconnecting and close not being
emitted on connection timeout.
2020-05-09 16:28:07 +02:00
Hornwitser
c35b6de70e
Notify on connection events
...
Implement notification to plugins for disconnect request, connect, drop,
and close. This allows plugins to properly handle slaves and the master
server shutting down without sending messages that will get lost.
2020-05-08 23:49:28 +02:00
Hornwitser
b8b8c44083
Fix onExit not being invoked if plugin load fails
...
Fix instance not properly exiting if an error occurs during the loading
of a plugin.
2020-05-08 18:15:17 +02:00
Hornwitser
1beffb1bfd
Fix crash on hartbeat on closing connection
...
Fix heartbeat incorrectly asserting it cannot be sent on a connection in
the closing state.
2020-05-08 18:09:48 +02:00
Hornwitser
b151dd8469
Fix documentation
...
Fix missing module declarations, broken lings, broken formating and
incorrect scopes in the documentation. For modules split over several
files it appears the only viable option is to use the memberof directive
on each documented member and only declare the index file as a module.
2020-05-08 17:28:06 +02:00
Hornwitser
5c1214ad38
Rename connected and dropped events
...
Rename the connector events connected and dropped to connect and drop
respectively to be consistent with common Node.js names for events like
close.
2020-05-07 12:36:43 +02:00
Hornwitser
1629eaf225
Track plugins loaded by master and slaves
...
Send a mapping of the plugins the master server has loaded to slaves
vice versa. Limit the plugins that may be loaded by instances to only
those that the master server has loaded.
2020-05-06 20:14:40 +02:00
Hornwitser
b6585e6364
Fix reconnect giving up too early
...
Fix the reconnect logic giving immediately if a previous reconnection
had been made long prior to the connection being dropped again.
2020-04-18 23:37:50 +02:00
Hornwitser
4f463a8180
Reduce number of bits in generated test cert
...
Add config entry for the number of bits to use in the auto generate TLS
certificate for the master server and reduce it to 512 for the
integration test. This reduces the time needed to generate the
certificate in the integration test.
2020-04-09 20:02:29 +02:00
Hornwitser
2c855a5846
Add debug-dump-ws command
...
Add debug command to dump the WebSocket messages being sent and received
by the master server to aid in finding chatty events.
2020-04-09 19:50:01 +02:00
Hornwitser
61d92a6910
Rename master plugin onExit hook to onShutdown
...
Rename the onExit hook for master plugins to onShutdown to better
reflect when it is invoked.
2020-04-09 19:50:01 +02:00
Hornwitser
9507608e59
Rework disconnect logic for connectors
...
Rework the way disconnection at shutdown is done to properly close
the connections when the master server is shut down.
2020-04-09 19:50:01 +02:00
Hornwitser
47ea8f5477
Rename connection shutdown to prepare disconnect
...
Rename the shutdownConnection request to prepareDisconnect to better
reflect its actual purpose.
2020-04-09 16:17:38 +02:00
Hornwitser
d537e5cf6b
Fix typo in default cpu metric
...
Fix proces_cpu_seconds_total being mislabled as process_cpu_seconds.
2020-04-09 16:17:38 +02:00
Hornwitser
56488b2c2d
Add resident memory and heap size metrics
...
Implement the default resident memory and heap size metrics.
2020-04-09 16:17:38 +02:00
Hornwitser
e908c5069b
Add autosave tracking and statistics
...
Detect when autosaves are made and track the size in a Prometheus gague.
2020-04-09 16:17:38 +02:00
Hornwitser
6bc07ad1b3
Add Factorio CPU and Memory usage statistics
...
Add per instance metrics for CPU and memory usage with the pidusage
library.
2020-04-09 16:17:38 +02:00
Hornwitser
56ee1fe955
Rework save logic with regard to start instance
...
Ensure that notifyExit is called if errors occur during startInstance
and createSave request, and rework startInstance save logic to create
a new savegame if no save is present and allow specifying the save to
load.
2020-04-09 16:17:38 +02:00
Hornwitser
75cd6d38db
Fix instance exit notification
...
Fix improper notification on Factorio server exit causing plugins and
the instance tracking to fail.
2020-04-04 15:14:23 +02:00
Hornwitser
8ebf0fc754
Add master server Web Root config
...
Add web_root option to the master server and use it create URLs for
resources hosted by it. This permits hosting the master server web
interface behind reverse proxy under a dedicated path.
2020-04-04 10:05:37 +02:00
Hornwitser
5c16809b5b
JSDoc use autodetected module name
...
Change @module <module name> entries to just @module as JSDoc is able to
automatically determine the module name.
2020-04-03 20:51:28 +02:00
Hornwitser
3cc84d6400
Use basicType helper in lib/database
...
Simplify the checking logic in lib/database by using the basicType
helper.
2020-04-03 20:51:28 +02:00
Hornwitser
65494a0a91
Move basicType to lib/helpers
...
Move the basicType function from the config lib to a shared helpers lib.
2020-04-03 20:51:28 +02:00
Hornwitser
f05100c94d
Remove unused files
...
Remove left over files that are no longer in use.
2020-04-03 20:51:28 +02:00
Hornwitser
9a4a535add
Expose Slave to instance plugins
...
Allow the slave object to be accessed by instance plugins through the
this.slave property.
2020-04-03 20:51:28 +02:00
Hornwitser
3ff5e630ca
Warn on unhandled Factorio ipc
...
Send warning to console if an ipc message is received but there were no
handlers registered to handle it.
2020-04-03 20:51:28 +02:00
Hornwitser
028f00e58a
Rename client.js to slave.js
...
Rename the client.js script to slave.js, and changed places where it's
refered to as client into slave.
2020-04-03 20:51:28 +02:00
Hornwitser
ae86781b0d
Add support for multiple Factorio installs
...
Allow the factorio_directory specified in the slave config to contain
multiple Factorio installs and add factior.version instance option to
select which install to use for the given instance.
2020-04-03 20:51:28 +02:00
Hornwitser
4c26fcee3a
Fix connection shutdown logic
...
Fix the WebSocket link not being properly teared down on the master
side causing the handshake to deadlock when the slave tried to connect
again.
2020-04-03 20:44:20 +02:00
Hornwitser
d4e072f376
Rewrite reconnection logic
...
Implement proper session tracking and resume on reconnect for the
WebSocket server.
2020-04-02 21:58:44 +02:00
Hornwitser
43ce6aa58c
Pass validation errors with InvalidMessage error
...
Pass the array describing the validation errors occuring with the
InvalidMessage error throw and print it to the console.
2020-04-02 14:39:18 +02:00
Hornwitser
677512512e
Replace socket.io with plain WebSocket
...
Replace socket.io with plain WebSocket using the ws library as it
doesn't really provide any useful tools over plain WebSocket when it
comes to implementing reliable communication that works across
reconnects. The widespread browser support for WebSocket also means
it has little value to add for the web interface over WebSocket.
2020-03-22 02:10:54 +01:00
Hornwitser
808bd6b453
Validate messages sent
...
Validate messages sent over links with the json schema provided from
them. This aids debugging as an exception will be thrown from the code
sending the bad content.
2020-03-22 02:10:54 +01:00
Hornwitser
090fbd6dff
Expose master interfaces to plugin
...
Expose Express.js app, master config, instance and slave database, slave
connections and metrics to the master plugins.
2020-03-13 22:46:17 +01:00
Hornwitser
6a8346186f
Implemented forwarding of requests to the master
...
Implement the forwardTo function for requests to the master server.
2020-03-13 22:46:17 +01:00
Hornwitser
5e5149dc93
Implement new configuration system
...
Replace current configuration mess with a trimmed down version of the
original vision of #200 . Configs are collection of config groups that
have fields that can be set. These groups allow organizing the fields
as well as opertunity for plugins to add their own groups. By default
plugins have an auto generated group with the enabled field.
2020-03-09 20:48:13 +01:00
Hornwitser
370ee9ed04
Unminify formatBytes
...
There's no reason to minify formatBytes it saves nothing. Use the
unminified version as published.
2020-01-14 08:09:39 +01:00