diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 3e5963e..0000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -data/ -*/data/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9d9814f..4171f73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,13 @@ -.gitlab-ci.yml .DS_Store -*/docker-compose.override.yml -*/*/data - ./docker-compose.yml -*.zip \ No newline at end of file +*/docker-compose.override.yml + + +*/*/data +*.zip +*.tar.gz +*.tar.xz + +./persist/lbrycrd/* +./persist/lbrynet/* +./persist/chainquery/* diff --git a/README.md b/README.md index 635cf35..d1daaf3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # lbry-Docker +## Tags +Document tags and link to their Dockerfiles here. + ## Scope This repository is in heavy flux as it travels towards [version 1.0](https://github.com/lbryio/lbry-docker/projects/1) however its goal is to make development for and adoption of any of the LBRY appliances trivial. You should be able to clone pull fork your way to a better LBRY without having to do much more than some light reading of a README to get started. diff --git a/chainquery/.dockerignore b/chainquery/.dockerignore deleted file mode 100644 index b683caa..0000000 --- a/chainquery/.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -data/ -data.z* -chainquery.z* -*.zip -compile/ diff --git a/chainquery/compile/.dockerignore b/chainquery/compile/.dockerignore deleted file mode 100644 index 5d1735a..0000000 --- a/chainquery/compile/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -data/ -data.z* -chainquery.z* -compile/ diff --git a/chainquery/compile/.env b/chainquery/compile/.env deleted file mode 100644 index 2ab5aea..0000000 --- a/chainquery/compile/.env +++ /dev/null @@ -1,16 +0,0 @@ -COMPOSE_PROJECT_NAME=chainquery - -######################### -## Chainquery Settings ## -######################### -RPC_ALLOW_IP=10.5.1.3 -DEBUGMODE=false - -################# -## Mysql Creds ## -################# -MYSQL_SERVER=10.5.1.10 -MYSQL_USER=changeme -MYSQL_PASSWORD=changeme -MYSQL_DATABASE=chainquery -MYSQL_ROOT_PASSWORD=changeme diff --git a/chainquery/compile/.gitignore b/chainquery/compile/.gitignore deleted file mode 100644 index 5d1735a..0000000 --- a/chainquery/compile/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -data/ -data.z* -chainquery.z* -compile/ diff --git a/chainquery/compile/Dockerfile b/chainquery/compile/Dockerfile deleted file mode 100644 index 5df53a6..0000000 --- a/chainquery/compile/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -## This base image is for running latest chainquery -FROM ubuntu:18.04 as prep -LABEL MAINTAINER="leopere [at] nixc [dot] us" - -## Install everything needed to unzip the file containing Chainquery -RUN apt-get update && \ - apt-get -y install unzip curl && \ - apt-get autoclean -y && \ - rm -rf /var/lib/apt/lists/* && \ - mkdir /download - -## Download and extract the latest Zip containing Linux binary for Chainquery. -RUN curl -L -o /download/chainquery.zip $(curl -s https://api.github.com/repos/lbryio/chainquery/releases | fgrep 'Linux_x86_64.zip' | grep download | head -n 1 | cut -d'"' -f4) && \ - cd /download && \ - ls -lAh /download && pwd && \ - unzip chainquery.zip && \ - rm chainquery.zip - -## TODO: Use this instead of everything above here at some point. To do this we will need the LBRY team to host all of their release binaries in their latest form internally I guess since github doesn't support latest tags. -# ADD --chown=1000:1000 https://github.com/lbryio/chainquery/releases/download/latest/chainquery_latest_Linux_x86_64.zip /download - - -# TODO: Switch to Alpine eventually we might need to compile in Alpine for this. -FROM ubuntu:18.04 as app - -## Run as unprivileged user. -RUN adduser chainquery --gecos GECOS --shell /bin/bash --disabled-password --home /home/chainquery - -# Pull chainquery executable from prep container. -COPY --from=0 /download/chainquery /usr/bin - -# ADD --chown=1000:1000 https://github.com/lbryio/chainquery/releases/download/latest/chainquery_latest_Linux_x86_64.zip /usr/bin -# COPY stuff/chainqueryconfig.toml /etc/chainquery/ - -## Get latest chainqueryconfig.toml from master on github as template. -# TODO: add magic which pattern matches for chainqueryconfig.toml DEFAULT strings and replaces them with configured settings on container start. -ADD https://raw.githubusercontent.com/lbryio/chainquery/master/config/default/chainqueryconfig.toml /etc/chainquery/chainqueryconfig.toml.orig - -## Install start.sh as executable script in container $PATH -COPY stuff/start.sh /usr/local/bin/start - -# TODO: Implement docker-entrypoint if later required this might be handy if we need certain maintainence tasks to be executed in the live container. -# COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint - -# ## From here onward we're doing this with no root. -# USER chainquery - -## Expose Chainquery API port -EXPOSE 6300 - -## Execute start script earlier installed into $PATH -CMD ["start"] diff --git a/chainquery/compile/docker-compose.yml b/chainquery/compile/docker-compose.yml deleted file mode 100644 index a101711..0000000 --- a/chainquery/compile/docker-compose.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: '3.4' - -networks: - lbrynet: - external: true - -services: -########### -## MYSQL ## -########### -## MariaDB is currently not supported and neither is later versions of MySQL this may change. -## https://hub.docker.com/r/_/mariadb/ - mysql: - image: mysql:5.7.23 - restart: always - networks: - lbrynet: - ipv4_address: 10.5.1.10 - aliases: - - mysql - env_file: - - .env - expose: - - 3306 - ## TODO: I want to find a way that is acceptable to everyone to lock this up - ## and not share it with everyone at least eventually. - ports: - - 3306:3306 - volumes: - - ./data/db:/var/lib/mysql - - ./stuff/my.cnf:/etc/mysql/conf.d/chainquery-optimizations.cnf - -################ -## Chainquery ## -################ - chainquery: - build: - context: . - target: app - restart: always - networks: - lbrynet: - ipv4_address: 10.5.1.3 - env_file: - - .env - - ../lbrycrd/.env - labels: - - "traefik.expose=false" - expose: - - 6300 - ports: - - 6300:6300 - depends_on: - - mysql - ## TODO: Uncomment this in a docker-compose.override.yml to allow for external configurations. - # volumes: - # - ./data/config/chainqueryconfig.toml:/etc/chainquery/chainqueryconfig.toml diff --git a/chainquery/compile/quick-bootstrap.sh b/chainquery/compile/quick-bootstrap.sh deleted file mode 100644 index 953e821..0000000 --- a/chainquery/compile/quick-bootstrap.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env bash - -## TODO: Be Polite and ask for confirmation. -function QandA() { - read -r -p "Continue with $1 [y/N] " response - response=${response,,} # tolower - if [[ "$response" =~ ^(yes|y)$ ]]; then - echo "Continuing with this." - eval $1 - else - echo "Skipping the $1." - fi -} - -## Check your $PATH for required dependencies. -## Stop and complain for now, later automagically install them. -## TODO: Add dependency checker. -function test_for_deps() { - ## Test for Command - if ! [ -x "$(command -v $1)" ]; then - echo "Error: $1 is not installed." >&2 - echo "You must have $1 installed." - else - echo "Info: $1 is installed." - fi -} - -## Declare Linux app dependencies to check for. -DEPENDENCIES=( - docker - docker-compose -) - -## TODO: Check for docker and docker-compose -function check_deps() { -for i in "${!DEPENDENCIES[@]}"; do - echo ${DEPENDENCIES[$i]}"_KEY" - ## Indirect references http://tldp.org/LDP/abs/html/ivr.html - eval TESTDEP=\$"${DEPENDENCIES[$i]}" - test_for_deps $TESTDEP -done -} - -function get_checkpoint() { - ## Get DB Checkpoint data. - echo Asked to get the latest checkpoint data, downloading latest checkpoint. - echo This data is fairly large so this saves you a few days of parsing the LBRY blockchain. - docker run -v $(pwd)/:/download --rm leopere/axel-docker http://chainquery-data.s3.amazonaws.com/chainquery-data.zip -o ./chainquery.zip -} - -################################# -## The real action begins here ## -################################# -## TODO: Add ways to get into and out of a bind here. -case $1 in - getdata ) - if [[ -f ./chainquery.zip ]]; then - echo "Found a copy of ./chainquery.zip already in your system." - echo "We recommend that you delete this data before proceeding and grab a fresh copy." - QandA "rm -f ./chainquery.zip" - get_checkpoint - else - get_checkpoint - fi - ;; - extract ) - ## Unpack the data again if need be. - echo Asked to unpack chainquery.zip if downloaded. - if [[ -f ./chainquery.zip ]]; then - docker run -v $(pwd)/:/data --rm leopere/unzip-docker ./chainquery.zip - else - echo "Could not extractas chainquery.zip did not exist." - echo "Feel free to execute './quick-bootstrap.sh getdata' first next time." - fi - ;; - cleanup ) - ## Remove any junk here. - echo Asked to clean up leftover chainquery.zip to save on disk space. - rm chainquery.zip - ;; - reset ) - ## Give up on everything and try again. - ## TODO: Make it very obvious with a nice little Y/N prompt that you're about to trash your settings and start over. - echo "Agressively Killing all chainquery and dependency containers." - echo "executing: docker-compose kill" - docker-compose kill - echo "Cleaning up stopped containers." - echo "executing: docker-compose rm -f" - docker-compose rm -f - rm -Rf ./data - rm -f ./chainquery.zip - ;; - start ) - ## Unsupported start command to start containers. - ## You can use this if you want to start this thing gracefully. - ## Ideally you would not use this in production. - echo "Asked to start chainquery gracefully for you." - echo "executing: docker-compose up -d mysql" - docker-compose up -d mysql - echo "giving mysql some time to establish schema, crypto, users, permissions, and tables" - sleep 30 - echo "Starting Chainquery" - echo "executing: docker-compose up -d chainquery" - docker-compose up -d chainquery - ## TODO: verify chainquery instance is up and healthy, this requires a functional HEALTHCHECK - echo "This should have chainquery up and running, currently theres no checks in this function to verify this however." - echo "Do feel free to execute 'docker-compose ps' to verify if its running and not restarting or exited." - echo "Final Note: You should try to use the docker-compose commands in the tutorial at https://github.com/lbryio/lbry-docker/blob/master/chainquery/README.md" - ;; - compress-latest-checkpoint-data ) - ## This is not intended for public use. - docker-compose stop chainquery - docker-compose stop mysql - sudo zip -r chainquery-data.zip data - docker-compose up -d mysql - sleep 30 - docker-compose up -d chainquery - ;; - upload-latest-checkpoint-data ) - ## This is not intended for public use. - aws s3 cp ./chainquery-data.zip s3://chainquery-data/chainquery-data.new - aws s3 rm s3://chainquery-data/chainquery-data.zip - aws s3 mv s3://chainquery-data/chainquery-data.new s3://chainquery-data/chainquery-data.zip - ;; - * ) - echo "==================================================" - echo "You look like you need usage examples let me help." - echo "==================================================" - echo "./quick-boostrap.sh {Parameter}" - echo "Example: ./quick-bootstrap.sh getdata # Downloads the latest Chainquery checkpoint data from a LBRYio official aws instance." - echo "" - echo "" - echo "==================================================" - echo "Usage example and available parameters" - echo "==================================================" - echo "" - echo "getdata # This function grabs the latest Chainquery checkpoint data." - echo "extract # Unpacks the chainquery data into the correct directory. ./data/" - echo "cleanup # Removes chainquery.zip" - echo "reset # Reset the state of these containers entirely, use if all else fails." - echo "" - echo "" - echo "==================================================" - echo "==================================================" - echo "Any other functions that are not documented here are not intended for public use." - echo " These functions are included in this repository to keep things in one place." - ;; -esac diff --git a/chainquery/compile/stuff/chainqueryconfig.toml b/chainquery/compile/stuff/chainqueryconfig.toml deleted file mode 100644 index 21f0832..0000000 --- a/chainquery/compile/stuff/chainqueryconfig.toml +++ /dev/null @@ -1,16 +0,0 @@ -## TODO: Don't hardcode this stuff for production - -#Debug mode outputs specific information to the console -debugmode=false - -#LBRYcrd URL is required for chainquery to query the blockchain -lbrycrdurl="rpc://lbryrpc:changeme@10.5.1.2:9245" - -#MySQL DSN is required for chainquery to store information. -mysqldsn="changeme:changeme@tcp(10.5.1.10:3306)/chainquery" - -#API MySQL DSN is required for chainquery to expose a SQL query service -apimysqldsn="changeme:changeme@tcp(10.5.1.10:3306)/chainquery" - -#The command that should be executed to trigger a self update of the software. For linux, for example, `.sh` -#DEFAULT-autoupdatecommand=[unset] diff --git a/chainquery/compile/stuff/debugpaste-it.sh b/chainquery/compile/stuff/debugpaste-it.sh deleted file mode 100644 index f1f641a..0000000 --- a/chainquery/compile/stuff/debugpaste-it.sh +++ /dev/null @@ -1 +0,0 @@ -#!/usr/bin/env bash diff --git a/chainquery/compile/stuff/docker-entrypoint.sh b/chainquery/compile/stuff/docker-entrypoint.sh deleted file mode 100644 index 77e798a..0000000 --- a/chainquery/compile/stuff/docker-entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# default to run whatever the user wanted like "/bin/bash" -## If user runs no need to run any more of the entrypoint script. -if [[ -z "$@" ]]; then - echo "User did not attempt input. Now executing docker-entrypoint." -else - echo "Running $@." - exec "$@" - exit 1 -fi - -/bin/bash diff --git a/chainquery/compile/stuff/env-example b/chainquery/compile/stuff/env-example deleted file mode 100644 index 7ed2b53..0000000 --- a/chainquery/compile/stuff/env-example +++ /dev/null @@ -1,19 +0,0 @@ -COMPOSE_PROJECT_NAME=chainquery - -######################### -## Chainquery Settings ## -######################### -## TODO: Test to ensure these vars can be pulled from the lbrycrd .env -#RPC_USER=lbryrpc ## Not super necessery to change this. -#RPC_PASSWORD=changeme ## Please replace changeme. - -RPC_ALLOW_IP=10.5.1.3 ## You're better off not changing this. - -################# -## Mysql Creds ## -################# -MYSQL_SERVER=10.5.1.10 ## You're better off not changing this. -MYSQL_USER=changeme ## This could be changed. -MYSQL_PASSWORD=changeme ## This could be set to something random it sets this string for both Mysql's main user and Chainquery's MysqlDSN. -MYSQL_DATABASE=chainquery ## This can stay the same. -MYSQL_ROOT_PASSWORD=changeme ## Set this to something random and obnoxious we're not using it. diff --git a/chainquery/compile/stuff/healthcheck.sh b/chainquery/compile/stuff/healthcheck.sh deleted file mode 100644 index 24cd27b..0000000 --- a/chainquery/compile/stuff/healthcheck.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -## TODO: Implement this at some point it requires CURL in the container. -curl http://localhost:6300/api/status diff --git a/chainquery/compile/stuff/my.cnf b/chainquery/compile/stuff/my.cnf deleted file mode 100644 index cb0dbed..0000000 --- a/chainquery/compile/stuff/my.cnf +++ /dev/null @@ -1,9 +0,0 @@ -# Default Homebrew MySQL server config -[mysqld] -# Only allow connections from localhost -innodb_log_file_size=5G -key_buffer_size=1G -innodb_flush_log_at_trx_commit = 0 -innodb_autoinc_lock_mode=2 -innodb_buffer_pool_size=1G -innodb_log_buffer_size=1G diff --git a/chainquery/compile/stuff/start.sh b/chainquery/compile/stuff/start.sh deleted file mode 100644 index 6b96167..0000000 --- a/chainquery/compile/stuff/start.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -## Config setup - -## Setup Values -DEBUGMODE=$(echo "debugmode=$DEBUGMODE") -LBRYCRDURL=$(echo "lbrycrdurl=\"rpc://$RPC_USER:$RPC_PASSWORD@10.5.1.2:9245\"") -MYSQLDSN=$(echo "mysqldsn=\"$MYSQL_USER:$MYSQL_PASSWORD@tcp($MYSQL_SERVER:3306)/$MYSQL_DATABASE\"") -APIMYSQLDSN=$(echo "apimysqldsn=\"$MYSQL_USER:$MYSQL_PASSWORD@tcp($MYSQL_SERVER:3306)/$MYSQL_DATABASE\"") - -## Setup Defaults -DEBUGMODE_DEFAULT='#DEFAULT-debugmode=false' -LBRYCRDURL_DEFAULT='#DEFAULT-lbrycrdurl="rpc://lbry:lbry@localhost:9245"' -MYSQLDSN_DEFAULT='#DEFAULT-mysqldsn="lbry:lbry@tcp(localhost:3306)/chainquery"' -APIMYSQLDSN_DEFAULT='#DEFAULT-apimysqldsn="lbry:lbry@tcp(localhost:3306)/chainquery"' - -## Add setup value variable name to this list to get processed on container start -CONFIG_SETTINGS=( - DEBUGMODE - LBRYCRDURL - MYSQLDSN - APIMYSQLDSN -) - -function set_configs() { - ## Set configs on container start if not already set. - for i in "${!CONFIG_SETTINGS[@]}"; do - ## Indirect references http://tldp.org/LDP/abs/html/ivr.html - eval FROM_STRING=\$"${CONFIG_SETTINGS[$i]}_DEFAULT" - eval TO_STRING=\$${CONFIG_SETTINGS[$i]} - ## TODO: Add a bit more magic to make sure that you're only configuring things if not set by config mounts. - sed -i "s~$FROM_STRING~"$TO_STRING"~g" /etc/chainquery/chainqueryconfig.toml - done - echo "Reading config for debugging." - cat /etc/chainquery/chainqueryconfig.toml -} - -if [[ ! -f /etc/chainquery/chainqueryconfig.toml ]]; then - echo "[INFO]: Did not find chainqueryconfig.toml" - echo " Installing default and configuring with provided environment variables if any." - ## Install fresh copy of config file. - echo "cp -v /etc/chainquery/chainqueryconfig.toml.orig /etc/chainquery/chainqueryconfig.toml" - cp -v /etc/chainquery/chainqueryconfig.toml.orig /etc/chainquery/chainqueryconfig.toml - chmod 755 /etc/chainquery/chainqueryconfig.toml - ls -lAh /etc/chainquery/ - set_configs -else - echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/chainquery" - echo " Attempting to non destructively install any new environment configurations." - set_configs -fi - -## For now keeping this simple. Potentially eventually add all command args as envvars for the Dockerfile or use safe way to add args via docker-compose.yml -su -c "chainquery serve -c "/etc/chainquery/"" chainquery diff --git a/chainquery/docker-compose.yml b/chainquery/compose/docker-compose.yml-prod-example similarity index 100% rename from chainquery/docker-compose.yml rename to chainquery/compose/docker-compose.yml-prod-example diff --git a/chainquery/linux-x86_64-compile/.gitkeep b/chainquery/linux-x86_64-compile/.gitkeep new file mode 100644 index 0000000..fb05095 --- /dev/null +++ b/chainquery/linux-x86_64-compile/.gitkeep @@ -0,0 +1 @@ +# TODO: write compile container diff --git a/chainquery/Dockerfile b/chainquery/linux-x86_64-production/Dockerfile similarity index 97% rename from chainquery/Dockerfile rename to chainquery/linux-x86_64-production/Dockerfile index fe86e01..c07b243 100644 --- a/chainquery/Dockerfile +++ b/chainquery/linux-x86_64-production/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* WORKDIR / SHELL ["/bin/bash", "-o", "pipefail", "-c"] -COPY stuff/start.sh start +COPY ../stuff/start.sh start RUN curl -L -o /chainquery.zip $(curl -s https://api.github.com/repos/lbryio/chainquery/releases | grep -F 'Linux_x86_64.zip' | grep download | head -n 1 | cut -d'"' -f4) && \ unzip /chainquery.zip && \ rm /chainquery.zip diff --git a/chainquery/stuff/debugpaste-it.sh b/chainquery/stuff/debugpaste-it.sh deleted file mode 100755 index f1f641a..0000000 --- a/chainquery/stuff/debugpaste-it.sh +++ /dev/null @@ -1 +0,0 @@ -#!/usr/bin/env bash diff --git a/chainquery/stuff/docker-entrypoint.sh b/chainquery/stuff/docker-entrypoint.sh deleted file mode 100755 index 77e798a..0000000 --- a/chainquery/stuff/docker-entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# default to run whatever the user wanted like "/bin/bash" -## If user runs no need to run any more of the entrypoint script. -if [[ -z "$@" ]]; then - echo "User did not attempt input. Now executing docker-entrypoint." -else - echo "Running $@." - exec "$@" - exit 1 -fi - -/bin/bash diff --git a/lbrycrd/.dockerignore b/lbrycrd/.dockerignore deleted file mode 100644 index 8fce603..0000000 --- a/lbrycrd/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -data/ diff --git a/lbrycrd/compile/.dockerignore b/lbrycrd/compile/.dockerignore deleted file mode 100644 index 8fce603..0000000 --- a/lbrycrd/compile/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -data/ diff --git a/lbrycrd/compile/Dockerfile b/lbrycrd/compile/Dockerfile deleted file mode 100644 index 4a2a606..0000000 --- a/lbrycrd/compile/Dockerfile +++ /dev/null @@ -1,67 +0,0 @@ -########################### -## Compiler/Builder Step ## -########################### -FROM ubuntu:18.04 as builder -## TODO: Decide who gets the MAINTAINER label -## LABEL MAINTAINER="@Brannon Update Me Or Put Mine Here" - -## Added apt work as single container layer then remove cruft before layer is committed. -RUN apt-get update && \ - apt-get install -y build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 git wget apt-utils && \ - apt-get install -y libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libboost-locale-dev libboost-program-options-dev && \ - apt-get install -y python-dev libbz2-dev autoconf ca-certificates clang-format && \ - apt-get install -y software-properties-common && add-apt-repository -y ppa:bitcoin/bitcoin && apt-get update && apt-get install -y libdb4.8-dev libdb4.8++-dev && \ - apt-get -y install unzip wget && \ ## Cleanup Post apt package installation. - apt-get autoclean -y && \ - rm -rf /var/lib/apt/lists/* ## Others neednt play here(remove apt lists as no longer needed at this stage). - -## Add debugpaste here for reporting compiler errors. Psuedo code. -## RUN wget -O /usr/local/bin/debugpaste https://url && \ -## sha256sum check of debugpaste - -######################## -## Compile Steps Here ## -######################## -## Compile and Test steps should likely be separate run commands/layers. -RUN ## Compile/Test steps here - - -#################### -## App build step ## -#################### -FROM ubuntu:18.04 as app - -## Change this to pull from a certifiable source with supply chain in plain sight. -# RUN wget -O /usr/bin/debugpaste https://github.com/nixc-us/debugpaste-it/raw/master/bin/debugpaste_64 && \ -# chmod +x /usr/bin/debugpaste - -RUN adduser lbrycrd --gecos GECOS --shell /bin/bash --disabled-password --home /app - -# ## This section can be replaced with a COPY to pull artifacts from build step. -# # RUN wget -O /usr/bin/lbrycrd-linux.zip https://github.com/lbryio/lbrycrd/releases/download/v0.12.2.2/lbrycrd-linux.zip && \ -# # cd /usr/bin/ && \ -# # unzip lbrycrd-linux.zip && \ -# # rm lbrycrd-linux.zip && \ -# # chmod +x lbrycrdd lbrycrd-cli lbrycrd-tx -# COPY --chown=1000:1000 /path/to/compiled/lbrycrd/bins /app/ - -## This needn't be included until debugpaste is ready. -# COPY debugpaste-it.sh /usr/local/bin/debugpaste-it -# COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint -COPY start.sh /usr/local/bin/start - - -USER lbrycrdd - -RUN mkdir -p /data/ - -VOLUME /data/ -VOLUME /etc/lbrycrdd/ - -## Exposing daemon port and RPC port -EXPOSE 9245 9246 - -# ## For now this is a placeholder that executes /bin/bash on `docker exec` -# ENTRYPOINT ["docker-entrypoint"] - -CMD ["start"] diff --git a/lbrycrd/compile/README.md b/lbrycrd/compile/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/lbrycrd/compile/docker-compose.yml b/lbrycrd/compile/docker-compose.yml deleted file mode 100644 index e69de29..0000000 diff --git a/lbrycrd/compile/docker-entrypoint.sh b/lbrycrd/compile/docker-entrypoint.sh deleted file mode 100644 index 77e798a..0000000 --- a/lbrycrd/compile/docker-entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# default to run whatever the user wanted like "/bin/bash" -## If user runs no need to run any more of the entrypoint script. -if [[ -z "$@" ]]; then - echo "User did not attempt input. Now executing docker-entrypoint." -else - echo "Running $@." - exec "$@" - exit 1 -fi - -/bin/bash diff --git a/lbrycrd/compile/start.sh b/lbrycrd/compile/start.sh deleted file mode 100644 index b034614..0000000 --- a/lbrycrd/compile/start.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -# ## ToDo: -# ## Get a test case to see if this is the first run or a repeat run -# ## If it's a first run you need to do a full index including all transactions -# ## tx index creates an index of every single transaction in the block history if -# ## not specified it will only create an index for transactions that are related to the wallet or have unspent outputs. -# ## This is specific to chainquery. - -## Ensure perms are correct prior to running main binary -mkdir -p /data/.lbrycrd -chown -R 1000:1000 /data -chmod -R 755 /data -# chown -R 1000:1000 /etc/lbrycrdd -# chmod -R 755 /etc/lbrycrdd -rm -f /var/run/lbrycrdd.pid - -## Set config params -echo 'rpcuser=lbryrpc\nrpcpassword='${RPC_PASSWORD:-changeme} > ~/.lbrycrd/lbrycrd.conf -echo "rpcallowip=${RPC_ALLOW_IP:-10.6.1.3}" >> ~/.lbrycrd/lbrycrd.conf -echo "rpcuser=${RPC_USER:-lbryrpc}" >> ~/.lbrycrd/lbrycrd.conf - -## Control this invocation through envvar. -case ${RUN_MODE:-default} in - default ) - lbrycrdd \ - -server \ - -conf=$HOME/.lbrycrd/lbrycrd.conf \ - -printtoconsole - ;; - reindex ) - lbrycrdd \ - -server \ - -txindex \ - -reindex \ - -conf=$HOME/.lbrycrd/lbrycrd.conf \ - -printtoconsole - ;; - chainquery ) - lbrycrdd \ - -server \ - -txindex \ - -conf=$HOME/.lbrycrd/lbrycrd.conf \ - -printtoconsole - ;; -esac - - -## We were unsure if these function as intended so they were disabled for the time being. -# -port=${PORT:-9246} \ -# -data=${DATA_DIR:-/data/} \ -# -pid=${PID_FILE:/var/run/lbrycrdd.pid} \ -# -rpcport=${RPC_PORT:-9245} \ -# -rpcpassword=${RPC_PASSWORD:-changeme} \ -# -rpcuser=${RPC_USER:-lbryrpc} \ -# -rpcallowip=${RPC_ALLOW_IP:-10.6.1.3} diff --git a/lbrycrd/docker-compose.yml b/lbrycrd/compose/docker-compose.yml-prod-example similarity index 80% rename from lbrycrd/docker-compose.yml rename to lbrycrd/compose/docker-compose.yml-prod-example index 5157972..5e01726 100644 --- a/lbrycrd/docker-compose.yml +++ b/lbrycrd/compose/docker-compose.yml-prod-example @@ -14,10 +14,8 @@ services: networks: lbry-network: ipv4_address: 10.6.1.2 - labels: - - "traefik.expose=false" environment: - RUN_MODE: chainquery + RUN_MODE: default env_file: - env expose: @@ -25,4 +23,4 @@ services: - 9246 ## host volumes for persistent data such as wallet private keys. volumes: - - "./data:/data" + - "../persist/data:/data" diff --git a/lbrycrd/regtest/docker-compose.yml b/lbrycrd/compose/docker-compose.yml-regtest similarity index 80% rename from lbrycrd/regtest/docker-compose.yml rename to lbrycrd/compose/docker-compose.yml-regtest index 08efe1c..2c1017a 100644 --- a/lbrycrd/regtest/docker-compose.yml +++ b/lbrycrd/compose/docker-compose.yml-regtest @@ -7,11 +7,9 @@ services: lbrycrd: image: tiger5226/regtest restart: always - labels: - - "traefik.expose=true" ports: - "11336:9246" - "11337:11337" ## host volumes for persistent data such as wallet private keys. volumes: - - "./data:/data" + - "../persist/data:/data" diff --git a/lbrycrd/testnet/docker-compose.yml b/lbrycrd/compose/docker-compose.yml-testnet similarity index 58% rename from lbrycrd/testnet/docker-compose.yml rename to lbrycrd/compose/docker-compose.yml-testnet index bf0e64a..103789a 100644 --- a/lbrycrd/testnet/docker-compose.yml +++ b/lbrycrd/compose/docker-compose.yml-testnet @@ -1,5 +1,14 @@ version: '3.4' +## README +# To run a local instance of testnet via docker: +# +# 1) clone this repository +# +# 2) Run `cd ./lbrycrd/testnet` +# +# 3) Run `docker-compose up -d` + services: ############# ## Lbrycrd ## @@ -7,11 +16,9 @@ services: lbrycrd: image: tiger5226/testnet restart: always - labels: - - "traefik.expose=true" ports: - "11336:9246" - "11337:11337" ## host volumes for persistent data such as wallet private keys. volumes: - - "./data:/data" + - "../persist/data:/data" diff --git a/lbrycrd/Dockerfile b/lbrycrd/linux-x86_64-production/Dockerfile similarity index 81% rename from lbrycrd/Dockerfile rename to lbrycrd/linux-x86_64-production/Dockerfile index 0b1c949..636c52e 100644 --- a/lbrycrd/Dockerfile +++ b/lbrycrd/linux-x86_64-production/Dockerfile @@ -7,16 +7,17 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* WORKDIR / SHELL ["/bin/bash", "-o", "pipefail", "-c"] -COPY stuff/start.sh start -COPY stuff/healthcheck.sh healthcheck -COPY stuff/fix-permissions.c fix-permissions.c +COPY ../stuff/start.sh start +COPY ../stuff/healthcheck.sh healthcheck +COPY ../stuff/advance_blocks.sh advance +COPY ../stuff/fix-permissions.c fix-permissions.c RUN curl -L -o ./lbrycrd-linux.zip $(curl -s https://api.github.com/repos/lbryio/lbrycrd/releases | grep -F 'lbrycrd-linux.zip' | grep download | head -n 1 | cut -d'"' -f4) && \ unzip ./lbrycrd-linux.zip && \ gcc fix-permissions.c -o fix-permissions && \ - chmod +x ./lbrycrdd ./lbrycrd-cli ./lbrycrd-tx ./start ./healthcheck ./fix-permissions + chmod +x ./lbrycrdd ./lbrycrd-cli ./lbrycrd-tx ./start ./healthcheck ./fix-permissions ./advance FROM ubuntu:18.04 as app -COPY --from=prep /lbrycrdd /lbrycrd-cli /lbrycrd-tx /start /healthcheck /fix-permissions /usr/bin/ +COPY --from=prep /lbrycrdd /lbrycrd-cli /lbrycrd-tx /start /healthcheck /fix-permissions /advance /usr/bin/ RUN addgroup --gid 1000 lbrycrd && \ adduser lbrycrd --uid 1000 --gid 1000 --gecos GECOS --shell /bin/bash --disabled-password --home /data && \ chmod a+s /usr/bin/fix-permissions diff --git a/lbrycrd/regtest/Dockerfile b/lbrycrd/regtest/Dockerfile deleted file mode 100644 index 8869118..0000000 --- a/lbrycrd/regtest/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -## This base image is for running latest lbrycrdd -# For some reason I may switch this image over to Alpine when I can RCA why it won't start. -FROM ubuntu:18.04 -LABEL MAINTAINER="beamer@lbry.io" - -RUN addgroup --gid 1000 lbrycrd && \ - adduser lbrycrd --uid 1000 --gid 1000 --gecos GECOS --shell /bin/bash --disabled-password --home /data && \ - apt-get update && \ - apt-get -y install unzip wget curl && \ - apt-get autoclean -y && \ - rm -rf /var/lib/apt/lists/* - -## TODO: Consider adding debugpaste or variant -# RUN wget -O /usr/bin/debugpaste https://github.com/nixc-us/debugpaste-it/raw/master/bin/debugpaste_64 && \ -# chmod +x /usr/bin/debugpaste - -RUN wget -O /usr/bin/lbrycrd-linux.zip https://github.com/lbryio/lbrycrd/releases/download/v0.12.4.0/lbrycrd-linux.zip && \ - cd /usr/bin/ && \ - unzip lbrycrd-linux.zip && \ - rm lbrycrd-linux.zip && \ - chmod +x lbrycrdd lbrycrd-cli lbrycrd-tx - -COPY start.sh /usr/local/bin/start -COPY advance_blocks.sh /usr/local/bin/advance -COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint - -# USER lbrycrd -# RUN mkdir /data -VOLUME ["/data"] -WORKDIR /data - -## Exposing daemon port and RPC port -EXPOSE 9245 9246 - -## TODO: Decide what's important for lbrycrd and possibly add an entrypoint. -## Maybe catch things that might match things that can be easily executed in the -## lbrycrd cli and if nothing is entered just default to the containers shell. -## For now this is a placeholder that executes /bin/bash on `docker exec` -# ENTRYPOINT ["docker-entrypoint"] - -CMD ["start"] diff --git a/lbrycrd/regtest/docker-entrypoint.sh b/lbrycrd/regtest/docker-entrypoint.sh deleted file mode 100755 index 77e798a..0000000 --- a/lbrycrd/regtest/docker-entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# default to run whatever the user wanted like "/bin/bash" -## If user runs no need to run any more of the entrypoint script. -if [[ -z "$@" ]]; then - echo "User did not attempt input. Now executing docker-entrypoint." -else - echo "Running $@." - exec "$@" - exit 1 -fi - -/bin/bash diff --git a/lbrycrd/regtest/start.sh b/lbrycrd/regtest/start.sh deleted file mode 100755 index ae77633..0000000 --- a/lbrycrd/regtest/start.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -# ## ToDo: Get a test case to see if this is the first run or a repeat run. -# ## If it's a first run you need to do a full index including all transactions -# ## tx index creates an index of every single transaction in the block history if -# ## not specified it will only create an index for transactions that are related to the wallet or have unspent outputs. -# ## This is specific to chainquery. - -## Ensure perms are correct prior to running main binary -mkdir -p /data/.lbrycrd -chown -R lbrycrd:lbrycrd /data -chmod -R 755 /data/ - -## TODO: Consider a config directory for future magic. -# chown -R 1000:1000 /etc/lbrycrd -# chmod -R 755 /etc/lbrycrd -rm -f /var/run/lbrycrd.pid - - -## Set config params -## TODO: Make this more automagic in the future. -echo "rpcuser=lbry" > /data/.lbrycrd/lbrycrd.conf -echo "rpcpassword=lbry" >> /data/.lbrycrd/lbrycrd.conf -echo "rpcport=11337" >> /data/.lbrycrd/lbrycrd.conf -echo "rpcbind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf -echo "rpcallowip=0.0.0.0/0" >> /data/.lbrycrd/lbrycrd.conf -echo "regtest=1" >> /data/.lbrycrd/lbrycrd.conf -echo "txindex=1" >> /data/.lbrycrd/lbrycrd.conf -echo "server=1" >> /data/.lbrycrd/lbrycrd.conf -echo "printtoconsole=1" >> /data/.lbrycrd/lbrycrd.conf - -#nohup advance &>/dev/null & -su -c "lbrycrdd -conf=/data/.lbrycrd/lbrycrd.conf" lbrycrd - diff --git a/lbrycrd/regtest/upload.sh b/lbrycrd/regtest/upload.sh deleted file mode 100755 index 45ccd9d..0000000 --- a/lbrycrd/regtest/upload.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -docker build -t tiger5226/regtest:latest . -docker push tiger5226/regtest:latest \ No newline at end of file diff --git a/lbrycrd/regtest/advance_blocks.sh b/lbrycrd/stuff/advance_blocks.sh similarity index 96% rename from lbrycrd/regtest/advance_blocks.sh rename to lbrycrd/stuff/advance_blocks.sh index 922d38a..f29b28b 100755 --- a/lbrycrd/regtest/advance_blocks.sh +++ b/lbrycrd/stuff/advance_blocks.sh @@ -2,4 +2,4 @@ while true; do lbrycrd-cli -conf=/data/.lbrycrd/lbrycrd.conf generate 1 >> /tmp/output.log sleep 2 -done \ No newline at end of file +done diff --git a/lbrycrd/stuff/debugpaste-it.sh b/lbrycrd/stuff/debugpaste-it.sh deleted file mode 100755 index 7cdd39f..0000000 --- a/lbrycrd/stuff/debugpaste-it.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -echo "placeholder for now, come back soon for more debugging magic" diff --git a/lbrycrd/stuff/docker-entrypoint.sh b/lbrycrd/stuff/docker-entrypoint.sh deleted file mode 100755 index 77e798a..0000000 --- a/lbrycrd/stuff/docker-entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# default to run whatever the user wanted like "/bin/bash" -## If user runs no need to run any more of the entrypoint script. -if [[ -z "$@" ]]; then - echo "User did not attempt input. Now executing docker-entrypoint." -else - echo "Running $@." - exec "$@" - exit 1 -fi - -/bin/bash diff --git a/lbrycrd/stuff/start.sh b/lbrycrd/stuff/start.sh index 49abf46..725961a 100755 --- a/lbrycrd/stuff/start.sh +++ b/lbrycrd/stuff/start.sh @@ -1,20 +1,23 @@ #!/usr/bin/env bash -CONFIG_PATH=/etc/lbry/lbrycrd.conf -if [ -f "$CONFIG_PATH" ] -then - echo "Using the config file that was mounted into the container." -else - echo "Creating a fresh config file from environment variables." - ## Set config params - mkdir -p `dirname $CONFIG_PATH` - echo "rpcuser=$RPC_USER" > $CONFIG_PATH - echo "rpcpassword=$RPC_PASSWORD" >> $CONFIG_PATH - echo "rpcallowip=$RPC_ALLOW_IP" >> $CONFIG_PATH - echo "rpcport=9245" >> $CONFIG_PATH - echo "rpcbind=0.0.0.0" >> $CONFIG_PATH - #echo "bind=0.0.0.0" >> $CONFIG_PATH -fi +function set_config() { + CONFIG_PATH=/etc/lbry/lbrycrd.conf + if [ -f "$CONFIG_PATH" ] + then + echo "Using the config file that was mounted into the container." + else + echo "Creating a fresh config file from environment variables." + ## Set config params + mkdir -p `dirname $CONFIG_PATH` + echo "rpcuser=$RPC_USER" > $CONFIG_PATH + echo "rpcpassword=$RPC_PASSWORD" >> $CONFIG_PATH + echo "rpcallowip=$RPC_ALLOW_IP" >> $CONFIG_PATH + echo "rpcport=9245" >> $CONFIG_PATH + echo "rpcbind=0.0.0.0" >> $CONFIG_PATH + #echo "bind=0.0.0.0" >> $CONFIG_PATH + fi +} + ## Ensure perms are correct prior to running main binary /usr/bin/fix-permissions @@ -22,19 +25,58 @@ fi ## You can optionally specify a run mode if you want to use lbry defined presets for compatibility. case $RUN_MODE in default ) + set_config lbrycrdd -server -conf=$CONFIG_PATH -printtoconsole ;; -## If it's a first run you need to do a full index including all transactions -## tx index creates an index of every single transaction in the block history if -## not specified it will only create an index for transactions that are related to the wallet or have unspent outputs. -## This is generally specific to chainquery. + ## If it's a first run you need to do a full index including all transactions + ## tx index creates an index of every single transaction in the block history if + ## not specified it will only create an index for transactions that are related to the wallet or have unspent outputs. + ## This is generally specific to chainquery. reindex ) - ## Apply this RUN_MODE in the case you need to update a dataset. NOTE: you do not need to use `RUN_MODE reindex` for more than one complete run. + ## Apply this RUN_MODE in the case you need to update a dataset. NOTE: you do not need to use `RUN_MODE reindex` for more than one complete run. + set_config lbrycrdd -server -txindex -reindex -conf=$CONFIG_PATH -printtoconsole ;; chainquery ) - ## If your only goal is to run Chainquery against this instance of lbrycrd and you're starting a - ## fresh local dataset use this run mode. + ## If your only goal is to run Chainquery against this instance of lbrycrd and you're starting a + ## fresh local dataset use this run mode. + set_config lbrycrdd -server -txindex -conf=$CONFIG_PATH -printtoconsole ;; + regtest ) + ## Set config params + ## TODO: Make this more automagic in the future. + echo "rpcuser=lbry" > /data/.lbrycrd/lbrycrd.conf + echo "rpcpassword=lbry" >> /data/.lbrycrd/lbrycrd.conf + echo "rpcport=11337" >> /data/.lbrycrd/lbrycrd.conf + echo "rpcbind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf + echo "rpcallowip=0.0.0.0/0" >> /data/.lbrycrd/lbrycrd.conf + echo "regtest=1" >> /data/.lbrycrd/lbrycrd.conf + echo "txindex=1" >> /data/.lbrycrd/lbrycrd.conf + echo "server=1" >> /data/.lbrycrd/lbrycrd.conf + echo "printtoconsole=1" >> /data/.lbrycrd/lbrycrd.conf + + #nohup advance &>/dev/null & + su -c "lbrycrdd -conf=/data/.lbrycrd/lbrycrd.conf" lbrycrd + ;; + testnet ) + ## Set config params + ## TODO: Make this more automagic in the future. + echo "rpcuser=lbry" > /data/.lbrycrd/lbrycrd.conf + echo "rpcpassword=lbry" >> /data/.lbrycrd/lbrycrd.conf + echo "rpcport=11337" >> /data/.lbrycrd/lbrycrd.conf + echo "rpcbind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf + echo "rpcallowip=0.0.0.0/0" >> /data/.lbrycrd/lbrycrd.conf + echo "testnet=1" >> /data/.lbrycrd/lbrycrd.conf + echo "txindex=1" >> /data/.lbrycrd/lbrycrd.conf + echo "server=1" >> /data/.lbrycrd/lbrycrd.conf + echo "printtoconsole=1" >> /data/.lbrycrd/lbrycrd.conf + + #nohup advance &>/dev/null & + su -c "lbrycrdd -conf=/data/.lbrycrd/lbrycrd.conf" lbrycrd + ;; + * ) + echo "Error, you must define a RUN_MODE environment variable." + echo "Available options are testnet, regtest, chainquery, default, and reindex" + ;; esac diff --git a/lbrycrd/testnet/Dockerfile b/lbrycrd/testnet/Dockerfile deleted file mode 100644 index b5e4693..0000000 --- a/lbrycrd/testnet/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -## This base image is for running latest lbrycrdd -# For some reason I may switch this image over to Alpine when I can RCA why it won't start. -FROM ubuntu:18.04 -LABEL MAINTAINER="leopere [at] nixc [dot] us" - -RUN addgroup --gid 1000 lbrycrd && \ - adduser lbrycrd --uid 1000 --gid 1000 --gecos GECOS --shell /bin/bash --disabled-password --home /data && \ - apt-get update && \ - apt-get -y install unzip wget curl && \ - apt-get autoclean -y && \ - rm -rf /var/lib/apt/lists/* - -## TODO: Consider adding debugpaste or variant -# RUN wget -O /usr/bin/debugpaste https://github.com/nixc-us/debugpaste-it/raw/master/bin/debugpaste_64 && \ -# chmod +x /usr/bin/debugpaste - -RUN wget -O /usr/bin/lbrycrd-linux.zip https://github.com/lbryio/lbrycrd/releases/download/v0.12.3.1/lbrycrd-linux.zip && \ - cd /usr/bin/ && \ - unzip lbrycrd-linux.zip && \ - rm lbrycrd-linux.zip && \ - chmod +x lbrycrdd lbrycrd-cli lbrycrd-tx - -COPY start.sh /usr/local/bin/start -COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint - -# USER lbrycrd -# RUN mkdir /data -VOLUME ["/data"] -WORKDIR /data - -## Exposing daemon port and RPC port -EXPOSE 9245 9246 - -## TODO: Decide what's important for lbrycrd and possibly add an entrypoint. -## Maybe catch things that might match things that can be easily executed in the -## lbrycrd cli and if nothing is entered just default to the containers shell. -## For now this is a placeholder that executes /bin/bash on `docker exec` -# ENTRYPOINT ["docker-entrypoint"] - -CMD ["start"] diff --git a/lbrycrd/testnet/README.md b/lbrycrd/testnet/README.md deleted file mode 100644 index 7478937..0000000 --- a/lbrycrd/testnet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -To run a local instance of testnet via docker: - - 1) clone this repository - - 2) Run `cd ./lbrycrd/testnet` - - 3) Run `docker-compose up -d` \ No newline at end of file diff --git a/lbrycrd/testnet/docker-entrypoint.sh b/lbrycrd/testnet/docker-entrypoint.sh deleted file mode 100755 index 77e798a..0000000 --- a/lbrycrd/testnet/docker-entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# default to run whatever the user wanted like "/bin/bash" -## If user runs no need to run any more of the entrypoint script. -if [[ -z "$@" ]]; then - echo "User did not attempt input. Now executing docker-entrypoint." -else - echo "Running $@." - exec "$@" - exit 1 -fi - -/bin/bash diff --git a/lbrycrd/testnet/start.sh b/lbrycrd/testnet/start.sh deleted file mode 100755 index 0d3fb2d..0000000 --- a/lbrycrd/testnet/start.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -# ## ToDo: Get a test case to see if this is the first run or a repeat run. -# ## If it's a first run you need to do a full index including all transactions -# ## tx index creates an index of every single transaction in the block history if -# ## not specified it will only create an index for transactions that are related to the wallet or have unspent outputs. -# ## This is specific to chainquery. - -## Ensure perms are correct prior to running main binary -mkdir -p /data/.lbrycrd -chown -R lbrycrd:lbrycrd /data -chmod -R 755 /data/ - -## TODO: Consider a config directory for future magic. -# chown -R 1000:1000 /etc/lbrycrd -# chmod -R 755 /etc/lbrycrd -rm -f /var/run/lbrycrd.pid - - -## Set config params -## TODO: Make this more automagic in the future. -echo "rpcuser=lbry" > /data/.lbrycrd/lbrycrd.conf -echo "rpcpassword=lbry" >> /data/.lbrycrd/lbrycrd.conf -echo "rpcport=11337" >> /data/.lbrycrd/lbrycrd.conf -echo "rpcbind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf -echo "rpcallowip=0.0.0.0/0" >> /data/.lbrycrd/lbrycrd.conf -echo "testnet=1" >> /data/.lbrycrd/lbrycrd.conf -echo "txindex=1" >> /data/.lbrycrd/lbrycrd.conf -echo "server=1" >> /data/.lbrycrd/lbrycrd.conf -echo "printtoconsole=1" >> /data/.lbrycrd/lbrycrd.conf - -#nohup advance &>/dev/null & -su -c "lbrycrdd -conf=/data/.lbrycrd/lbrycrd.conf" lbrycrd - diff --git a/lbrycrd/testnet/upload.sh b/lbrycrd/testnet/upload.sh deleted file mode 100755 index afb3b98..0000000 --- a/lbrycrd/testnet/upload.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -docker build -t tiger5226/testnet:latest . -docker push tiger5226/testnet:latest \ No newline at end of file diff --git a/lbrynet/.dockerignore b/lbrynet/.dockerignore deleted file mode 100644 index 8fce603..0000000 --- a/lbrynet/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -data/ diff --git a/lbrynet/compile/README.md b/lbrynet/compile/README.md deleted file mode 100644 index 47ab7b1..0000000 --- a/lbrynet/compile/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Planned container [WIP/Planned] -This will eventually be a container for compiling the lbrynet-daemon from source. -Anyone who wants to replicate the build process in case they feel like wearing a tin foil hat or contributing to the project could use this. diff --git a/lbrynet/linux-armhf-compiler/Dockerfile b/lbrynet/linux-armhf-compiler/Dockerfile index ad8e7ff..c4a73cd 100644 --- a/lbrynet/linux-armhf-compiler/Dockerfile +++ b/lbrynet/linux-armhf-compiler/Dockerfile @@ -31,11 +31,13 @@ RUN apt-get update && \ FROM dependencies as compile RUN python3.7 -m pip install -U pyinstaller && \ - git clone https://github.com/lbryio/lbry.git --depth 1 /lbry && \ - cd /lbry && \ - git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba && \ - cd /lbry/torba && python3.7 -m pip install -e . && \ - cd /lbry/ && python3.7 scripts/set_build.py && \ + git clone https://github.com/lbryio/lbry.git --depth 1 /lbry + WORKDIR /lbry +RUN git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba +WORKDIR /lbry/torba +RUN python3.7 -m pip install -e . +WORKDIR /lbry/ +RUN python3.7 scripts/set_build.py && \ python3.7 -m pip install -e . && \ pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \ chmod +x /lbry/dist/lbrynet && \ @@ -45,7 +47,7 @@ RUN python3.7 -m pip install -U pyinstaller && \ FROM multiarch/ubuntu-core:armhf-bionic as app RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet -COPY start.sh /usr/local/bin/start +COPY ../stuff/start.sh /usr/local/bin/start COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/ EXPOSE 5279 USER lbrynet diff --git a/lbrynet/linux-armhf-compiler/start.sh b/lbrynet/linux-armhf-compiler/start.sh deleted file mode 100644 index 7aa0dcc..0000000 --- a/lbrynet/linux-armhf-compiler/start.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo "TODO" diff --git a/lbrynet/linux-armhf-production/.gitkeep b/lbrynet/linux-armhf-production/.gitkeep new file mode 100644 index 0000000..a4b008f --- /dev/null +++ b/lbrynet/linux-armhf-production/.gitkeep @@ -0,0 +1 @@ +# TODO: Prepare a container for deployment on armhf architecture. diff --git a/lbrynet/linux-x86_64-compiler/Dockerfile b/lbrynet/linux-x86_64-compiler/Dockerfile index ad1b3df..0694f9b 100644 --- a/lbrynet/linux-x86_64-compiler/Dockerfile +++ b/lbrynet/linux-x86_64-compiler/Dockerfile @@ -31,11 +31,13 @@ RUN apt-get update && \ FROM dependencies as compile RUN python3.7 -m pip install -U pyinstaller && \ - git clone https://github.com/lbryio/lbry.git --depth 1 /lbry && \ - cd /lbry && \ - git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba && \ - cd /lbry/torba && python3.7 -m pip install -e . && \ - cd /lbry/ && python3.7 scripts/set_build.py && \ + git clone https://github.com/lbryio/lbry.git --depth 1 /lbry +WORKDIR /lbry +RUN git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba +WORKDIR /lbry/torba +RUN python3.7 -m pip install -e . +WORKDIR /lbry/ +RUN python3.7 scripts/set_build.py && \ python3.7 -m pip install -e . && \ pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \ chmod +x /lbry/dist/lbrynet && \ @@ -45,7 +47,7 @@ RUN python3.7 -m pip install -U pyinstaller && \ FROM ubuntu:18.04 as app RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet -COPY start.sh /usr/local/bin/start +COPY ../stuff/start.sh /usr/local/bin/start COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/ EXPOSE 5279 USER lbrynet diff --git a/lbrynet/linux-x86_64-compiler/start.sh b/lbrynet/linux-x86_64-compiler/start.sh deleted file mode 100644 index 7aa0dcc..0000000 --- a/lbrynet/linux-x86_64-compiler/start.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo "TODO" diff --git a/lbrynet/stuff/debugpaste-it.sh b/lbrynet/stuff/debugpaste-it.sh deleted file mode 100755 index 54d00fb..0000000 --- a/lbrynet/stuff/debugpaste-it.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo "For now we're going to go with a tune in next time for a debugpaste." diff --git a/lbrynet/stuff/docker-entrypoint.sh b/lbrynet/stuff/docker-entrypoint.sh deleted file mode 100755 index 991030f..0000000 --- a/lbrynet/stuff/docker-entrypoint.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -## TODO: Start work for the docker-entrypoint.sh for lbrynet daemon \ No newline at end of file