Skip to content

Commit

Permalink
document service script runner usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpe7s committed Sep 29, 2024
1 parent 65de173 commit 1c394ff
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
8 changes: 2 additions & 6 deletions runService.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ set -e
readonly targetJavaVersion=23
simpleProjectName="solana"
moduleName="software.sava.solana_services"
configProperty="$moduleName.LookupTableServiceConfig"
package="software.sava.services.solana.accounts.lookup"
mainClass="$package.http.LookupTableWebService"
mainClass="software.sava.services.solana.accounts.lookup.http.LookupTableWebService"

jvmArgs="-server -XX:+DisableExplicitGC -XX:+UseZGC -Xms8G -Xmx13G"
logLevel="INFO";
Expand All @@ -31,10 +29,8 @@ do
esac
;;

cp | configProperty) configProperty="$val";;
mc | mainClass) mainClass="$val";;
mn | moduleName) moduleName="$val";;
p | package) package="$val";;
spn | simpleProjectName) simpleProjectName="$val";;

jvm | jvmArgs) jvmArgs="$val";;
Expand Down Expand Up @@ -65,7 +61,7 @@ fi
javaExe="$(pwd)/$simpleProjectName/build/$simpleProjectName/bin/java"
readonly javaExe

jvmArgs="$jvmArgs -D$moduleName.logLevel=$logLevel -D$configProperty=$configFile -m $moduleName/$mainClass"
jvmArgs="$jvmArgs -D$moduleName.logLevel=$logLevel -D$moduleName.config=$configFile -m $moduleName/$mainClass"
IFS=' ' read -r -a jvmArgsArray <<< "$jvmArgs"

set -x
Expand Down
17 changes: 15 additions & 2 deletions solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,24 @@ Pass any JVM options you prefer to the container as well as the `-m module/main_
```shell
docker run --rm \
--name table_service \
--memory 14g \
--memory 13g \
--publish 4242:4242 \
--mount type=bind,source="$(pwd)"/solana/configs/LookupTableService.json,target=/sava/config.json,readonly \
--mount source=sava-solana-table-cache,target=/sava/.sava/solana/table_cache \
lookup_table_service:latest \
-server -XX:+UseZGC -Xms8G -Xmx13G \
-server -XX:+UseZGC -Xms7G -Xmx12G \
-m "software.sava.solana_services/software.sava.services.solana.accounts.lookup.http.LookupTableWebService"
```

### Script Runner

Compiles a minimal executable JVM and facilitates passing runtime arguments.

```shell
./runService.sh \
--simpleProjectName="solana" \
--configFile="./solana/configs/LookupTableService.json" \
--moduleName="software.sava.solana_services" \
--mainClass="software.sava.services.solana.accounts.lookup.http.LookupTableWebService" \
--jvmArgs="-server -XX:+UseZGC -Xms8G -Xmx13G"
```
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static LookupTableServiceConfig loadConfig(final Path serviceConfigFile,
}

public static LookupTableServiceConfig loadConfig(final HttpClient httpClient) {
final var moduleNameConfigProperty = LookupTableServiceConfig.class.getModule().getName() + ".LookupTableServiceConfig";
final var moduleNameConfigProperty = LookupTableServiceConfig.class.getModule().getName() + ".config";
final var propertyValue = System.getProperty(moduleNameConfigProperty);
final Path serviceConfigFile;
if (propertyValue == null || propertyValue.isBlank()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ protected void handlePost(final HttpExchange exchange,
if (encoding == null) {
return;
}

final boolean accountsOnly = accountsOnly(exchange);

final byte[] txBytes = encoding.decode(body);
Expand Down

0 comments on commit 1c394ff

Please sign in to comment.