Commit Graph

41 Commits

Author SHA1 Message Date
emizzle 7b784b9618
Missing pieces for adding log limit 2018-10-23 10:59:18 +02:00
emizzle 145f376000
Add LOG_LIMIT to limit max log response size
Re-adds the log limit feature that limits the log size coming back from embark

Also adds the log limit to other process logs (ie blockchain).
2018-10-23 10:59:18 +02:00
Pascal Precht 64d8fa3368
feat(core/processManager): introduce `processes:stop` handlers
So far, `ProcessManager` was able to only register a `process:launch` handler.
There was no way to tell `ProcessManager` how to stop processes. This hasn't
been a problem so far as most of the service processes can be started without the usage
of the `ProcessManager`, but turns out to be necessary if we want Embark UI to be able
to pick up running services.

A good example is the webserver process, which until now bypasses the `ProcessManager`
all together. The webserver sets up two event handlers to start and stop it respectively:

```
this.events.setCommandHandler('start-webserver', () => this.server.start());
this.events.setCommandHandler('stop-webserver', () => this.server.stop());
```

In the future, this should happen through the `ProcessManager` instead, so the webserver
process can be picked up by Embark UI, like this:

```
this.request('process:register', 'webserver', () => {
  this.server.start();
});

// and then

this.request('process:launch', 'webserver', () => {
  // server started
});
```

Notice that the given callback to registering a process is actually the function that
gets called to launch the process.

Having that in mind, and considering that we also need a way to stop the process through
`ProcessManager, so we don't introduce a regression, we need a way to register a stop
call back as well.

The new API introduced in this commit looks like this:

```
this.request('process:register', 'webserver', {
  launchFn: (callback) => { this.server.start(callback) },
  stopFn: (callback) => this.server.stop(callback) }
});

// and then

this.request('process:launch', 'webserver', (err, message, port) => {
  // server started
});

this.request('process:stop', 'webserver', err => {
  // server stopped
});
```

Notice that `process:register` works exactly the same way as before as well.

Another thing to notice is that all parameters emitted by the underlying process
are propagated to the outside caller, which is why `err`, `message` and `port` are
available inside the launch callback.
2018-10-23 10:57:05 +02:00
Anthony Laibe de009db74f
Use process log ids 2018-10-23 10:57:05 +02:00
emizzle 7de72cb474
Addressed PR feedback
- Created an “embark” module so that an “embark” process could be registered in the correct way. This service is only used on `embark run` (can be extended to other commands if needed).

- extracted “embark” to a const `DEFAULT_PROCESS` param in the `Console` component.

- extracted commands result rendering to it’s own function to keep the `renderTabs` function from getting cluttered

- Added sorting of logs by timestamp

- Added milliseconds to the log file data (which helps in sorting log messages).
2018-10-23 10:53:25 +02:00
emizzle 42cc9b559f
Fills embark logs tabs with existing embark logs
A logfile is now generated by default, in the format `.embark/embark-log__YYYY-MM-DD_HH-mm-ss.log`.

When the home tab is loaded, the process logs are fetched for all the processes. The list of processes returned now includes `embark`, and when `/embark-api/process-logs/embark` is fetched, the logFile is parsed and an array of log messages are returned.
2018-10-23 10:52:26 +02:00
Anthony Laibe 41176f0f70
Add id to process logs 2018-10-23 10:50:41 +02:00
Anthony Laibe 0e4248cca8
Stop and limit fetch process logs 2018-10-23 10:50:38 +02:00
Andre Medeiros 31476cf2b8
Address feedback 2018-10-23 10:48:36 +02:00
Andre Medeiros 3b45128f20
Fix the way messages are appended in logs 2018-10-23 10:47:25 +02:00
Anthony Laibe 572cd20482
Fix backend tab request cached:
- Add no cache via helmet
- Fix linting (no-return-else)
- Rebase Fix: Use option.name for process log to avoid endpoint being called
blockchainProcess.js
- Rebase Fix: use option when compiling solidity
2018-10-23 10:47:24 +02:00
Jonathan Rainville b196a54a30
fix linting 2018-10-23 10:41:22 +02:00
Jonathan Rainville 56d541fb8d
fix most rebase issues 2018-10-23 10:36:57 +02:00
Iuri Matias 7532562e28
rebase fixes 2018-10-23 10:34:46 +02:00
Anthony Laibe 1bd5174f61
Adding new reducer and selector 2018-10-23 10:27:42 +02:00
Jonathan Rainville 1ec5ee533c
conflict in actions and saga 2018-10-23 10:25:14 +02:00
Jonathan Rainville d6977507b6
add tabs for the processes 2018-10-23 10:23:44 +02:00
Jonathan Rainville 640ec0b761
change route name 2018-10-23 10:23:44 +02:00
Jonathan Rainville 459d0cc2d6
small conflicts 2018-10-23 10:23:43 +02:00
Iuri Matias 3a532a05e8
move processes into core 2018-10-23 10:15:29 +02:00
Michael Bradley, Jr f2cdd4d556
more conservative: only modify webpack's subclass of ProcessWrapper 2018-10-23 10:08:00 +02:00
Michael Bradley, Jr 0fdedf093c
env options property doesn't need to be passed to ProcessLauncher 2018-10-23 10:08:00 +02:00
Michael Bradley, Jr 54cb69f3db
propagate env 2018-10-23 10:05:25 +02:00
Iuri Matias 31a3fbef66
fixes due to bad rebase 2018-10-23 10:00:30 +02:00
Iuri Matias b3ccaa3b8a
fixes due to bad rebase 2018-10-23 09:57:47 +02:00
Iuri Matias f873a26caf
fixes due to bad rebase 2018-10-23 09:57:47 +02:00
Iuri Matias 663dac6009
move processes into core 2018-10-23 09:56:18 +02:00
Iuri Matias 95df68e67c
fixes due to bad rebase 2018-10-23 09:46:40 +02:00
Iuri Matias 6fac1f297d
fixes due to bad rebase 2018-10-23 09:42:59 +02:00
Iuri Matias c4ea6abc4b
fixes due to bad rebase 2018-10-23 09:42:59 +02:00
Iuri Matias 6d0f4b67ae
move processes into core 2018-10-23 09:41:26 +02:00
Anthony Laibe 2c30271d29 please linter 2018-09-14 10:30:20 +01:00
Anthony Laibe ab859d4ef5 Better manage default options 2018-09-14 10:17:01 +01:00
Anthony Laibe 5957be9571 Avoid Solc to die because of compilation 2018-09-06 11:24:29 +01:00
Iuri Matias 7eb52c1f8f
Merge pull request #735 from embark-framework/bugfix/allow-zero-config-blockchain
Allow zero config in blockchain
2018-08-29 17:33:15 -04:00
Anthony Laibe 23f7ec396a Allow zero config in blockchain 2018-08-27 10:06:37 +01:00
Michael Bradley, Jr 53a4fd2089 rm redundant setup of env vars 2018-08-24 15:04:16 -05:00
Anthony Laibe ecf7bfad76 Do not exit 2018-08-21 16:11:07 -04:00
Anthony Laibe b3ed3d0379 Do not hang if process crash 2018-08-21 16:11:07 -04:00
Jonathan Rainville 363608287f fixes and linting 2018-08-21 16:05:59 -04:00
Iuri Matias 29b0d01f22 move processes into core 2018-08-21 16:04:22 -04:00