Optimize lbrynet configuration at launch

This commit is contained in:
Andrey Beletsky 2019-06-05 01:56:02 +07:00
parent 3e7dbe1819
commit ac7d88cf5e
4 changed files with 74 additions and 42 deletions

View file

@ -1,16 +1,14 @@
FROM ubuntu:18.04
EXPOSE 5279
EXPOSE 5279 5280
VOLUME /storage
RUN apt-get update && apt-get -y install ca-certificates
RUN apt-get update && apt-get -y install ca-certificates bash
RUN mkdir /daemon
WORKDIR /daemon
COPY lbrynet ./
COPY conf/daemon_settings.yml ./
COPY conf/test_daemon_settings.yml ./
ENV LBRY_DATA_DIR /storage/data
ENV LBRY_LBRYUM_WALLET_DIR /storage/lbryum
ENV LBRY_DOWNLOAD_DIRECTORY /storage/download
ENV LBRY_API 0.0.0.0:5279
COPY start.sh ./start.sh
RUN chmod a+x start.sh
CMD ["./start.sh"]

View file

@ -1,14 +1,19 @@
lbryum_servers:
- lbryumx3.lbry.com:50001
use_upnp: False
delete_blobs_on_remove: True
share_usage_data: false
components_to_skip:
- hash_announcer
- blob_server
- dht
streaming_only: true
api: 0.0.0.0:5279
streaming_server: 0.0.0.0:5280
save_files: false
components_to_skip:
- hash_announcer
- blob_server
- dht
data_dir: /storage/lbrynet
download_dir: /storage/download
wallet_dir: /storage/lbryum
lbryum_servers:
- lbryumx3.lbry.com:50001
save_blobs: false
save_files: false
share_usage_data: true
use_upnp: false

View file

@ -1,16 +1,20 @@
api: 0.0.0.0:5279
streaming_server: 0.0.0.0:5280
components_to_skip:
- hash_announcer
- blob_server
- dht
data_dir: /storage/lbrynet
download_dir: /storage/download
wallet_dir: /storage/lbryum
lbryum_servers:
- orchstr8:50001
blockchain_name: lbrycrd_testnet
delete_blobs_on_remove: True
use_upnp: False
share_usage_data: false
components_to_skip:
- hash_announcer
- blob_server
- dht
streaming_server: 0.0.0.0:5280
save_files: false
save_blobs: false
save_files: false
share_usage_data: true
use_upnp: false
blockchain_name: lbrycrd_testnet

View file

@ -1,19 +1,44 @@
#!/bin/sh
#!/bin/bash
set -o xtrace
set -e
if [ ! -d "$LBRY_DATA_DIR" ]; then
mkdir $LBRY_DATA_DIR
fi
if [ ! -d "$LBRY_LBRYUM_WALLET_DIR" ]; then
mkdir $LBRY_LBRYUM_WALLET_DIR
fi
if [ ! -d "$LBRY_DOWNLOAD_DIRECTORY" ]; then
mkdir $LBRY_DOWNLOAD_DIRECTORY
fi
function parse_yaml {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
}
}'
}
if [ -z ${LBRY_DOCKER_CONFIG+x} ]; then
./lbrynet start --config=/daemon/daemon_settings.yml
CONFIG="/daemon/daemon_settings.yml"
else
./lbrynet start --config=$LBRY_DOCKER_CONFIG
CONFIG=$LBRY_DOCKER_CONFIG
fi
cat $CONFIG
eval $(parse_yaml ${CONFIG} "LBRY_")
if [ ! -d "$LBRY_data_dir" ]; then
mkdir $LBRY_data_dir
fi
if [ ! -d "$LBRY_wallet_dir" ]; then
mkdir $LBRY_wallet_dir
fi
if [ ! -d "$LBRY_download_dir" ]; then
mkdir $LBRY_download_dir
fi
./lbrynet start --config=$CONFIG