Commit Graph

638 Commits

Author SHA1 Message Date
emizzle 7690418bb1
Regexp support for node 8.9.4+
Changed the log regexp to remove named capture groups as this is only supported in 10.3+.
2018-10-23 10:59:17 +02:00
Iuri Matias 65c7428a7f
comment out log code for now 2018-10-23 10:59:16 +02:00
Jonathan Rainville e6964c75cb
return error message on console error 2018-10-23 10:59:16 +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 46511bcfe8
Rebase updates
After the code was rebased, there were some additional changes for getting websockets logs that needed to be catered for.

When there is a call to get all logs for a process, the state entity is updated with a new array item containing all the logs (this is then reduced and selected for rendering). In the case of a websocket log that simply returns only one log item, the latest full log for the process is found in the state entities, and it’s logs are appending to with the data from the websocket.

Additionally, log limits were updated to be passed in as a parameter to the API calls from the frontend. Parameter validation (for `limit`) was also added in this commit.
2018-10-23 10:57:04 +02:00
emizzle d4d7e3b8ac
Addressed PR comments
*Console.js*
- Moved `DEFAULT_PROCESS` const to outside of the `Console` class (but inside the module).
- Removed `(` and `)` from `.filter` in `getProcessLogs()`.
- Updated comments

*logger.js*
- Moved `dateFormat` and `logRegex` to constants outside of `Logger` class
- Moved the `parseLogFile` method inside of the `Logger` class (ES6 style)
- Added a log limit to the `parseLogFile` method
- Added the log path to the constants file and used inside of `Logger`

*cmd_controller.js*
- Defaulted `this.context` to `[constants.context.any]` in the constructor.
- Changed `’embark’` to split modules`coreProcess` and `loggerApi`.

*engine.js*
- Changed `’embark’` to split modules`coreProcess` and `loggerApi`.
2018-10-23 10:57:04 +02:00
emizzle 0760965bda
Overwrite log file so .embark doesn’t bloat
The embark log file is being overwritten each time embark is run. There is a separate log file for each context, so that running, for example, `embark run` then `embark console` doesn’t get the `run` log overwritten with the `console` log.
2018-10-23 10:54:35 +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
Iuri Matias fd2e979f06
remove unneded console logs 2018-10-23 10:50:37 +02:00
Richard Ramos 2c0644b5cb
Changed scaffolding to service 2018-10-23 10:50:37 +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
emizzle 25297027c8
Moved ‘authenticator’ module startup to console service 2018-10-23 10:45:51 +02:00
Jonathan Rainville 422a98e172
add basic authentication 2018-10-23 10:41:22 +02:00
Jonathan Rainville b196a54a30
fix linting 2018-10-23 10:41:22 +02:00
Jonathan Rainville 3a6ed745f6
add transactionTracker to track transactions and their time 2018-10-23 10:38:13 +02:00
Anthony Laibe b945b87d4d
File explorer 2018-10-23 10:38:11 +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 83d6130259
Add plugins and versions to backend tab 2018-10-23 10:32:02 +02:00
Anthony Laibe 1bd5174f61
Adding new reducer and selector 2018-10-23 10:27:42 +02:00
Iuri Matias 7e96eb661e
define api for profiler 2018-10-23 10:27:39 +02:00
Jonathan Rainville 1ec5ee533c
conflict in actions and saga 2018-10-23 10:25:14 +02:00
Jonathan Rainville 21d8d84cca
conflict in api 2018-10-23 10:25:13 +02:00
Jonathan Rainville d6977507b6
add tabs for the processes 2018-10-23 10:23:44 +02:00
Jonathan Rainville ebf18f47a8
remove useless registerProcess function 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
Anthony Laibe 57874bac71
Use path embark-api 2018-10-23 10:22:37 +02:00
Anthony Laibe 7df9ae66f9
Add blockchain account endpoint 2018-10-23 10:22:37 +02:00
Iuri Matias 50740211da
cherry-pick features/react-routes 2018-10-23 10:21:39 +02:00
Iuri Matias 4e30ddeb1b
fix rebase issues 2018-10-23 10:21:39 +02:00
Iuri Matias ad7b0fc74e
add api registration to plugin 2018-10-23 10:21:37 +02:00
Iuri Matias 6c88ebd874
move logger api call into logger 2018-10-23 10:21:36 +02:00
Iuri Matias 8b261cbc04
add api registration to plugin 2018-10-23 10:20:09 +02:00
Iuri Matias 5de1c6e539
trigger log events for all log levels 2018-10-23 10:20:08 +02:00
Iuri Matias 3a532a05e8
move processes into core 2018-10-23 10:15:29 +02:00
Iuri Matias 30f25ef389
clean up 2018-10-23 10:14:03 +02:00
Iuri Matias bae3ee884d
move code generator to a module 2018-10-23 10:14:03 +02:00
Iuri Matias e69ec3b7f1
move proxy out of core 2018-10-23 10:14:01 +02:00
Michael Bradley, Jr c0259e3ecb
proxy -- canonicalHost, defaultHost 2018-10-23 10:14:00 +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 a1e72e38ef
re-add register upload cmd api; refactor storage module initialization 2018-10-23 10:05:20 +02:00