Skip to content

Commit

Permalink
RTView: shorter name for app.
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Shevchenko committed Sep 23, 2020
1 parent d6543d6 commit ec55687
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion app/cardano-rt-view.hs
Expand Up @@ -13,4 +13,4 @@ main = do
where
rtViewInfo :: ParserInfo RTViewParams
rtViewInfo = info (parseRTViewParams <**> helper)
(fullDesc <> header "cardano-rt-view-service - real-time view for cardano node.")
(fullDesc <> header "cardano-rt-view - real-time view for cardano node.")
2 changes: 1 addition & 1 deletion cardano-rt-view.cabal
Expand Up @@ -76,7 +76,7 @@ library
-Wpartial-fields
-Wcompat

executable cardano-rt-view-service
executable cardano-rt-view
hs-source-dirs: app
main-is: cardano-rt-view.hs
default-language: Haskell2010
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Expand Up @@ -26,7 +26,7 @@ let

# Grab the executable component of our package.
inherit (haskellPackages.cardano-rt-view.components.exes)
cardano-rt-view-service;
cardano-rt-view;
inherit (haskellPackages.cardano-rt-view.identifier) version;

# `tests` are the test suites which have been built.
Expand Down
6 changes: 3 additions & 3 deletions nix/darwin-release.nix
@@ -1,5 +1,5 @@
############################################################################
# Darwin release cardano-rt-view-service-*.zip
# Darwin release cardano-rt-view-*.zip
#
# This bundles up the macOS executable with its dependencies
# and static directory. Result is *.zip file.
Expand All @@ -14,8 +14,8 @@

let
lib = pkgs.lib;
name = "cardano-rt-view-service-${project.version}-darwin";
rtViewServiceExe = lib.head (lib.filter (exe: lib.hasInfix "cardano-rt-view-service" exe.name) exes);
name = "cardano-rt-view-${project.version}-darwin";
rtViewServiceExe = lib.head (lib.filter (exe: lib.hasInfix "cardano-rt-view" exe.name) exes);

in pkgs.runCommand name {
buildInputs = with pkgs.buildPackages; [
Expand Down
8 changes: 4 additions & 4 deletions nix/linux-release.nix
@@ -1,8 +1,8 @@
############################################################################
# Linux release cardano-rt-view-service-*.AppImage
# Linux release cardano-rt-view-*.tar.gz
#
# This bundles up the linux executable with its dependencies
# and static directory. Result is *.AppImage file.
# and static directory. Result is *.tar.gz archive.
#
############################################################################

Expand All @@ -14,8 +14,8 @@

let
lib = pkgs.lib;
name = "cardano-rt-view-service-${project.version}-linux-x86_64";
rtViewServiceExe = lib.head (lib.filter (exe: lib.hasInfix "cardano-rt-view-service" exe.name) exes);
name = "cardano-rt-view-${project.version}-linux-x86_64";
rtViewServiceExe = lib.head (lib.filter (exe: lib.hasInfix "cardano-rt-view" exe.name) exes);

in pkgs.runCommand name {
buildInputs = with pkgs.buildPackages; [
Expand Down
6 changes: 3 additions & 3 deletions nix/windows-release.nix
@@ -1,5 +1,5 @@
############################################################################
# Windows release cardano-rt-view-service-*.zip
# Windows release cardano-rt-view-*.zip
#
# This bundles up the windows executable with its dependencies
# and static directory.
Expand All @@ -14,8 +14,8 @@

let
lib = pkgs.lib;
name = "cardano-rt-view-service-${project.version}-win64";
rtViewServiceExe = lib.head (lib.filter (exe: lib.hasInfix "cardano-rt-view-service" exe.name) exes);
name = "cardano-rt-view-${project.version}-win64";
rtViewServiceExe = lib.head (lib.filter (exe: lib.hasInfix "cardano-rt-view" exe.name) exes);

in pkgs.runCommand name {
buildInputs = with pkgs.buildPackages; [
Expand Down
12 changes: 6 additions & 6 deletions release.nix
Expand Up @@ -90,17 +90,17 @@ let
in (mapTestOn (__trace (__toJSON filteredBuilds) filteredBuilds));
musl64 = mapTestOnCross musl64 (packagePlatformsCross (filterProject noMusl64Build));
"${mingwW64.config}" = mapTestOnCross mingwW64 (packagePlatformsCross (filterProject noCrossBuild));
cardano-rt-view-service-win64-release = import ./nix/windows-release.nix {
cardano-rt-view-win64-release = import ./nix/windows-release.nix {
inherit pkgs project;
exes = collectJobs jobs.${mingwW64.config}.exes.cardano-rt-view;
staticDir = ./static;
};
cardano-rt-view-service-linux-release = import ./nix/linux-release.nix {
cardano-rt-view-linux-release = import ./nix/linux-release.nix {
inherit pkgs project;
exes = collectJobs jobs.musl64.exes.cardano-rt-view;
staticDir = ./static;
};
cardano-rt-view-service-darwin-release = import ./nix/darwin-release.nix {
cardano-rt-view-darwin-release = import ./nix/darwin-release.nix {
inherit (pkgsFor "x86_64-darwin") pkgs;
inherit project;
exes = filter (p: p.system == "x86_64-darwin") (collectJobs jobs.native.exes.cardano-rt-view);
Expand All @@ -110,9 +110,9 @@ let
(collectJobs jobs.native.checks)
(collectJobs jobs.native.benchmarks)
(collectJobs jobs.native.exes)
(optional windowsBuild jobs.cardano-rt-view-service-win64-release)
(optional linuxBuild jobs.cardano-rt-view-service-linux-release)
(optional darwinBuild jobs.cardano-rt-view-service-darwin-release)
(optional windowsBuild jobs.cardano-rt-view-win64-release)
(optional linuxBuild jobs.cardano-rt-view-linux-release)
(optional darwinBuild jobs.cardano-rt-view-darwin-release)
]));

in jobs
14 changes: 7 additions & 7 deletions src/Cardano/RTView/Config.hs
Expand Up @@ -52,7 +52,7 @@ import Cardano.RTView.CLI (RTViewParams (..), defaultRTViewParams, def
-- 2. By providing configuration explicitly. If `--config`, `--static` and `--port`
-- options are provided, these values will be used (interactive dialog will be skipped).
-- 3. By using the last used configuration. If the user already launched
-- `cardano-rt-view-service` previously, the configuration was stored in
-- `cardano-rt-view` previously, the configuration was stored in
-- user's local directory (different for each supported platform),
-- and by default that configuration will be used again.
prepareConfigAndParams
Expand Down Expand Up @@ -80,7 +80,7 @@ prepareConfigAndParams params' = do
configFileIsProvided :: RTViewParams -> Bool
configFileIsProvided params = not . null $ rtvConfig params

-- | Reads the service' configuration file (path is passed via '--config' CLI option).
-- | Reads the program's configuration file (path is passed via '--config' CLI option).
readConfigFile :: FilePath -> IO Configuration
readConfigFile pathToConfig = setup pathToConfig `catch` exceptHandler
where
Expand All @@ -98,7 +98,7 @@ readRTViewParamsFile pathToParams =
<> pathToParams <> ", exception: " <> show e
Right (params :: RTViewParams) -> return params

-- | If `cardano-rt-view-service` already ws used on this computer,
-- | If `cardano-rt-view` already ws used on this computer,
-- the configuration was saved in user's local directory, which
-- differs on different platforms.
savedConfigurationFile :: IO FilePath
Expand Down Expand Up @@ -150,7 +150,7 @@ startDialogToPrepareConfig = do
<> showDefaultNodesNames nodesNumber <> "\"): "
nodesNames <- askAboutNodesNames nodesNumber

TIO.putStrLn $ "Indicate the port for the web service (" <> show minimumPort
TIO.putStrLn $ "Indicate the port for the web server (" <> show minimumPort
<> " - " <> show maximumPort <> ", default is "
<> show defaultRTVPort <> "): "
port <- askAboutWebPort
Expand All @@ -168,7 +168,7 @@ startDialogToPrepareConfig = do
<> show defaultFirstPortForSockets <> "): "
askAboutFirstPortForSockets nodesNumber

TIO.putStrLn $ "Indicate the directory with static content for the web service, default is \""
TIO.putStrLn $ "Indicate the directory with static content for the web server, default is \""
<> T.pack defaultRTVStatic <> "\":"
staticDir <- askAboutStaticDir

Expand Down Expand Up @@ -303,7 +303,7 @@ askAboutWebPort = do
<> show maximumPort <> ": "
askAboutWebPort
else do
TIO.putStrLn $ "Ok, the service will be listening on http://127.0.0.1:" <> show port
TIO.putStrLn $ "Ok, the server will be listening on http://127.0.0.1:" <> show port
return port

data ConnectionWay
Expand Down Expand Up @@ -414,7 +414,7 @@ saveRTViewParamsForNextSessions params = do
path <- savedRTViewParamsFile
encodeFile path params

-- | RTView service requires at least one |TraceAcceptor|.
-- | RTView requires at least one |TraceAcceptor|.
checkIfTraceAcceptorIsDefined
:: Configuration
-> IO [RemoteAddrNamed]
Expand Down
30 changes: 15 additions & 15 deletions test/README.md
Expand Up @@ -5,11 +5,11 @@
RTView is a separate process that receives `LogObject`s from another process (for example, `cardano-node`) and displays them on HTML-page. It can be shown like this:

```
Process 1 Process 2 Process 3
+--------------+ [LogObject] +-------------------------+ web-requests +-------------+
| cardano-node | ------------> | cardano-rt-view-service | <-------------- | web browser |
+--------------+ +-------------------------+ --------------> +-------------+
HTML-page
Process 1 Process 2 Process 3
+--------------+ [LogObject] +-----------------+ web-requests +-------------+
| cardano-node | ------------> | cardano-rt-view | <-------------- | web browser |
+--------------+ +-----------------+ --------------> +-------------+
HTML-page
```

To test it automatically, we use additional scripts and programs:
Expand All @@ -20,19 +20,19 @@ To test it automatically, we use additional scripts and programs:
It can be shown like this:

```
Process 1 Process 2
+-----------+ [LogObject] +-------------------------+ web-requests +----------+
logObjects.json --> | sender.sh | ------------> | cardano-rt-view-service | <-------------- | analyzer |
+-----------+ +-------------------------+ --------------> +----------+
HTML-page
Process 1 Process 2
+-----------+ [LogObject] +-----------------+ web-requests +----------+
logObjects.json --> | sender.sh | ------------> | cardano-rt-view | <-------------- | analyzer |
+-----------+ +-----------------+ --------------> +----------+
HTML-page
```

Please note that `analyzer` doesn't analyze RTView UI (complete HTML-page) by itself. Instead, it launches the real web browser and use it to analyze the page automatically, using Selenium standalone server and `webdriver` package. It can be shown like this:

```
+----------+ +-------------+ +---------+ web-commands +-------------------------+
| analyzer | ----> | GeckoDriver | ----> | Firefox | -------------> | cardano-rt-view-service |
+----------+ +-------------+ +---------+ +-------------------------+
+----------+ +-------------+ +---------+ web-commands +-----------------+
| analyzer | ----> | GeckoDriver | ----> | Firefox | -------------> | cardano-rt-view |
+----------+ +-------------+ +---------+ +-----------------+
\
\ +-----------------+
`-------> | Selenium server |
Expand All @@ -44,7 +44,7 @@ Please note that `analyzer` doesn't analyze RTView UI (complete HTML-page) by it
Please make sure you have these commands in your `PATH`:

1. `jq` to minimize predefined JSON-file with `LogObject`s.
2. `nc` to send `LogObject`s from predefined JSON-file to `cardano-rt-view-service` (via UNIX socket).
2. `nc` to send `LogObject`s from predefined JSON-file to `cardano-rt-view` (via UNIX socket).
3. `firefix` to interact with RTView UI (complete HTML-page),
4. `geckodriver` to interact with Firefox,
5. `java` to launch `selenium-server-standalone`.
Expand All @@ -55,7 +55,7 @@ Please note that you have to provide full path to `selenium-server-standalone` f

Run `./runTest.sh <options> PATH_TO_SELENIUM_SERVER_JAR` script which launches:

1. `cardano-rt-view-service` process (in the background),
1. `cardano-rt-view` process (in the background),
2. `sender.sh` script,
3. `selenium-server-standalone` process (in the background),
4. `analyzer` process.
Expand Down
2 changes: 1 addition & 1 deletion test/rt-view-analyzer/src/Main.hs
Expand Up @@ -25,7 +25,7 @@ main = do
(nodeName, unixSocket) <- getAcceptorInfoFrom rtViewConfig

runSession wdConfig . closeOnException $ do
-- We always test cardano-rt-view-service launched locally, so we only need a web port.
-- We always test cardano-rt-view launched locally, so we only need a web port.
let rtViewPageURL = "http://127.0.0.1:" <> show rtViewWebPort
openPage rtViewPageURL
waitFor 2 Seconds
Expand Down
10 changes: 5 additions & 5 deletions test/runTest.sh
Expand Up @@ -5,7 +5,7 @@
BASEDIR=$(realpath $(dirname "$0"))
. "${BASEDIR}"/../../scripts/common.sh

prebuild 'cardano-rt-view-service' || exit 1
prebuild 'cardano-rt-view' || exit 1
prebuild 'rt-view-analyzer' || exit 1

set -e
Expand All @@ -14,15 +14,15 @@ readonly JSON_WITH_LOG_OBJECTS=logObjects.json
readonly UNIX_SOCKET=./logs/rt-view-pipe-0
readonly SELENIUM_SERVER_JAR=$1

readonly RT_VIEW_EXE=cardano-rt-view-service
readonly RT_VIEW_EXE=cardano-rt-view
readonly RT_VIEW_CONFIG=rt-view-config.yaml
readonly RT_VIEW_STATIC_DIR=../static
readonly RT_VIEW_WEB_PORT=8024

echo "Remove old UNIX-socket..."
rm -f "${UNIX_SOCKET}"

echo "Launch cardano-rt-view-service..."
echo "Launch cardano-rt-view..."
run "${RT_VIEW_EXE}" --config "${RT_VIEW_CONFIG}" \
--static "${RT_VIEW_STATIC_DIR}" \
--port "${RT_VIEW_WEB_PORT}" &
Expand All @@ -49,11 +49,11 @@ sleep 1
kill ${PID_SELENIUM}
sleep 1

## Stop cardano-rt-view-service.
## Stop cardano-rt-view.
kill $(pgrep -f ${RT_VIEW_EXE})
sleep 1

# Remove cardano-rt-view-service' logs.
# Remove cardano-rt-view' logs.
rm -rf logs

# Remove nohup artifacts
Expand Down

0 comments on commit ec55687

Please sign in to comment.