some changes for docker setup (#9)

* added SIGTERM handler for graceful docker shutdown

* added error message

* added example for bitcoind running on the host undockered

* added docker-compose and extended example

* added docker-compose section to README

* addes some note for rpcallowip

* added restart policy

* added DB folder for persistent data

* added $NETWORK as prefix for database path to not get in conflict with testnet setup

* used env variables for stratum and api ports
This commit is contained in:
Thomas Shufps
2023-11-19 14:16:50 -05:00
committed by GitHub
parent a10aa9c52f
commit 2aa0ebe587
5 changed files with 65 additions and 11 deletions
+5
View File
@@ -43,6 +43,11 @@ async function bootstrap() {
process.exit(0);
});
process.on('SIGTERM', () => {
console.log(`Stopping services`);
process.exit(0);
});
app.enableCors();
useContainer(app.select(AppModule), { fallbackOnErrors: true });
+3 -3
View File
@@ -37,7 +37,7 @@ export class BitcoinRpcService {
this.pollMiningInfo();
} else {
setInterval(this.pollMiningInfo.bind(this), 500);
}
}
}
public async pollMiningInfo() {
@@ -60,7 +60,7 @@ export class BitcoinRpcService {
}
});
} catch (e) {
console.log('Error getblocktemplate');
console.error('Error getblocktemplate:' ,e.message);
throw new Error('Error getblocktemplate');
}
console.log(`getblocktemplate tx count: ${result.transactions.length}`);
@@ -71,7 +71,7 @@ export class BitcoinRpcService {
try {
return await this.client.getmininginfo();
} catch (e) {
console.log('Error getmininginfo');
console.error('Error getmininginfo', e.message);
return null;
}