From 69c8468e8fdf9630931a6cc3c32e4766d71640df Mon Sep 17 00:00:00 2001 From: Ryan McGuire Date: Wed, 24 Apr 2019 11:33:35 -0400 Subject: [PATCH] Refactor lbrynet compiler container locations and startup mechanics --- .../Dockerfile => Dockerfile-armhf-compiler} | 2 +- .../Dockerfile => Dockerfile-x86_64-compiler} | 2 +- lbrynet/README.md | 29 +++++++------------ lbrynet/linux-armhf-compiler/README.md | 28 ------------------ lbrynet/linux-x86_64-compiler/README.md | 12 -------- lbrynet/stuff/start.sh | 19 ++---------- 6 files changed, 15 insertions(+), 77 deletions(-) rename lbrynet/{linux-armhf-compiler/Dockerfile => Dockerfile-armhf-compiler} (97%) rename lbrynet/{linux-x86_64-compiler/Dockerfile => Dockerfile-x86_64-compiler} (97%) delete mode 100644 lbrynet/linux-armhf-compiler/README.md delete mode 100644 lbrynet/linux-x86_64-compiler/README.md diff --git a/lbrynet/linux-armhf-compiler/Dockerfile b/lbrynet/Dockerfile-armhf-compiler similarity index 97% rename from lbrynet/linux-armhf-compiler/Dockerfile rename to lbrynet/Dockerfile-armhf-compiler index c4a73cd..257ea33 100644 --- a/lbrynet/linux-armhf-compiler/Dockerfile +++ b/lbrynet/Dockerfile-armhf-compiler @@ -47,7 +47,7 @@ RUN python3.7 scripts/set_build.py && \ FROM multiarch/ubuntu-core:armhf-bionic as app RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet -COPY ../stuff/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/Dockerfile b/lbrynet/Dockerfile-x86_64-compiler similarity index 97% rename from lbrynet/linux-x86_64-compiler/Dockerfile rename to lbrynet/Dockerfile-x86_64-compiler index 0694f9b..cb13428 100644 --- a/lbrynet/linux-x86_64-compiler/Dockerfile +++ b/lbrynet/Dockerfile-x86_64-compiler @@ -47,7 +47,7 @@ RUN python3.7 scripts/set_build.py && \ FROM ubuntu:18.04 as app RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet -COPY ../stuff/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/README.md b/lbrynet/README.md index 3b3a49d..1d99c70 100644 --- a/lbrynet/README.md +++ b/lbrynet/README.md @@ -1,24 +1,17 @@ -## lbrynet-As-A-Container +# lbrynet -More documentation to come however the Invocation section should include enough to get you going. You're going to need at least docker docker-compose and git installed on whatever host OS you wish to use. +## Compiler containers + +The compiler containers are for building lbrynet for multiple architectures. + +### Build x86 compiler container -#### Invocation -This will get you a running copy of the lbrynet-daemon running inside of a docker container with default settings. ``` -git clone https://github.com/chamunks/lbry-docker.git -cd ./lbry-docker/lbrynet/ -docker-compose up -d +docker build -t lbrynet-x86_64 -f Dockerfile-x86_64-compiler . ``` -#### Executing commands +### Build ARM compiler container -To list containers on the host execute `docker ps -a` then run `docker exec CONTAINERNAME lbrynet-cli commands` - -#### Docker Directory - -This directory is in case we need to expand the functionality of this container at some point in the future. - -#### Configuration -There's really no configuration required to launch this just launch it. However your blockchain data and other things are currently located in the applications home Directory here's a link to the [Documentation](https://lbry.io/faq/lbry-directories) for useful directories with lbrynet-daemon - -*daemon_settings.yml* is on its way and it will be configurable soon via env-vars with *docker-compose.yml* +``` +docker build -t lbrynet-armhf -f Dockerfile-armhf-compiler . +``` diff --git a/lbrynet/linux-armhf-compiler/README.md b/lbrynet/linux-armhf-compiler/README.md deleted file mode 100644 index 2689438..0000000 --- a/lbrynet/linux-armhf-compiler/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# armhf-compiler - -This container's goal is to make CI/CD easier for everyone, Travis CI, GitlabCI, Jenkins... Your desktop's docker equipped development environment. - -## Example Usage - -#### binfmt_misc register -This step sets up your docker daemon to support more container architectures. - -Register `quemu-*-static` for all supported processors except the current one. -* `docker run --rm --privileged multiarch/qemu-user-static:register` - -#### build the armhf bin - -* `docker build --tag lbryio/lbrynet:armhf-compiler .` - -#### export compiled bin to local /target -This containers sole purpose is to build and spit out the bin. - -* `docker run --rm -ti -v $(pwd)/target:/target lbryio/lbrynet:armhf-compiler` - - -## Cleanup -If you're doing this on a machine you care to have restored to defaults this is the only host change we imposed so to revert the change you must execute the following docker command. - -Same as above, but remove all registered `binfmt_misc` before -* `docker run --rm --privileged multiarch/qemu-user-static:register --reset` - diff --git a/lbrynet/linux-x86_64-compiler/README.md b/lbrynet/linux-x86_64-compiler/README.md deleted file mode 100644 index f8ff870..0000000 --- a/lbrynet/linux-x86_64-compiler/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# x86_64-compiler - -This container's goal is to make CI/CD easier for everyone, Travis CI, GitlabCI, Jenkins... Your desktop's docker equipped development environment. - -## Example Usage - -#### build the x86_64 bin -* `docker build --tag lbryio/lbrynet:x86_64-compiler .` - -#### export compiled bin to local /target -This containers sole purpose is to build and spit out the x86_64 binary. -* `docker run --rm -ti -v $(pwd)/target:/target lbryio/lbrynet:x86_64-compiler` diff --git a/lbrynet/stuff/start.sh b/lbrynet/stuff/start.sh index e5d494a..43ae4ba 100755 --- a/lbrynet/stuff/start.sh +++ b/lbrynet/stuff/start.sh @@ -1,17 +1,2 @@ -#!/usr/bin/env bash -## Scope: This start.sh script will asssert container filesystem permissions and -## then execute the desired run mode for lbrynet with reduced permissions. -## The other thing this should do is simply create, configure or simply establish -## a fresh config with envvars passed to the container. - -## Ensure perms are correct prior to running main binary -mkdir -p /lbrynet -chown -R lbrynet:lbrynet /lbrynet -chmod -R 755 /lbrynet - -## TODO: Consider a config directory for future magic. -# chown -R 1000:1000 /etc/lbrynet -# chmod -R 755 /etc/lbrynet -# rm -f /var/run/lbrynet.pid - -su -c "lbrynet start" lbrynet \ No newline at end of file +#!/bin/bash +lbrynet start