Skip to content

Commit

Permalink
Node number in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
vsuharnikov committed Oct 28, 2024
1 parent c1b7b78 commit 5e16a31
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ trait BaseItTestSuite

protected lazy val network = Networks.network

protected lazy val ec1: EcContainer = new EcContainer(network, "ec-1", Networks.ipForNode(2)) // ipForNode(1) is assigned to Ryuk
protected lazy val ec1: EcContainer = new EcContainer(
network = network,
number = 1,
ip = Networks.ipForNode(2) // ipForNode(1) is assigned to Ryuk
)

protected lazy val waves1: WavesNodeContainer = new WavesNodeContainer(
network = network,
number = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package units.docker

import com.google.common.io.Files
import com.typesafe.config.{ConfigFactory, ConfigValueFactory}
import net.ceedubs.ficus.Ficus.toFicusConfig
import org.testcontainers.containers.BindMode
Expand All @@ -16,7 +17,12 @@ import units.el.ElBridgeClient
import units.eth.EthAddress
import units.http.OkHttpLogger

class EcContainer(network: NetworkImpl, hostName: String, ip: String) extends BaseContainer(hostName) {
import java.io.File

class EcContainer(network: NetworkImpl, number: Int, ip: String) extends BaseContainer(s"ec-$number") {
private val logFile = new File(s"$DefaultLogsDir/besu-$number.log")
Files.touch(logFile)

protected override val container = new GenericContainer(DockerImageName.parse("hyperledger/besu:latest"))
.withNetwork(network)
.withExposedPorts(RpcPort, EnginePort)
Expand All @@ -25,7 +31,7 @@ class EcContainer(network: NetworkImpl, hostName: String, ip: String) extends Ba
.withFileSystemBind(s"$ConfigsDir/besu", "/config", BindMode.READ_ONLY)
.withFileSystemBind(s"$ConfigsDir/besu/run-besu.sh", "/tmp/run.sh", BindMode.READ_ONLY)
.withFileSystemBind(s"$ConfigsDir/ec-common/p2p-key-1.hex", "/etc/secrets/p2p-key", BindMode.READ_ONLY)
.withFileSystemBind(s"$DefaultLogsDir", "/opt/besu/logs", BindMode.READ_WRITE)
.withFileSystemBind(s"$logFile", "/opt/besu/logs/besu.log", BindMode.READ_WRITE)
.withCreateContainerCmdModifier { cmd =>
cmd
.withName(s"${network.getName}-$hostName")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package units.docker

import com.google.common.io.Files
import com.wavesplatform.account.Address
import com.wavesplatform.api.NodeHttpApi
import com.wavesplatform.common.utils.Base58
Expand All @@ -11,6 +12,7 @@ import units.client.HttpChainContractClient
import units.docker.BaseContainer.{ConfigsDir, DefaultLogsDir}
import units.docker.WavesNodeContainer.ApiPort

import java.io.File
import java.nio.charset.StandardCharsets
import scala.jdk.CollectionConverters.MapHasAsJava

Expand All @@ -22,6 +24,9 @@ class WavesNodeContainer(
chainContractAddress: Address,
ecEngineApiUrl: String
) extends BaseContainer(s"wavesnode-$number") {
private val logFile = new File(s"$DefaultLogsDir/waves-$number.log")
Files.touch(logFile)

protected override val container = new GenericContainer(DockerImageName.parse(System.getProperty("cc.it.docker.image")))
.withNetwork(network)
.withExposedPorts(ApiPort)
Expand All @@ -41,7 +46,7 @@ class WavesNodeContainer(
)
.withFileSystemBind(s"$ConfigsDir/wavesnode", "/etc/waves", BindMode.READ_ONLY)
.withFileSystemBind(s"$ConfigsDir/ec-common", "/etc/secrets", BindMode.READ_ONLY)
.withFileSystemBind(s"$DefaultLogsDir", "/var/log/waves", BindMode.READ_WRITE)
.withFileSystemBind(s"$logFile", "/var/log/waves/waves.log", BindMode.READ_WRITE)
.withCreateContainerCmdModifier { cmd =>
cmd
.withName(s"${network.getName}-$hostName")
Expand Down

0 comments on commit 5e16a31

Please sign in to comment.