Summary: UDS will be removed. The first step would be to remove the TCP optionality.
Reviewed By: passy
Differential Revision: D48264741
fbshipit-source-id: ca9e1b68be61e99240e95bcd4f26f2db63a64005
Summary: To avoid the cases whereas Flipper opens up in engineer's default browser which may be different than Chrome.
Reviewed By: aigoncharov
Differential Revision: D46682220
fbshipit-source-id: 38d0ddefbc67989c5ec97a66e4a419318a66bc95
Summary:
^
In addition to logging to the console bootstrap performance metrics, track these events to scuba as well.
Reviewed By: aigoncharov
Differential Revision: D46648876
fbshipit-source-id: 191704c13158884bb8cfbca614a23f2a64f1fd93
Summary:
Add a few console logs as to highlight how long does it take for our server to start.
Additionally, do not wait until we are ready for client connections before attempting to launch. There's nothing else we do at this point. Instead, launch and wait until we are ready.
Reviewed By: passy
Differential Revision: D46639482
fbshipit-source-id: c098d229edc3cd52e5c876c509a7c81532635afa
Summary:
^
Token is no longer in the static directory. Also, we can now use a shared utility.
Reviewed By: aigoncharov
Differential Revision: D46516296
fbshipit-source-id: c38d024061653ac8b3fb587c8e3ad83dba0b151d
Summary:
^
There is an issue whereas when Flipper Server is launched NOT from the terminal, it doesn't inherit the user's terminal `$PATH` variable.
This causes a few different issues.
This change tries to address that.
Reviewed By: passy
Differential Revision: D46392435
fbshipit-source-id: 6201a1749134db8c50eca8751af149737dce57d7
Summary:
^
Basically, update Jest and fix any raised issues. Mainly:
- Update necessary dependencies
- Update snapshots
- `useFakeTimers` caused a few issues which meant that the way we hook into the performance object had to be tweaked. The main code change is: `//fbsource/xplat/sonar/desktop/scripts/jest-setup-after.tsx`
- `mocked` -> `jest.mocked`
Changelog: Update Jest to v29.5.1
Reviewed By: antonk52
Differential Revision: D46319818
fbshipit-source-id: d218ca8f7e43abac6b00844953ddeb7f4e1010a2
Summary:
Replace an existing running instance, if any.
This is useful for:
- Applying updates
- Ensuring freshness of server
Reviewed By: passy
Differential Revision: D46146814
fbshipit-source-id: bfb760f3ab26b7632510773609f1c6ca3a97c4ec
Summary:
Right now, this simply avoids trying to create a server instance if one appears to be already running.
In a future change, we may decide to kill the existing instance and replace it with a new one.
But, in this case, running this as is will be useful as it will provide the connection URL with the auth token.
Also remove flipper server dependency from finding installation. In this case, we don't need it and can use `os.getPlatform()` instead.
Reviewed By: antonk52
Differential Revision: D46144843
fbshipit-source-id: 2922843b916d37e0126e43ae65a622f87a6920ec
Summary:
Clean initialisation by passing down the environment info to start server.
(Also rename dir to path as that's the name used in other places)
Reviewed By: passy
Differential Revision: D45731751
fbshipit-source-id: a60fdd49c567fc312d1f8da72db3a46a0828c140
Summary: The isHeadlessBuild flag was not properly set.
Reviewed By: antonk52
Differential Revision: D45728435
fbshipit-source-id: 3616c4358114d4f3d96372766dabf48b27b44333
Summary:
Until now, launching flipper-server with TCP would accept any incoming connection as long as it comes from the same origin (localhost) using web socket host origin verification.
This is not entirely secure as origin can be spoofed with tools like curl.
Our team created a security review and a proposal was written:
https://docs.google.com/document/d/16iXypCQibPiner061SoaQUFUY9tLVAEpkKfV_hUXI7c/
Effectively, Flipper can generate a token which is then used by the client to authenticate.
This diff contains the changes required to generate, obtain, and validate authentication tokens from clients connecting to flipper over TCP connections.
The token itself is a JWT token. JWT was chosen because it is a simple industry standard which offers three features which can immediately benefit us:
- Expiration handling. No need for Flipper to store this information anywhere.
- Payload. Payload can be used to push any data we deem relevant i.e. unix username.
- Signing. Signed and verified using the same server key pair which is already in place for certificate exchange.
Additionally, the token is stored in the Flipper static folder. This ensures that the browser and PWA clients have access to it.
Reviewed By: mweststrate
Differential Revision: D45179654
fbshipit-source-id: 6761bcb24f4ba30b67d1511cde8fe875158d78af
Summary: Combining a bunch of individual tasks for dep upgrades into one diff.
Reviewed By: ivanmisuno
Differential Revision: D42706074
fbshipit-source-id: 054b2545ad1295699f47f4c6eb5065b7b9a1d6a0
Summary: Some plugins import from shared directories. These directories are not plugins themselves, therefore the current plugin root searching mechanism does nto work for them. To support plugin reloading for this scenario, we start re-building all plugins if we fail to find a plugin root.
Reviewed By: lblasa
Differential Revision: D39693820
fbshipit-source-id: 33dd7de4121bd5665a39b0ea96adce4603dc7df0
Summary: Now that we build all plugins at all times and it is super-fast, these options are redundant
Reviewed By: lblasa
Differential Revision: D39542723
fbshipit-source-id: 1b30ba384267ec4fd0c35b4dc14f0223ffe414c9
Summary: Watch source plugin folders and notify frontend that any of them changed. In subsequent diffs, we will start reloading plugins that changed.
Reviewed By: lblasa
Differential Revision: D39539443
fbshipit-source-id: 726916c0bce336a2c0179558526bcb1b74e35b93
Summary: Move flipper local deps to prod deps, so yarn installs them later when we build a bundle
Reviewed By: lblasa
Differential Revision: D39475545
fbshipit-source-id: 5b61d15b45ee315c3b35d8e6836c114b90503b1a
Summary: Flipper server itself requires no babel transforms. We applied extra transforms only for the bundled plugins. However, we pack and ship all plugins in the /static folder. They are always available on the FS. Therefore we could stop bundling any plugins into flipper-server's source code.
Reviewed By: lblasa
Differential Revision: D38910251
fbshipit-source-id: b3e9fe5ae2ab69ce5579b01b6793ebf7e88baf66
Summary:
flipper-server-companion depends on flipper-plugin. flipper-plugin includes dependencies that run only in a browser. Splitting flipper-plugin into core and browser packages helps to avoid including browser-only dependencies into flipper-server bundle.
As a result, bundle size could be cut in half. Subsequently, RSS usage drops as there is twice as less code to process for V8.
Note: it currently breaks external flipper-data-source package. It will be restored in subsequent diffs
Reviewed By: lblasa
Differential Revision: D38658285
fbshipit-source-id: 751b11fa9f3a2d938ce166687b8310ba8b059dee
Summary:
^
There may be cases whereas the process exits but leaks the socket descriptors.
There's already a hook to close flipper-server.
Reviewed By: passy
Differential Revision: D37550940
fbshipit-source-id: 35004969834bb92bb7cf0f56bda8d7b43c11d6bf
Summary:
CHANGELOG: Rotate flipper-server logs
Otherwise, they re going to eat up all space eventually in a one monstrous file
Reviewed By: passy
Differential Revision: D37516868
fbshipit-source-id: 478a61c56ec007e4a3d695f7e6df2a61cb33c33a
Summary:
Provide an option to enable/disable TCP connections on flipper-server.
The only change at this stage is that Flipper Desktop will use UDS to connect to flipper-server.
Reviewed By: passy
Differential Revision: D37519656
fbshipit-source-id: 3d02084666fde532ec76134edf8cf6a231060a48
Summary: CHANGELOG: Open Flipper Server at /
Reviewed By: lawrencelomax
Differential Revision: D37517406
fbshipit-source-id: 71043c3df75d9436020da477c937795671fa15a9
Summary:
^
This is an effort to capture and log these errors as to gain visibility when failures occur.
Reviewed By: passy
Differential Revision: D37412861
fbshipit-source-id: 09687a31797aac4c377aa98944ab0701bdf45466
Summary:
There's one setting: to enable or disable flipper-server.
However, I've added some current running state to it. If there's a better way of doing this, please do let me know.
Reviewed By: aigoncharov
Differential Revision: D37276670
fbshipit-source-id: f6c941cf0cfe55c267b9bcb9f799934fba1e28ef
Summary:
This change attaches our event handlers as soon as the ws is created.
As a consequence, we need to wait until the server has created any necessary instances required to process incoming requests.
To achieve this, I created a type called `Lazy`.
This type wraps around a value and a promise to that value. Callers can check if the value is set. If not, callers can wait for it.
Ultimately, the value can be set outside of the promise itself.
Reviewed By: passy
Differential Revision: D37284939
fbshipit-source-id: 17dec548d7155a3d65440c9584cec07cbb826c37
Summary:
This changes moves most of the functionality found in flipper-server to flipper-server-core.
flipper-server will mostly be a package that wraps around flipper-server-core. Staying in flipper-server:
- Command line args
- Orchestration to start the necessary servers
Reviewed By: aigoncharov
Differential Revision: D36807087
fbshipit-source-id: f29002c7cc5d08b8c5184fdaaa02ba22562a9f45
Summary:
This change extracts logging logic out from startFlipperServer.
Logs will also be written to disk.
Reviewed By: passy
Differential Revision: D36473768
fbshipit-source-id: b1df9df79b4aced0d3ba2e8c243aa8d44cf83703
Summary:
These are utility methods that are not specific to startServer.
They will be reused by other components needing to check if something is listening to a port.
Make socket path is also extracted.
Reviewed By: passy
Differential Revision: D36473641
fbshipit-source-id: 73ed67912052896696b59670cb757d22761eeaa1
Summary: Allows to attribute errors to flipper server or flipper electron
Reviewed By: passy
Differential Revision: D36698504
fbshipit-source-id: 6d07216fd05aa48b7c8cca5b53145916b64526eb
Summary:
^
flipper-server verifies the origin of incoming connections as a way of preventing any host from connecting to flipper.
That's good.
This change expand the list of allowed origins to include localhost:3000 which is the default origin for Electron apps.
Error without this change:
```
Refused socket connection from cross domain request, origin: http://localhost:3000, host: localhost:52342. Expected origins: http://localhost:52342 or http://[::1]:52342 or http://::1:52342. Expected hosts: localhost:52342 or [::1]:52342 or ::1:52342
```
Reviewed By: passy
Differential Revision: D36440363
fbshipit-source-id: 883cadb49f245bca5d0a53a4f58c08cf45dd0189
Summary:
Currently, Flipper Server has a few productions dependencies (mac-ca, node-fetch) that are not bundled with the Flipper Server. It makes it harder to distribute Flipper Server, as now all potential consumers need not only to download the bundle, but also install these additional dependencies.
This diff makes it possible to bundle `mac-ca` and `node-fetch` with Flipper Server. As a result, Flipper Server becomes dependency-free in production.
Reviewed By: lblasa
Differential Revision: D36345213
fbshipit-source-id: 2cd6ba1b3301b45dc2295891964ba020fd107586
Summary:
Same as with the previous diff.
The function doesn't really start a server. Instead it attaches the routing of messages from the existing server into FlipperServer.
Reviewed By: passy
Differential Revision: D36310703
fbshipit-source-id: 7ac9a742fb36c3806597382c9aadcf96f4770484
Summary:
^
Instead of 'start' use 'attach' as it seems closer to what the function actually does.
Reviewed By: passy
Differential Revision: D36310846
fbshipit-source-id: db90efc6ec3207b1a5a38139a3ba01d2f7d2aebd
Summary:
^
BaseServer doesn't really have any meaning. So, change it to just Server as it really creates the Express app and HTTP server attached to it.
Reviewed By: passy
Differential Revision: D36310822
fbshipit-source-id: eee5a2a395ca726679c1c4756ed58d4bc6be3cb8
Summary:
Rename 'startWebServerDev' to just 'startDevServer'.
It isn't really starting a web server though, more like installing routings and middleware to the existing created server.
Reviewed By: passy
Differential Revision: D36310765
fbshipit-source-id: 0af772012525fd7ad19e2aa6fa73cb3e7dcf2bef
Summary: Slight changes to the URL and port logging.
Reviewed By: passy
Differential Revision: D36310796
fbshipit-source-id: 553b9ce932792c471f8e0e2c1a0c7d79897ad59d
Summary: These safeguards were added based on a discussion in D35088208 (56e94394ca) but turned out to be counter-productive. Every time a client disconnects now, we're tearing down the socket and the server, allowing for no future connections.
Reviewed By: lblasa
Differential Revision: D36252605
fbshipit-source-id: c3b6f85dea4054505a47d24a72a4aac403371c0f
Summary: Start flipper-server-companion whenever a client connects to flipper-server and sets `server_companion` query parameter in a connection URL to true
Reviewed By: mweststrate
Differential Revision: D36098169
fbshipit-source-id: eb953e7d680b30aef1340f059264112387264c05
Summary: Taking care of the remaining dependabot tasks In my queue.
Reviewed By: mweststrate
Differential Revision: D36131782
fbshipit-source-id: f8a5ce18bfab7c5d50a88d64f9516d67bba4bd6d