mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-15 12:50:47 +02:00
Use config file in docker (#38)
* Use config file mounted in docker container to run squeakserver * Fix test script to shut down at end * Expose port in dockerfile * Update main docker-compose to use config file
This commit is contained in:
parent
057d9495d4
commit
30034d35ab
6 changed files with 48 additions and 73 deletions
22
docker/config.ini
Normal file
22
docker/config.ini
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[DEFAULT]
|
||||
network=simnet
|
||||
|
||||
[lnd]
|
||||
rpc_host=lnd
|
||||
rpc_port=10009
|
||||
|
||||
[electrum]
|
||||
rpc_host=
|
||||
rpc_port=
|
||||
rpc_user=
|
||||
rpc_pass=
|
||||
|
||||
[server]
|
||||
rpc_host=0.0.0.0
|
||||
rpc_port=8774
|
||||
|
||||
[postgresql]
|
||||
host=db
|
||||
database=squeakserver
|
||||
user=postgres
|
||||
password=postgres
|
||||
|
|
@ -87,6 +87,7 @@ services:
|
|||
volumes:
|
||||
- shared:/rpc
|
||||
- lnd_dir:/root/.lnd
|
||||
- ./config.ini:/app/config.ini
|
||||
ports:
|
||||
- 8774:8774
|
||||
- 18774:18774
|
||||
|
|
@ -96,7 +97,6 @@ services:
|
|||
- db
|
||||
sysctls:
|
||||
- net.ipv6.conf.all.disable_ipv6=0
|
||||
entrypoint: ["./start-sqkserver.sh"]
|
||||
|
||||
volumes:
|
||||
# btcctl and lnd containers.
|
||||
|
|
|
|||
|
|
@ -32,9 +32,6 @@ RUN ./install-rpc.sh
|
|||
|
||||
RUN python3 setup.py install
|
||||
|
||||
# Copy the config file template.
|
||||
COPY "docker/sqkserver/config.ini.sh" .
|
||||
EXPOSE 8774
|
||||
|
||||
# Copy the entrypoint script.
|
||||
COPY "docker/sqkserver/start-sqkserver.sh" .
|
||||
RUN chmod +x start-sqkserver.sh
|
||||
CMD ["runsqueakserver", "--config", "config.ini", "--log-level", "DEBUG", "run-server"]
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# exit from script if error was raised.
|
||||
set -e
|
||||
|
||||
# error function is used within a bash function in order to send the error
|
||||
# message directly to the stderr output and exit.
|
||||
error() {
|
||||
echo "$1" > /dev/stderr
|
||||
exit 0
|
||||
}
|
||||
|
||||
# return is used within bash function in order to return the value.
|
||||
return() {
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
# set_default function gives the ability to move the setting of default
|
||||
# env variable from docker file to the script thereby giving the ability to the
|
||||
# user override it durin container start.
|
||||
set_default() {
|
||||
# docker initialized env variables with blank string and we can't just
|
||||
# use -z flag as usually.
|
||||
BLANK_STRING='""'
|
||||
|
||||
VARIABLE="$1"
|
||||
DEFAULT="$2"
|
||||
|
||||
if [[ -z "$VARIABLE" || "$VARIABLE" == "$BLANK_STRING" ]]; then
|
||||
|
||||
if [ -z "$DEFAULT" ]; then
|
||||
error "You should specify default variable"
|
||||
else
|
||||
VARIABLE="$DEFAULT"
|
||||
fi
|
||||
fi
|
||||
|
||||
return "$VARIABLE"
|
||||
}
|
||||
|
||||
# Set default variables if needed.
|
||||
LND_HOST="lnd"
|
||||
LND_PORT=10009
|
||||
RPCUSER=$(set_default "$RPCUSER" "devuser")
|
||||
RPCPASS=$(set_default "$RPCPASS" "devpass")
|
||||
DEBUG=$(set_default "$DEBUG" "debug")
|
||||
NETWORK=$(set_default "$NETWORK" "simnet")
|
||||
CHAIN=$(set_default "$CHAIN" "bitcoin")
|
||||
SQK_HOST="0.0.0.0"
|
||||
SQK_PORT=8774
|
||||
|
||||
|
||||
# Generate the config file.
|
||||
chmod +x config.ini.sh
|
||||
./config.ini.sh $NETWORK $LND_HOST $LND_PORT $SQK_HOST $SQK_PORT > config.ini
|
||||
echo "config.ini:"
|
||||
cat config.ini
|
||||
|
||||
echo "Starting to run the python server here...."
|
||||
|
||||
exec runsqueakserver \
|
||||
"--config"="config.ini" \
|
||||
"--log-level"="$DEBUG" \
|
||||
run-server
|
||||
|
||||
# exec ls
|
||||
22
itests/config.ini
Normal file
22
itests/config.ini
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[DEFAULT]
|
||||
network=simnet
|
||||
|
||||
[lnd]
|
||||
rpc_host=lnd
|
||||
rpc_port=10009
|
||||
|
||||
[electrum]
|
||||
rpc_host=
|
||||
rpc_port=
|
||||
rpc_user=
|
||||
rpc_pass=
|
||||
|
||||
[server]
|
||||
rpc_host=0.0.0.0
|
||||
rpc_port=8774
|
||||
|
||||
[postgresql]
|
||||
host=db
|
||||
database=squeakserver
|
||||
user=postgres
|
||||
password=postgres
|
||||
|
|
@ -143,13 +143,13 @@ services:
|
|||
volumes:
|
||||
- shared_test:/rpc
|
||||
- lnd_dir_sqkserver:/root/.lnd
|
||||
- ./config.ini:/app/config.ini
|
||||
links:
|
||||
- "lnd_sqkserver:lnd"
|
||||
depends_on:
|
||||
- db
|
||||
sysctls:
|
||||
- net.ipv6.conf.all.disable_ipv6=0
|
||||
entrypoint: ["./start-sqkserver.sh"]
|
||||
|
||||
test:
|
||||
image: test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue