Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot committed Sep 25, 2024
1 parent bd0a249 commit b5a99aa
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 54 deletions.
3 changes: 1 addition & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ENV WVLOG=/var/log/waves
ENV WAVES_INSTALL_PATH=/usr/share/waves
ENV WAVES_CONFIG=/etc/waves/waves.conf
COPY target /tmp/
COPY waves.conf.template $WAVES_CONFIG

# Setup node
COPY entrypoint.sh $WAVES_INSTALL_PATH/bin/entrypoint.sh
Expand Down Expand Up @@ -41,4 +40,4 @@ WORKDIR $WVDATA
HEALTHCHECK CMD curl -f http://localhost:6869/node/status || exit 1

STOPSIGNAL SIGINT
ENTRYPOINT ["/usr/share/waves/bin/entrypoint.sh"]
ENTRYPOINT ["${WAVES_INSTALL_PATH}/bin/entrypoint.sh"]
38 changes: 19 additions & 19 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@ It is highly recommended to read more about [Waves Node configuration](https://d

## Running Docker image



### Configuration options

1. The image supports Waves Node config customization. To change a config field use corresponding JVM options. JVM options can be sent to JVM using `JAVA_OPTS` environment variable. Please refer to ([complete configuration file](https://github.com/wavesplatform/Waves/blob/master/node/src/main/resources/application.conf)) to get the full path of the configuration item you want to change.

```
docker run -v /docker/waves/waves-data:/var/lib/waves -v /docker/waves/waves-config:/etc/waves -p 6869:6869 -p 6862:6862 -e JAVA_OPTS="-Dwaves.rest-api.enable=yes -Dwaves.wallet.password=myWalletSuperPassword" -ti wavesplatform/wavesnode
```
```
docker run -v /docker/waves/waves-data:/var/lib/waves -v /docker/waves/waves-config:/etc/waves -p 6869:6869 -p 6862:6862 -e JAVA_OPTS="-Dwaves.rest-api.enable=yes -Dwaves.wallet.password=myWalletSuperPassword" -ti wavesplatform/wavesnode
```
2. Waves Node is looking for a config in the directory `/etc/waves/waves.conf` which can be mounted using Docker volumes. During image build, a default configuration will be copied to this directory. While running container if the value of `WAVES_NETWORK` is not `mainnet`, `testnet` or `stagenet`, default configuration won't be enough for correct node working. This is a scenario of using `CUSTOM` network - correct configuration must be provided when running container. If you use `CUSTOM` network and `/etc/waves/waves.conf` is NOT found Waves Node container will exit.
3. By default, `/etc/waves/waves.conf` config includes `/etc/waves/local.conf`. Custom `/etc/waves/local.conf` can be used to override default config entries. Custom `/etc/waves/waves.conf` can be used to override or the whole configuration. For additional information about Docker volumes mapping please refer to `Managing data` item.
3. You can use custom config to override or the whole configuration. For additional information about Docker volumes mapping please refer to `Managing data` item.
4. You can override the default executable by using the following syntax:
```
docker run -it wavesplatform/wavesnode [command] [args]
```
```
docker run -it wavesplatform/wavesnode [command] [args]
```
### Environment variables
**You can run container with predefined environment variables:**

| Env variable | Description |
|-----------------------------------|--------------|
| `WAVES_WALLET_SEED` | Base58 encoded seed. Overrides `-Dwaves.wallet.seed` JVM config option. |
| `WAVES_WALLET_PASSWORD` | Password for the wallet file. Overrides `-Dwaves.wallet.password` JVM config option. |
| `WAVES_LOG_LEVEL` | Node logging level. Available values: `OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`. More details about logging are available [here](https://docs.waves.tech/en/waves-node/logging-configuration).|
| `WAVES_HEAP_SIZE` | Default Java Heap Size limit in -X Command-line Options notation (`-Xms=[your value]`). More details [here](https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html). |
|`WAVES_NETWORK` | Waves Blockchain network. Available values are `mainnet`, `testnet`, `stagenet`.|
|`JAVA_OPTS` | Additional Waves Node JVM configuration options. |
The following environment variables can be passed to the container:
**Note: All variables are optional.**
| Env variable | Description |
|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `WAVES_WALLET_SEED` | Base58 encoded seed, sets `-Dwaves.wallet.seed` system property. |
| `WAVES_WALLET_PASSWORD` | Password for the wallet file, sets `-Dwaves.wallet.password` system property. |
| `WAVES_LOG_LEVEL` | Node stdout logging level. Available values: `OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`. More details about logging are available [here](https://docs.waves.tech/en/waves-node/logging-configuration). |
| `WAVES_HEAP_SIZE` | Default Java Heap Size limit in -X Command-line Options notation (`-Xmx=[your value]`). More details [here](https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html). |
| `WAVES_NETWORK` | Waves Blockchain network. Available values are `mainnet`, `testnet`, `stagenet`. |
| `JAVA_OPTS` | Additional Waves Node JVM configuration options. |
**Note: Environment variables override values in the configuration file.**
All environment variables are optional, however you need to specify at least the desired network and wallet password (via environment variables, additional system properties defined in the `JAVA_OPTS` environment variable, or in the config file).
### Managing data
We recommend to store the blockchain state as well as Waves configuration on the host side. As such, consider using Docker volumes mapping to map host directories inside the container:
Expand Down
36 changes: 16 additions & 20 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
#!/bin/bash
shopt -s nullglob

logEcho() {
echo $1 | gosu waves tee -a /var/log/waves/waves.log
}
JAVA_OPTS="${JAVA_OPTS} -Dwaves.defaults.blockchain.type=$WAVES_NETWORK -Dwaves.defaults.directory=$WVDATA"

logEcho "Node is starting..."
logEcho "WAVES_HEAP_SIZE='${WAVES_HEAP_SIZE}'"
logEcho "WAVES_LOG_LEVEL='${WAVES_LOG_LEVEL}'"
logEcho "JAVA_OPTS='${JAVA_OPTS}'"

JAVA_OPTS="-Dlogback.stdout.level=${WAVES_LOG_LEVEL}
-XX:+ExitOnOutOfMemoryError
JAVA_OPTS="-XX:+ExitOnOutOfMemoryError
-Xmx${WAVES_HEAP_SIZE}
-Dlogback.file.directory=$WVLOG
-Dconfig.override_with_env_vars=true
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
-Dlogback.stdout.level=${WAVES_LOG_LEVEL}
-Dlogback.file.directory=${WVLOG}
-Dwaves.config.directory=/etc/waves
-Dwaves.defaults.blockchain.type=${WAVES_NETWORK}
-Dwaves.directory=${WVDATA}
-Dwaves.rest-api.bind-address=0.0.0.0
${JAVA_OPTS}"

if [ $# -eq 0 ]
then
ARGS="$WAVES_CONFIG"
else
ARGS=$@
echo "JAVA_OPTS=${JAVA_OPTS}" | tee -a ${WVLOG}/waves.log

if [ -n ${WAVES_WALLET_SEED} ] ; then
JAVA_OPTS="-Dwaves.wallet.seed=${WAVES_WALLET_SEED} ${JAVA_OPTS}"
fi

if [ -n ${WAVES_WALLET_PASSWORD} ] ; then
JAVA_OPTS="-Dwaves.wallet.password=${WAVES_WALLET_PASSWORD} ${JAVA_OPTS}"
fi

exec java $JAVA_OPTS -cp "${WAVES_INSTALL_PATH}/lib/plugins/*:$WAVES_INSTALL_PATH/lib/*" com.wavesplatform.Application $ARGS
10 changes: 0 additions & 10 deletions docker/waves.conf.template

This file was deleted.

2 changes: 1 addition & 1 deletion node/src/main/scala/com/wavesplatform/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ object Application extends ScorexLogging {
.map(_.toUpperCase)
.getOrElse("TESTNET")

log.warn(s"Config file not defined, default $currentBlockchainType config will be used")
log.info(s"Config file not specified, default $currentBlockchainType config will be used")
case Failure(exception) =>
log.error(s"Couldn't read ${external.get.toPath.toAbsolutePath}", exception)
forceStopApplication(Misconfiguration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ class UtilsRouteSpec extends RouteSpec("/utils") with RestAPISettingsHelper with
|{-# CONTENT_TYPE DAPP #-}
|{-# SCRIPT_TYPE ACCOUNT #-}
|
|let looooooooooooooooooooooooongName = base58'${"a" * 3602}'
|${(1 to 18).map(i => s"let a$i = base58'${"a" * 12200}'").mkString("\n")}
|let looooooooooooooooooooooooongName = base64'${"A" * 3518}' # 2640 bytes
|${(1 to 18).map(i => s"let a$i = base64'${"A" * 11912}'").mkString("\n")} # 18 * 8934 bytes
|func test() = looooooooooooooooooooooooongName == looooooooooooooooooooooooongName
""".stripMargin

Expand Down

0 comments on commit b5a99aa

Please sign in to comment.