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 FROM ubuntu:18.04
EXPOSE 5279 EXPOSE 5279 5280
VOLUME /storage 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 RUN mkdir /daemon
WORKDIR /daemon WORKDIR /daemon
COPY lbrynet ./ COPY lbrynet ./
COPY conf/daemon_settings.yml ./ COPY conf/daemon_settings.yml ./
COPY conf/test_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 COPY start.sh ./start.sh
RUN chmod a+x start.sh RUN chmod a+x start.sh
CMD ["./start.sh"] CMD ["./start.sh"]

View file

@ -1,14 +1,19 @@
lbryum_servers: api: 0.0.0.0:5279
- 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
streaming_server: 0.0.0.0:5280 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_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: lbryum_servers:
- orchstr8:50001 - 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_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 -o xtrace
set -e
if [ ! -d "$LBRY_DATA_DIR" ]; then function parse_yaml {
mkdir $LBRY_DATA_DIR local prefix=$2
fi local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
if [ ! -d "$LBRY_LBRYUM_WALLET_DIR" ]; then sed -ne "s|^\($s\):|\1|" \
mkdir $LBRY_LBRYUM_WALLET_DIR -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
fi -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
if [ ! -d "$LBRY_DOWNLOAD_DIRECTORY" ]; then awk -F$fs '{
mkdir $LBRY_DOWNLOAD_DIRECTORY indent = length($1)/2;
fi 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 if [ -z ${LBRY_DOCKER_CONFIG+x} ]; then
./lbrynet start --config=/daemon/daemon_settings.yml CONFIG="/daemon/daemon_settings.yml"
else else
./lbrynet start --config=$LBRY_DOCKER_CONFIG CONFIG=$LBRY_DOCKER_CONFIG
fi 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