Hornwitser
6cf16cc09e
Reference by global in statistics_exporter
...
Store export function in a global table in the lua module for statistics
exporter in order to avoid a remote.call.
2020-01-04 17:34:16 +01:00
Hornwitser
0e9cd35c30
Add table of contents to Writing Plugins
...
Add table of contents for the Writing plugins document.
2020-01-04 17:34:16 +01:00
Hornwitser
66aa7e1e43
Add clusterio module with API for lua code
...
Add a shared API for lua code through a module named clusterio.
2020-01-04 17:34:16 +01:00
Hornwitser
221dc855f4
Add option to throw on non-empty RCON responses
...
Add option to FactorioServer.sendRcon to throw on non-empty responses
from Factorio. This is useful for detecting errors returned by commands
that should not have a response.
2020-01-04 17:34:16 +01:00
Hornwitser
f88e1f1d3a
Remove dead code left over from 21d9fdf
...
Remove compatConfig definition after RCON is established which was left
over from 21d9fdf .
2020-01-04 17:34:16 +01:00
Hornwitser
c091dc341e
Implement require option for modules
...
Implement option allowing files to be required from control.lua be
specified in modules.json.
2020-01-04 17:34:16 +01:00
Hornwitser
e89e54ee27
Implement dependencies specification for modules
...
Implement dependency ordering and version checking for modules.
2020-01-04 17:34:16 +01:00
Hornwitser
80bd75ba16
Rework module loading
...
Change module loading to use a module.json file describing the module
and patch in all files in a directory path passed to the patcher instead
of having to pass the files names and their content. This allows the
specification of which files should be passed to the event_handler lib
and an easy implementation of loading stand alone modules.
2020-01-04 17:34:16 +01:00
Hornwitser
11992d1839
Merge pull request #275 from Hornwitser/statistics-fixes
...
Statistics plugin test and minor fix
2020-01-04 17:33:48 +01:00
Hornwitser
610859eb3b
Improve error message from statistics_exporter
...
If the JSON parse failed it will usually be because Factorio returned an
error message instead of JSON, pass this along for easier debugging.
2019-12-29 04:44:16 +01:00
Hornwitser
37d8eedc0d
Add tests for statistics_exporter plugin
...
These were already made at the time I ported the plugin but somehow I
forgot to add them to the statistics rework commit (26eefb0 ) :/.
2019-12-29 04:42:13 +01:00
Hornwitser
9d2e89ec63
Merge pull request #274 from Hornwitser/document-version-requirement
...
Document version requirement
2019-12-29 04:25:32 +01:00
Hornwitser
1b61d09a07
Add docs section on supported versions
...
Add section in the contributing docs about which version of Node.js and
Factorio is supported.
[skip travis]
2019-12-27 06:26:22 +01:00
Hornwitser
b2a902f784
Update Node.js requirement documentation
...
Update Node.js version specified in README.md to be explicit about which
versions below 12 is supported, and use version 12 by default.
2019-12-23 23:53:40 +01:00
Hornwitser
f700e98e8e
Remove old statistics code
...
Remove left over code from the old statistics gathering and display
which was replaced with Prometheus+Grafana.
2019-12-22 00:54:45 +01:00
Hornwitser
770c961900
Merge pull request #270 from Hornwitser/plugin-rewrite
...
Plugin system rewrite
2019-12-21 00:49:02 +01:00
Hornwitser
1873f9bda8
Remove UPSdisplay plugin
...
Remove the redundant UPSdisplay plugin. UPS statistics is gathered by
the statistics_exporter plugin.
2019-12-20 21:26:29 +01:00
Hornwitser
26eefb0476
Rewrite statistics export
...
Add automatic export of metrics from slaves to the master server. And
rewrite the statistics export plugin to use this new system.
2019-12-20 21:26:29 +01:00
Hornwitser
8229d1955c
Skip broken Prometheus client tests
...
Skip Prometheus client tests that assume the environment is isolated
from the rest of the tests.
2019-12-20 19:14:35 +01:00
Hornwitser
b4c7824101
Add homebrew Prometheus client
...
Add an implementation of a Prometheus client. This is because the
prom-client implementation seems to have missunderstood how Prometheus
is supposed to work and doesn't allow updating collectors via
asynchronous callback.
2019-12-20 19:14:35 +01:00
Hornwitser
1f6574a89c
Improve master shutdown
...
Close active connections and http servers during master shutdown and let
node exit on its own. If this fails with an error set output streams to
blocking and report it then shutdown with process.exit.
Also add double SIGINT handling to immediately shutdown.
2019-12-20 02:37:27 +01:00
Hornwitser
8b9bb59357
Fix fast-test
...
Fix incorrect locations for slowTest in clusterio integration tests and
add slowTest to the patch integration tests. Fixes fast-test being
broken.
2019-12-14 17:53:34 +01:00
Hornwitser
b71c392b32
Port globalChat to new plugin system
...
Port the globalChat plugin to the new plugin system. Since there's no
config system yet the config options for it is removed.
2019-12-14 17:51:54 +01:00
Hornwitser
bcceae687f
Reimplement plugin system
...
Implement a new plugin system based subclassing pre-defined base clases
and communicating with pre-defined link messages.
2019-12-14 17:48:56 +01:00
Hornwitser
513651393b
Implement forwarding to instances for events
...
Implement forward to instance for Event messages.
2019-12-14 17:31:02 +01:00
Hornwitser
e5115df28b
Implement broadcast for events
...
Add broadcastTo property to events that broadcasts them to all entities
of the specified target that's downstream to the connection it was sent
to.
2019-12-13 22:37:58 +01:00
Hornwitser
21d9fdff7b
Remove old plugin system
...
Remove the old client/instance fused plugin system along with
instanceManagement in client.js and getPlugins in master.js.
2019-12-13 22:37:49 +01:00
Hornwitser
22c325394f
Merge pull request #269 from Hornwitser/link-refactor-2
...
Another link refactor
2019-12-13 22:29:57 +01:00
Hornwitser
ca21ff741b
Add changelog entry for communication rewrite
...
Add entry to changelog detailing the rewrite of the communication layer.
2019-12-13 21:57:05 +01:00
Hornwitser
d4dd290654
Add communication layer docs
...
Add breif description of the link, connector and messages communication
concepts implemented by lib/link.
2019-12-13 21:57:05 +01:00
Hornwitser
f0afbf0a33
Complete test coverage for lib/link/link.js
...
Add tests for the remaining uncovered lines in lib/link/link.js.
2019-12-13 21:57:05 +01:00
Hornwitser
5dd1490c75
Fix clusterctl error on exit
...
Fix code still using the close method on the Link class which was
removed in 3bccbac .
2019-12-13 21:57:05 +01:00
Hornwitser
9c8ae2bf06
Remove debug logging
...
Remove left over verbose debug logging.
2019-12-13 21:57:05 +01:00
Hornwitser
5d8fa4e4ce
Refactor instance communication
...
Change Instance class to be a subclass of Link and refactor the
communication to and establisment of instances to use a virtual
connection between the slave and the instance. This is simplifies the
implementation of plugin communication for instances.
Replace InstanceRequest with a forwardTo option to Request which does
the task of forwarding in a much cleaner way.
2019-12-13 21:57:05 +01:00
Hornwitser
9f24d200b7
Ignore config in top level directory only
...
Change .gitignore to only ignore the config files in the top level
directory of repository. If these files exist elsewhere it's likely
either intended or an error.
2019-12-13 21:57:05 +01:00
Hornwitser
47cff048f0
Improve link error messages
...
Reverse the reversal of source/target in message errors and add link
source and target to the error given when a validator is missing on a
link.
2019-12-13 21:39:54 +01:00
Hornwitser
b24778dce6
Add filter argument to getNewestFile
...
Add filter predicate to allow filtering out files that are not desired
from getNewestFile. This is useful for filtering out .tmp.zip files.
2019-12-13 21:39:54 +01:00
Hornwitser
62afcaadab
Use shared StartupError class
...
Remove separate StartupError class definition in master.js in favor of
the shared StartupError class in lib/error.js.
2019-12-13 21:39:54 +01:00
Hornwitser
b59fd80a7b
Merge pull request #268 from Hornwitser/port-1.2.4
...
Port 1.2.4 fixes
2019-12-13 21:37:17 +01:00
Hornwitser
7a03b84858
Port fix bcrypt failing to install on Windows
...
The maintainers of bcrypt have in their infinite wisdom decided to stop
distributing Windows binaries. Their inner workings remain a mystery.
This is a port of 5fe98a0 .
2019-12-11 02:14:00 +01:00
Hornwitser
3e7f497669
Port remove obsolete flow statistics from clusterioMod
...
Remove the obsolete and broken statistics gather from the clusterioMod
plugin. The statisticsExporter plugin already exports all of the
statistics (and more) that was exported here.
This is a port of 3e7d4a8 .
2019-12-11 02:14:00 +01:00
Hornwitser
f1ac41bc4c
Port fix researchSync updating researched technologies
...
Add check in filter_updated_techs that ignores already researched
technologies.
This is a port of b0eb188 .
2019-12-11 02:14:00 +01:00
Hornwitser
b2239aeb96
Add changelog entry from 1.2.4
...
Add changelog entry for the removal of the combinator signaling which
was first implemented in the master branch.
2019-12-11 02:13:57 +01:00
Hornwitser
34d4604bab
Merge pull request #265 from Hornwitser/link-refactor
...
lib/link refactor and plugin preparations
2019-11-30 00:53:42 +01:00
Hornwitser
ea4f3ab2bf
Remove uncoloured formatting of factorioOutput
...
Since chalk autodetects the color support in the terminal there is no
need for a non-coloured version of formatOutput.
2019-11-30 00:08:10 +01:00
Hornwitser
c6fd46e3c3
Replace sources/targets with links in messages
...
Replace the sources/targets concept with a links array in the message
definitions. Fixes the problem of the actual links the messages applies
to being ambigious when there's multiple sources and targets.
2019-11-30 00:08:10 +01:00
Hornwitser
3be264c9a9
Add integration testing of commands
...
Add testing of the clusterctl commands against the master and slave
code.
2019-11-30 00:08:10 +01:00
Hornwitser
b24c129e38
Improve formating for instance output
...
Use colours instead of dim in the coloured output from clusterctl as not
all terminals support dim.
2019-11-30 00:08:10 +01:00
Hornwitser
f5d2b058d9
Fix deleteInstance returning early
...
Fix deleetInstance returning success before the instance have actually
been deleted.
2019-11-30 00:08:10 +01:00
Hornwitser
3f86011db1
Disable instance plugins
...
Disable the completely broken instance plugins as they break the
integration tests.
2019-11-30 00:08:10 +01:00
Hornwitser
f8aa947a98
Add tests for resolveInstance
...
Add tests for the resolveInstance function in clusterctl.
2019-11-30 00:08:10 +01:00
Hornwitser
bfff297d9a
Add tests for clusterctl's output formatting
...
Add tests for formatOutput and formatOutputColored by using the same
lines as the line parser uses for testing.
2019-11-30 00:08:10 +01:00
Hornwitser
3bccbac496
Refactor to a connector based concept in lib/link
...
Remove connection and client subclasses of Link and put the connection
logic into a "connector" class. The connector deals with sending
and receiving messages, handling the connection and reconnection of lost
connections and giving sequence numbers to messages.
This move the logic of the actual connection away from the link
sub-classes, which in turn means the connection should be a lot easier
to mock in tests.
2019-11-30 00:08:10 +01:00
Hornwitser
a3eb39712c
Make FactorioServer.exampleSettings static
...
Convert the exampleSettings method to be a static method.
2019-11-30 00:08:10 +01:00
Hornwitser
039b41d3e6
Move events and requests into messages
...
Merge the events and requests categories in lib/link into messages and
use the class name of the message to determine which handler to call.
Also swaps the order of the arguments for forwardInstanceRequest to be
consistent with the rest of the lib/link code and fixes up the docs for
requests and events.
2019-11-30 00:08:10 +01:00
Hornwitser
278dc9b2d2
Remove empty instanceManager file
...
Remove the empty/incomplete instanceManager implementation.
2019-11-30 00:08:10 +01:00
Hornwitser
2d3307c045
Remove unused binary option from plugin configs
...
Remove the unimplemented "binary" option from all plugin config files.
Setting this option to something other than "nodePackage" would
supposedly run a binary and feed it with the stdout of the factorio
proccess, but that was never implemented.
2019-11-30 00:08:10 +01:00
Hornwitser
5228e0a4d7
Merge pull request #261 from Hornwitser/daemonize
...
Daemonize Slaves
2019-11-25 23:15:15 +01:00
Hornwitser
d9910b0750
Merge pull request #263 from Hornwitser/contributing-docs
...
Add contributing instructions
2019-11-25 23:13:53 +01:00
Hornwitser
1dea5fddbe
Forward Factorio logs to clusterctl
...
Add instance output event that is forwarded by the master server to
control connections that are subscribing to them. Add code subscribing
to the relevant instance output when dealing with instances in
clusterctl.
2019-11-23 15:18:20 +01:00
Hornwitser
f2c3006046
Remove obsolete fileOps code
...
Remove sync functions that should not be used as well as of functions
that provide functionality that is already implemented by fs-extra.
2019-11-23 15:18:20 +01:00
Hornwitser
554cab4fb0
Add SIGKILL detection to lib/factorio/server
...
Check if Factorio terminated as a result of SIGKILL and throw an error
suggesting the system may be low on memory as a cause. Also print exit
code if the unexpected shutdown occured without a signal.
2019-11-23 15:18:20 +01:00
Hornwitser
7a2abaa5db
Daemonize slave
...
Rework client.js to support running multiple instances at once and be
managed remotely and implement the neccessary communication
infrastructure for this.
Due to circular dependencies on the implementation of this the master
branch is significantly broken after this.
2019-11-23 15:16:47 +01:00
Hornwitser
5858d97857
Remove playerManager specific CLI tool
...
Remove the playerManager plugin specific CLI tool delete_players.js
2019-11-21 22:25:15 +01:00
Hornwitser
bc41f7afa6
Clean up generateSSLcert test
...
Remove dependency to fileOps in generateSSLcert test file and clean up
the code to follow a higher standard.
2019-11-21 22:25:15 +01:00
Hornwitser
65f75d86e6
Add id based database load and save functions
...
Add functions to save and load a Map of objects indexed by the id
property in the objects.
2019-11-21 22:25:15 +01:00
Hornwitser
fcae3ef0c1
Use detected Factorio version
...
Remove Factorio_version from the config file and use the detected
version of Factorio instead.
2019-11-21 22:25:11 +01:00
Hornwitser
7b2ba58701
Add contributing instructions
...
Add instructions detailing the recommended git workflow as well as some
code style guidelines.
2019-11-21 17:11:57 +01:00
Hornwitser
27fc68da0f
Remove remoteCommands plugin and interface
...
Remove the half baked remote rcon command interface in preparation for a
better version based on a new socket.io communication layer.
2019-11-20 22:37:25 +01:00
Hornwitser
ca2967e255
Fix clusterioMod item autosaving
...
Fix the autosave code being broken by the move in e4aae88 .
2019-11-20 22:37:25 +01:00
Hornwitser
d38e9a53c4
Remove broken combinator signaling
...
Remove badly implemented and broken remote combinator signaling.
2019-11-20 22:37:25 +01:00
Hornwitser
d2d058e7d6
Remove the broken serverManager plugin
...
The remote management interface will completely change with the
implementation of #201 .
2019-11-20 22:37:25 +01:00
Hornwitser
2f3b4c1aa8
Remove redundant API call in globalChat
...
Remove call to getInstanceName which in turn calls the rather expensive
/api/slaves in the globalChat plugin.
2019-11-20 22:37:25 +01:00
Hornwitser
f3171c2feb
Remove support for uploading mods to master
...
Remove the uploadMod and checkMod APIs as these have become more or less
obsolete after Factorio implementd syncing mods to the server in game.
2019-11-20 22:37:23 +01:00
Hornwitser
1d26212e1d
Remove port and password arguments to client.js
...
Remove undocumented command line options set the ports and password used
in the instance. These are not compatible with remote management.
2019-11-20 22:36:14 +01:00
Hornwitser
0474355175
Fix README port from 1.2.3
...
Fix the new instructions for installing clusterio on Windows not being
corrected to install the master branch when it was ported over.
2019-11-20 22:34:10 +01:00
Hornwitser
ba7626ff2d
Merge pull request #255 from Hornwitser/port-1.2.3-fixes
...
Port 1.2.3 fixes
2019-11-18 01:54:14 +01:00
Hornwitser
707f06be76
Port update Windows install instructions
...
Remove the reference to the out of repo Windows install script and list
updated commands to install Clusterio stable in the readme itself.
This is a port of e1771ec .
2019-11-15 15:44:22 +01:00
Hornwitser
35f3f4f02b
Add changelog entry from 1.2.3
...
Add the fixed Hotpatch changelog entry from 1.2.3.
2019-11-15 15:41:11 +01:00
Hornwitser
31ab3a09f6
Port add fileReadDelay to inventoryImports config
...
Fix the inventoryImports client side code never receiving the script
output by specifying fileReadDelay and thereby getting the old
behaviour. This broke with the introduction of the tail mode script
output mode which requires a newline to be written at the end of
the output.
This is a port of d810b56 .
2019-11-15 15:39:43 +01:00
Hornwitser
7c79ea44b6
Port fix inventoryImports command
...
Fix the inventory imports command trying to count up the removed quick
bar slots as well as using player_main instead of character_main.
Add warning that the lua commands file containing the unminified vesion
of the command has not been kept up to date. There are multiple changes
that has been done previously so these have already diverged.
This is a port of 10414eb .
2019-11-15 15:39:20 +01:00
Hornwitser
7359f9075e
Port increase limit of Json payloads to master server
...
The default limit of 100kb to JSON payloads of bodyParser can be
exceeded when running modded games with researchSync. Increase the
limit to 10mb as a bandaid to fix this issue.
This is a port of 25eb5e5 .
2019-11-15 15:38:56 +01:00
Hornwitser
f4b2300d9b
Port disable uploading of mods to master by default
...
Set uploadModsToMaster to false in config.json.dist. This feature is
not necessary as the integrated mod portal in Factorio provides a better
method to synchronize mods.
This is a port of 3c5b108 .
2019-11-15 15:38:22 +01:00
Hornwitser
680d196584
Merge pull request #251 from Hornwitser/server-robustness
...
Improve handling of FactorioServer.stop()
2019-10-28 22:53:10 +01:00
Hornwitser
bdf8cd1152
Kill Factorio process if it's dected to hang
...
Send SIGKILL instead of SIGTERM when it's dectected that Factorio hangs
on shutdown. This should hopefully resolve the travis ci hanging
issuse.
2019-10-28 22:30:57 +01:00
Hornwitser
246a8031c1
Add hang detection to FactorioServer.stop()
...
Attempt to detect if the Factorio server has hanged in
FactorioServer.stop() and send a second SIGTERM if this is the case.
2019-10-28 21:58:54 +01:00
Hornwitser
a781c2f988
Wait for RCON connecting on FactorioServer.stop()
...
If the RCON client is currently in the process of connecting to the
Factorio server then wait for it to complete the connection to avoid it
emmiting out an error connecting in FactorioServer.stop().
2019-10-28 21:58:05 +01:00
Hornwitser
9082b40abd
Update rcon-client
...
Update rcon-client to 4.2.0 in order to remove workaround for issue with
rcon-client 4.1.0 that has been resolved.
2019-10-28 21:54:19 +01:00
Hornwitser
f163e6a39b
Merge pull request #250 from Hornwitser/code-cleanup
...
Code cleanup
2019-10-28 20:24:50 +01:00
Hornwitser
283d47d88b
Debug ci failure
...
Output factorio integration log to the travis log.
2019-10-28 20:04:30 +01:00
Hornwitser
be02e57012
Remove mkdirp dependency
...
Replace usage of mkdirp with fs-extra.mkdirp and remove the mkdirp
dependency and the unused mkdirp-promise dependency.
2019-10-28 19:46:22 +01:00
Hornwitser
cb8d7e240f
Remove more remanent remote map code
...
Remove JavaScript code exported on the web interface that relates to the
removed remote map plugin.
2019-10-28 19:46:22 +01:00
Hornwitser
6f5534c45b
Test for numeric strings in addItem and removeItem
...
Add tests asserting that numeric strings passed to the addItem and
removeItem methods to ItemDatabes throws.
2019-10-28 19:46:22 +01:00
Hornwitser
467249579d
Add missing changelog entry for f4ca5d9
...
Add note in the changelog describing the feature added by f4ca5d9 .
2019-10-28 19:46:22 +01:00
Hornwitser
3fdc27238b
Make _doleDivisionFactor local
...
Turn _doleDivisionFactor into a variable local to the module instead of
implicitly global.
2019-10-28 19:46:22 +01:00
Hornwitser
72b16de227
Remove logging from averaged-timeseries
...
The logging implemented in averaged-timeseries consists solely of
printing "Logging enabled!". Remove this pointless logging.
2019-10-28 19:46:22 +01:00
Hornwitser
9a2b2c9f8d
Speed up generateSSLcert test
...
Significantly speed up the generateSSLtest by reducing the bits in the
key from 2048 to 512.
2019-10-28 19:46:22 +01:00
Hornwitser
e4aae88614
Move clusterioMod specific code into the plugin
...
Move item database, tests, endpoint definitions for /api/place,
/api/remove, /api/inventory, /api/inventoryAsObject, and the web
interface view for the storage page into the clusterioMod plugin.
2019-10-28 19:46:22 +01:00
Hornwitser
bc444b79c2
Remove broken client download command
...
Remove the client download command which would download pre-releases.
The mod add command is a complete replacement for it.
2019-10-28 19:46:21 +01:00
Hornwitser
ff3fc3b94b
Remove .js suffix in require paths
...
Remove the .js suffix in require paths to make requires consistent
across the project.
2019-10-28 19:45:34 +01:00