mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-04 03:03:48 +01:00
Install call rate metering config file before startup
Copy the config file at --callRateMeteringConfigPath to each daemon's appDataDir, where it will be detected at server startup.
This commit is contained in:
parent
56a5c7938d
commit
d5657e9760
1 changed files with 30 additions and 5 deletions
|
@ -154,7 +154,8 @@ public class Scaffold {
|
||||||
try {
|
try {
|
||||||
log.info("Shutting down executor service ...");
|
log.info("Shutting down executor service ...");
|
||||||
executor.shutdownNow();
|
executor.shutdownNow();
|
||||||
executor.awaitTermination(config.supportingApps.size() * 2000, MILLISECONDS);
|
//noinspection ResultOfMethodCallIgnored
|
||||||
|
executor.awaitTermination(config.supportingApps.size() * 2000L, MILLISECONDS);
|
||||||
|
|
||||||
SetupTask[] orderedTasks = new SetupTask[]{
|
SetupTask[] orderedTasks = new SetupTask[]{
|
||||||
bobNodeTask, aliceNodeTask, arbNodeTask, seedNodeTask, bitcoindTask};
|
bobNodeTask, aliceNodeTask, arbNodeTask, seedNodeTask, bitcoindTask};
|
||||||
|
@ -218,20 +219,25 @@ public class Scaffold {
|
||||||
if (copyBitcoinRegtestDir.run().getExitStatus() != 0)
|
if (copyBitcoinRegtestDir.run().getExitStatus() != 0)
|
||||||
throw new IllegalStateException("Could not install bitcoin regtest dir");
|
throw new IllegalStateException("Could not install bitcoin regtest dir");
|
||||||
|
|
||||||
|
String aliceDataDir = daoSetupDir + "/" + alicedaemon.appName;
|
||||||
BashCommand copyAliceDataDir = new BashCommand(
|
BashCommand copyAliceDataDir = new BashCommand(
|
||||||
"cp -rf " + daoSetupDir + "/" + alicedaemon.appName
|
"cp -rf " + aliceDataDir + " " + config.rootAppDataDir);
|
||||||
+ " " + config.rootAppDataDir);
|
|
||||||
if (copyAliceDataDir.run().getExitStatus() != 0)
|
if (copyAliceDataDir.run().getExitStatus() != 0)
|
||||||
throw new IllegalStateException("Could not install alice data dir");
|
throw new IllegalStateException("Could not install alice data dir");
|
||||||
|
|
||||||
|
String bobDataDir = daoSetupDir + "/" + bobdaemon.appName;
|
||||||
BashCommand copyBobDataDir = new BashCommand(
|
BashCommand copyBobDataDir = new BashCommand(
|
||||||
"cp -rf " + daoSetupDir + "/" + bobdaemon.appName
|
"cp -rf " + bobDataDir + " " + config.rootAppDataDir);
|
||||||
+ " " + config.rootAppDataDir);
|
|
||||||
if (copyBobDataDir.run().getExitStatus() != 0)
|
if (copyBobDataDir.run().getExitStatus() != 0)
|
||||||
throw new IllegalStateException("Could not install bob data dir");
|
throw new IllegalStateException("Could not install bob data dir");
|
||||||
|
|
||||||
log.info("Installed dao-setup files into {}", buildDataDir);
|
log.info("Installed dao-setup files into {}", buildDataDir);
|
||||||
|
|
||||||
|
if (!config.callRateMeteringConfigPath.isEmpty()) {
|
||||||
|
installCallRateMeteringConfiguration(aliceDataDir);
|
||||||
|
installCallRateMeteringConfiguration(bobDataDir);
|
||||||
|
}
|
||||||
|
|
||||||
// Copy the blocknotify script from the src resources dir to the build
|
// Copy the blocknotify script from the src resources dir to the build
|
||||||
// resources dir. Users may want to edit comment out some lines when all
|
// resources dir. Users may want to edit comment out some lines when all
|
||||||
// of the default block notifcation ports being will not be used (to avoid
|
// of the default block notifcation ports being will not be used (to avoid
|
||||||
|
@ -287,6 +293,25 @@ public class Scaffold {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void installCallRateMeteringConfiguration(String dataDir) throws IOException, InterruptedException {
|
||||||
|
File testRateMeteringFile = new File(config.callRateMeteringConfigPath);
|
||||||
|
if (!testRateMeteringFile.exists())
|
||||||
|
throw new FileNotFoundException(
|
||||||
|
format("Call rate metering config file '%s' not found", config.callRateMeteringConfigPath));
|
||||||
|
|
||||||
|
BashCommand copyRateMeteringConfigFile = new BashCommand(
|
||||||
|
"cp -rf " + config.callRateMeteringConfigPath + " " + dataDir);
|
||||||
|
if (copyRateMeteringConfigFile.run().getExitStatus() != 0)
|
||||||
|
throw new IllegalStateException(
|
||||||
|
format("Could not install %s file in %s",
|
||||||
|
testRateMeteringFile.getAbsolutePath(), dataDir));
|
||||||
|
|
||||||
|
Path destPath = Paths.get(dataDir, testRateMeteringFile.getName());
|
||||||
|
String chmod700Perms = "rwx------";
|
||||||
|
Files.setPosixFilePermissions(destPath, PosixFilePermissions.fromString(chmod700Perms));
|
||||||
|
log.info("Installed {} with perms {}.", destPath.toString(), chmod700Perms);
|
||||||
|
}
|
||||||
|
|
||||||
private void installShutdownHook() {
|
private void installShutdownHook() {
|
||||||
// Background apps can be left running until the jvm is manually shutdown,
|
// Background apps can be left running until the jvm is manually shutdown,
|
||||||
// so we add a shutdown hook for that use case.
|
// so we add a shutdown hook for that use case.
|
||||||
|
|
Loading…
Add table
Reference in a new issue