Lbrynet containers for compiling and running armhf and x86_64 #53
16 changed files with 272 additions and 0 deletions
1
lbrynet/.dockerignore
Normal file
1
lbrynet/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
data/
|
1
lbrynet/.gitignore
vendored
Normal file
1
lbrynet/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
data/
|
44
lbrynet/Dockerfile
Normal file
44
lbrynet/Dockerfile
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
## This base image is for running the latest lbrynet-daemon release.
|
||||||
|
FROM ubuntu:18.04
|
||||||
|
LABEL MAINTAINER="leopere [at] nixc [dot] us"
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get -y install unzip
|
||||||
|
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /lbrynet/
|
||||||
|
|
||||||
|
## Add lbrynet
|
||||||
|
ADD https://lbry.io/get/lbrynet.linux.zip /lbrynet/lbrynet.linux.zip
|
||||||
|
RUN unzip /lbrynet/lbrynet.linux.zip -d /lbrynet/ && \
|
||||||
|
rm /lbrynet/lbrynet.linux.zip && \
|
||||||
|
chown -Rv lbrynet:lbrynet /lbrynet && \
|
||||||
|
mv /lbrynet/lbrynet /bin/
|
||||||
|
|
||||||
|
# COPY stuff/debugpaste-it.sh /usr/local/bin/debugpaste-it
|
||||||
|
COPY stuff/start.sh /usr/local/bin/start
|
||||||
|
COPY stuff/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
||||||
|
COPY stuff/healthcheck.sh /usr/local/bin/healthcheck
|
||||||
|
|
||||||
|
## Daemon port [Intended for internal use]
|
||||||
|
## LBRYNET talks to peers on port 3333 [Intended for external use] this port is used to discover other lbrynet daemons with blobs.
|
||||||
|
## Expose 5566 Reflector port to listen on
|
||||||
|
## Expose 5279 Port the daemon API will listen on
|
||||||
|
## the lbryumx aka Wallet port [Intended for internal use]
|
||||||
|
EXPOSE 4444 3333 5566 5279 50001
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## TODO: Have wallets stored on their own volume/subdirectory for security, and backups.
|
||||||
|
## Volumize the wallets in a separate location for backup purposes may be unnecessary.
|
||||||
|
# VOLUME /lbrynet/.local/share/lbry/lbryum/wallets
|
||||||
|
# VOLUME /lbrynet/.local/
|
||||||
|
|
||||||
|
## Example daemon_settings.yml is at https://github.com/lbryio/lbry/blob/master/example_daemon_settings.yml
|
||||||
|
ADD https://raw.githubusercontent.com/lbryio/lbry/master/example_daemon_settings.yml /etc/lbrynet/example_daemon_settings.yml
|
||||||
|
## TODO: In start.sh detect and merge changes.
|
||||||
|
# VOLUME /etc/lbry/daemon_settings.yml
|
||||||
|
|
||||||
|
## TODO: Downloaded blobs will be in their own separate volume for keeping backups of critical secrets and data separate from backups of potentially massive blob files.
|
||||||
|
# VOLUME /lbrynet/Downloads/
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
|
||||||
|
CMD ["start"]
|
24
lbrynet/README.md
Normal file
24
lbrynet/README.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
## lbrynet-As-A-Container
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
#### 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
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Executing commands
|
||||||
|
|
||||||
|
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*
|
3
lbrynet/compile/README.md
Normal file
3
lbrynet/compile/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
## 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.
|
27
lbrynet/docker-compose.yml
Normal file
27
lbrynet/docker-compose.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
version: '3.4'
|
||||||
|
|
||||||
|
networks:
|
||||||
|
lbry-network:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
#############
|
||||||
|
## Lbrynet ##
|
||||||
|
#############
|
||||||
|
lbrynet:
|
||||||
|
build: .
|
||||||
|
restart: always
|
||||||
|
## TODO: Does this container ever need a static network address or is it better to be dynamic?
|
||||||
|
networks:
|
||||||
|
# lbrynet:
|
||||||
|
# ipv4_address: 10.6.1.4
|
||||||
|
- lbry-network
|
||||||
|
labels:
|
||||||
|
- "traefik.expose=false"
|
||||||
|
## TODO: Verify the need for the following port binds on host networking.
|
||||||
|
ports:
|
||||||
|
- 4444:4444
|
||||||
|
- 50001:50001
|
||||||
|
## host volumes for persistent data such as wallet private keys.
|
||||||
|
volumes:
|
||||||
|
- ./data:/lbrynet
|
52
lbrynet/linux-armhf-compiler/Dockerfile
Normal file
52
lbrynet/linux-armhf-compiler/Dockerfile
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
FROM multiarch/ubuntu-core:armhf-bionic as dependencies
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
python3-pip \
|
||||||
|
python3.7 \
|
||||||
|
python3.7-dev \
|
||||||
|
build-essential \
|
||||||
|
libssl-dev \
|
||||||
|
libacl1-dev \
|
||||||
|
liblz4-dev \
|
||||||
|
libfuse-dev \
|
||||||
|
fuse \
|
||||||
|
pkg-config \
|
||||||
|
fakeroot \
|
||||||
|
git \
|
||||||
|
zlib1g-dev \
|
||||||
|
libbz2-dev \
|
||||||
|
libncurses5-dev \
|
||||||
|
libreadline-dev \
|
||||||
|
liblzma-dev \
|
||||||
|
libsqlite3-dev \
|
||||||
|
zip \
|
||||||
|
libffi-dev \
|
||||||
|
libleveldb-dev && \
|
||||||
|
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 && \
|
||||||
|
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10 && \
|
||||||
|
update-alternatives --config python && \
|
||||||
|
python --version && \
|
||||||
|
pip3 --version
|
||||||
|
|
||||||
|
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 && \
|
||||||
|
python3.7 -m pip install -e . && \
|
||||||
|
pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \
|
||||||
|
chmod +x /lbry/dist/lbrynet && \
|
||||||
|
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
|
||||||
|
mkdir /target && \
|
||||||
|
/lbry/dist/lbrynet --version
|
||||||
|
|
||||||
|
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 --from=compile /lbry/dist/lbrynet /usr/local/bin/
|
||||||
|
EXPOSE 5279
|
||||||
|
USER lbrynet
|
||||||
|
CMD ["start"]
|
28
lbrynet/linux-armhf-compiler/README.md
Normal file
28
lbrynet/linux-armhf-compiler/README.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# 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
|
||||||
|
<!-- TODO: Process could be greatly sped up but keeping it simple for first release. -->
|
||||||
|
* `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.
|
||||||
|
<!-- TODO: Fork this container base to begin work on LbryTV compiler to reduce build time on rpi -->
|
||||||
|
* `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`
|
||||||
|
|
2
lbrynet/linux-armhf-compiler/start.sh
Normal file
2
lbrynet/linux-armhf-compiler/start.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "TODO"
|
52
lbrynet/linux-x86_64-compiler/Dockerfile
Normal file
52
lbrynet/linux-x86_64-compiler/Dockerfile
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
FROM ubuntu:18.04 as dependencies
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
python3-pip \
|
||||||
|
python3.7 \
|
||||||
|
python3.7-dev \
|
||||||
|
build-essential \
|
||||||
|
libssl-dev \
|
||||||
|
libacl1-dev \
|
||||||
|
liblz4-dev \
|
||||||
|
libfuse-dev \
|
||||||
|
fuse \
|
||||||
|
pkg-config \
|
||||||
|
fakeroot \
|
||||||
|
git \
|
||||||
|
zlib1g-dev \
|
||||||
|
libbz2-dev \
|
||||||
|
libncurses5-dev \
|
||||||
|
libreadline-dev \
|
||||||
|
liblzma-dev \
|
||||||
|
libsqlite3-dev \
|
||||||
|
zip \
|
||||||
|
libffi-dev \
|
||||||
|
libleveldb-dev && \
|
||||||
|
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 && \
|
||||||
|
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10 && \
|
||||||
|
update-alternatives --config python && \
|
||||||
|
python --version && \
|
||||||
|
pip3 --version
|
||||||
|
|
||||||
|
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 && \
|
||||||
|
python3.7 -m pip install -e . && \
|
||||||
|
pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \
|
||||||
|
chmod +x /lbry/dist/lbrynet && \
|
||||||
|
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
|
||||||
|
mkdir /target && \
|
||||||
|
/lbry/dist/lbrynet --version
|
||||||
|
|
||||||
|
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 --from=compile /lbry/dist/lbrynet /usr/local/bin/
|
||||||
|
EXPOSE 5279
|
||||||
|
USER lbrynet
|
||||||
|
CMD ["start"]
|
12
lbrynet/linux-x86_64-compiler/README.md
Normal file
12
lbrynet/linux-x86_64-compiler/README.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# 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`
|
2
lbrynet/linux-x86_64-compiler/start.sh
Normal file
2
lbrynet/linux-x86_64-compiler/start.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "TODO"
|
2
lbrynet/stuff/debugpaste-it.sh
Executable file
2
lbrynet/stuff/debugpaste-it.sh
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "For now we're going to go with a tune in next time for a debugpaste."
|
3
lbrynet/stuff/docker-entrypoint.sh
Executable file
3
lbrynet/stuff/docker-entrypoint.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
## TODO: Start work for the docker-entrypoint.sh for lbrynet daemon
|
2
lbrynet/stuff/healthcheck.sh
Executable file
2
lbrynet/stuff/healthcheck.sh
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
## TODO: write a healthcheck script.
|
17
lbrynet/stuff/start.sh
Executable file
17
lbrynet/stuff/start.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/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
|
Loading…
Reference in a new issue