Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime improvements #3

Merged
merged 2 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ As with any C++ API, the header files are necessary for use.

`./racesdk/package/LINUX*/` will be `./racesdk/package/ANDROID*/` when building for Android.


## Testing using race-cli
See race-email channel README.md for examples

Expand All @@ -40,6 +39,7 @@ NOTE: see `FileSystem::makePluginInstallBasePath()` for path requirements of whe
NOTE: `--param hostname=localhost` does not work in this test. You can use the ip addresses reported from ifconfig on both nodes.
### server
```bash

docker run -it -v $(pwd):/code/ -v /tmp/:/tmp/ race-sdk:latest bash
cp -r /code/private-race-core/plugin-comms-twosix-cpp/kit/artifacts/linux-arm64-v8a-server/PluginCommsTwoSixStub/* /tmp/race/plugins/unix/arm64-v8a/PluginCommsTwoSixStub
ln -s /code/private-raceboat/build/LINUX_arm64-v8a/source/libraceboat.so /usr/local/lib/raceSdkCommon.so
Expand Down Expand Up @@ -74,3 +74,33 @@ cmake --build --preset=LINUX_x86_64 --target check_format -j

## APIs
See CommPluginDeveloperGuide.md in the `race-docs` repository for information about working with Comms plugins.


## Updated Running Instructions
Work-in-progress as we make small tweaks/improvements to the race-cli user experience.

___Preliminaries:___
This approach volume-mounts plugin(s) of the appropriate architecture, so "path/to/plugin" would look something like: `/your/path/to/race-core/plugin-comms-twosix-cpp/kit/artifacts/linux-arm64-v8a-server/` to use channels from PluginCommsTwoSixStub on an arm64-v8a host.

### Server:

```bash
docker run --rm -it --name=rbserv \
--network=rib-overlay-network --ip=10.11.1.2 \
-v /path/to/plugin:/kits \
raceboat:latest bash

echo "Hello from the Raceboat Server!" | race-cli --dir /kits -m --recv-reply --send-channel twoSixDirectCpp --recv-channel twoSixDirectCpp --param hostname="10.11.1.2" --param PluginCommsTwoSixStub.startPort=26262 --param PluginCommsTwoSixStub.endPort=26264
```

### Client:

```bash
docker run --rm -it --name=raceboat-client \
--network=rib-overlay-network --ip=10.11.1.3 \
-v /path/to/plugin:/kits \
raceboat:latest bash

echo "Hi, I'm the client!" | race-cli --dir /kits -m --send-recv --send-channel twoSixDirectCpp --recv-channel twoSixDirectCpp --param hostname="10.11.1.3" --param PluginCommsTwoSixStub.startPort=26262 --param PluginCommsTwoSixStub.endPort=26264 --send-address="{\"hostname\":\"10.11.1.2\",\"port\":26262}"

```
6 changes: 4 additions & 2 deletions docker-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

# TODO: from race-compile:main once arm platform supported
FROM --platform=$TARGETPLATFORM ghcr.io/tst-race/race-images/race-compile:initial-image-setup as base
FROM --platform=$TARGETPLATFORM ghcr.io/tst-race/race-images/race-runtime-linux:main as base
LABEL maintainer="Two Six Labs <[email protected]>"

ARG TARGETARCH
Expand All @@ -33,6 +33,7 @@ FROM base as amd64-linux
COPY racesdk/package/LINUX_x86_64/lib /linux/x86_64/lib
RUN ln -s /linux/x86_64/lib/libraceboat.so /linux/x86_64/lib/libraceSdkCommon.so
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/linux/x86_64/lib"
COPY build/LINUX_x86_64/app/race-cli/race-cli /usr/local/bin/race-cli

# preserve include structure assumed by go SWIG
RUN mkdir -p /linux/x86_64/include/race/common
Expand All @@ -43,8 +44,9 @@ COPY racesdk/package/LINUX_x86_64/go /usr/local/go
# arm64 linux
FROM base as arm64-linux
COPY racesdk/package/LINUX_arm64-v8a/lib /linux/arm64-v8a/lib
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/linux/arm64-v8a/lib"
RUN ln -s /linux/arm64-v8a/lib/libraceboat.so /linux/arm64-v8a/lib/libraceSdkCommon.so
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/linux/arm64-v8a/lib"
COPY build/LINUX_arm64-v8a/app/race-cli/race-cli/ /usr/local/bin/race-cli

# preserve include structure assumed by go SWIG
RUN mkdir -p /linux/arm64-v8a/include/race/common
Expand Down
5 changes: 3 additions & 2 deletions source/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ std::vector<fs::path> FileSystem::listInstalledPluginDirs() {
}

fs::path FileSystem::makePluginInstallBasePath() {
fs::path basePath =
pluginsInstallPath / "plugins" / getHostOsType() / getHostArch();
fs::path basePath = pluginsInstallPath;
// Previously:
// pluginsInstallPath / "plugins" / getHostOsType() / getHostArch();
createDirectories(basePath);
return basePath;
}
Expand Down
Loading