Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
832c2f6b1b | ||
|
|
607f8839ea | ||
|
|
1d3e5b7a39 | ||
|
|
f0b0c6da63 | ||
|
|
868c00b4cb | ||
|
|
846bc84f19 | ||
|
|
860b5b4fa5 | ||
|
|
aff973f5a9 | ||
|
|
d82e79100f | ||
|
|
7b063e217f | ||
|
|
1d575c28cf | ||
|
|
fbbf6d9eb1 | ||
|
|
ed0913b565 | ||
|
|
9189c45da4 | ||
|
|
8aff5e1a8c | ||
|
|
c1cfd936fa | ||
|
|
b285a49227 | ||
|
|
992a2ab7c9 | ||
|
|
cedb74dc3d | ||
|
|
38320c2204 | ||
|
|
2db22bccd1 | ||
|
|
020344c481 | ||
|
|
083c9f3906 | ||
|
|
1886f87b06 | ||
|
|
d37a932774 | ||
|
|
0d0c88c850 | ||
|
|
79c08b66f2 | ||
|
|
b206c5f3b4 | ||
|
|
c8ceb79651 | ||
|
|
062c72c5f4 | ||
|
|
adebf46603 | ||
|
|
68824f95e7 | ||
|
|
9a67d873f9 | ||
|
|
aae9221c72 | ||
|
|
1d6e17c810 | ||
|
|
ada255021c | ||
|
|
32d7abf54e |
No files matched your search
+2
-1
@@ -1,6 +1,7 @@
|
||||
.gitlab-ci.yml
|
||||
.DS_Store
|
||||
*/docker-compose.override.yml
|
||||
*/data/
|
||||
*/*/data
|
||||
|
||||
./docker-compose.yml
|
||||
*.zip
|
||||
+16
-45
@@ -1,52 +1,23 @@
|
||||
## This base image is for running latest chainquery
|
||||
## Get the latest source and extract it for the app container.
|
||||
## Design choices, two RUN layers intended to keep builds faster, the zipped
|
||||
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
|
||||
apt-get -y install unzip curl && \
|
||||
apt-get autoclean -y && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
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
|
||||
|
||||
## 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
|
||||
ADD https://raw.githubusercontent.com/lbryio/chainquery/master/config/default/chainqueryconfig.toml /etc/lbry/chainqueryconfig.toml.orig
|
||||
RUN adduser chainquery --gecos GECOS --shell /bin/bash --disabled-password --home /home/chainquery && \
|
||||
chown -R chainquery:chainquery /etc/lbry
|
||||
COPY --from=prep /chainquery /start /usr/bin/
|
||||
EXPOSE 6300
|
||||
|
||||
## Execute start script earlier installed into $PATH
|
||||
USER chainquery
|
||||
CMD ["start"]
|
||||
@@ -29,26 +29,23 @@ function set_configs() {
|
||||
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
|
||||
sed -i "s~$FROM_STRING~"$TO_STRING"~g" /etc/lbry/chainqueryconfig.toml
|
||||
done
|
||||
echo "Reading config for debugging."
|
||||
cat /etc/chainquery/chainqueryconfig.toml
|
||||
cat /etc/lbry/chainqueryconfig.toml
|
||||
}
|
||||
|
||||
if [[ ! -f /etc/chainquery/chainqueryconfig.toml ]]; then
|
||||
if [[ ! -f /etc/lbry/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/
|
||||
echo "cp -v /etc/lbry/chainqueryconfig.toml.orig /etc/lbry/chainqueryconfig.toml"
|
||||
cp -v /etc/lbry/chainqueryconfig.toml.orig /etc/lbry/chainqueryconfig.toml
|
||||
ls -lAh /etc/lbry/
|
||||
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
|
||||
echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/lbry"
|
||||
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
|
||||
chainquery serve --configpath "/etc/lbry/"
|
||||
@@ -0,0 +1,322 @@
|
||||
# LBRY cloud-init with systemd
|
||||
|
||||
Contributing Author: [EnigmaCurry](https://www.enigmacurry.com)
|
||||
|
||||
Last Update: April 18 2019
|
||||
|
||||
This is meant to be easy instructions for running a lbrycrd and chainquery
|
||||
service on DigitalOcean. It's pretty much just copy-and-paste.
|
||||
|
||||
This should also work on any host that supports
|
||||
[cloud-init](https://cloud-init.io/), but I've not tested it anywhere except for
|
||||
DigitalOcean.
|
||||
|
||||
If you wish to use docker-compose, there is an [alternative
|
||||
configuration](https://github.com/lbryio/lbry-docker/tree/master/lbrycrd)
|
||||
for that. This tutorial will use cloud-init and systemd to control docker.
|
||||
|
||||
## It's easy to run your own full lbrycrd node
|
||||
|
||||
[](https://spee.ch/@EnigmaCurry:d/lbrycrd-docker-cloud-init.mp4)
|
||||
|
||||
## Installation
|
||||
|
||||
* Login to your DigitalOcean account and create a new droplet.
|
||||
* Choose Ubuntu 18.04. (This will likely NOT work on other versions without tweaks.)
|
||||
* Select a Standard droplet with 8GB of memory ($40 per month in 2019.)
|
||||
* Select whatever datacenter you want.
|
||||
* Mark the checkbox called `User data`, and paste the following into the box:
|
||||
|
||||
```
|
||||
#cloud-config
|
||||
|
||||
## DigitalOcean user-data for Ubuntu 18.04 droplet
|
||||
## Installs docker
|
||||
## Setup systemd service for lbrycrd
|
||||
## (This config just runs docker on vanilla Ubuntu,
|
||||
## it uses systemd inplace of docker-compose or kubernetes.)
|
||||
|
||||
write_files:
|
||||
- path: "/etc/lbry/lbrycrd.conf"
|
||||
content: |
|
||||
datadir=/data
|
||||
port=9246
|
||||
rpcuser=lbry
|
||||
rpcpassword=lbry
|
||||
rpcport=9245
|
||||
rpcallowip=172.17.0.0/16
|
||||
regtest=0
|
||||
server=1
|
||||
txindex=1
|
||||
daemon=0
|
||||
listen=1
|
||||
|
||||
- path: "/etc/systemd/system/lbrycrd.service"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=lbrycrd docker container
|
||||
After=snap.docker.dockerd.service
|
||||
Requires=snap.docker.dockerd.service
|
||||
|
||||
[Service]
|
||||
Environment=SERVICE=lbrycrd
|
||||
Environment=IMAGE=lbry/lbry-docker:lbrycrd-production
|
||||
TimeoutStartSec=0
|
||||
ExecStartPre=-/snap/bin/docker stop $SERVICE
|
||||
ExecStartPre=-/snap/bin/docker rm -f $SERVICE
|
||||
ExecStartPre=-/snap/bin/docker pull $IMAGE
|
||||
ExecStart=/snap/bin/docker run \
|
||||
--rm \
|
||||
--name lbrycrd \
|
||||
-p 9246:9246 \
|
||||
-p 127.0.0.1:9245:9245 \
|
||||
--mount type=volume,source=lbrycrd-data,target=/data \
|
||||
--mount type=bind,source=/etc/lbry/lbrycrd.conf,target=/etc/lbry/lbrycrd.conf \
|
||||
-e RUN_MODE=default \
|
||||
$IMAGE
|
||||
ExecStop=/snap/bin/docker stop $SERVICE
|
||||
Restart=always
|
||||
RestartSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- path: "/etc/mysql/conf.d/chainquery.cnf"
|
||||
content: |
|
||||
# Put mysql optimizations specific to chainquery here
|
||||
|
||||
- path: "/etc/systemd/system/mysql.service"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=mysql docker container
|
||||
After=snap.docker.dockerd.service
|
||||
Requires=snap.docker.dockerd.service
|
||||
|
||||
[Service]
|
||||
Environment=SERVICE=mysql
|
||||
Environment=IMAGE=mysql:5
|
||||
TimeoutStartSec=0
|
||||
ExecStartPre=-/snap/bin/docker stop $SERVICE
|
||||
ExecStartPre=-/snap/bin/docker rm -f $SERVICE
|
||||
ExecStartPre=-/snap/bin/docker pull $IMAGE
|
||||
ExecStart=/snap/bin/docker run \
|
||||
--rm \
|
||||
--name mysql \
|
||||
--mount type=volume,source=mysql-data,target=/var/lib/mysql \
|
||||
--mount type=bind,source=/etc/mysql/conf.d/chainquery.cnf,target=/etc/mysql/conf.d/chainquery.cnf \
|
||||
-e MYSQL_USER=chainquery \
|
||||
-e MYSQL_PASSWORD=chainquery \
|
||||
-e MYSQL_DATABASE=chainquery \
|
||||
-e MYSQL_ROOT_PASSWORD=chainquery \
|
||||
$IMAGE
|
||||
ExecStop=/snap/bin/docker stop $SERVICE
|
||||
Restart=always
|
||||
RestartSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- path: "/etc/lbry/chainqueryconfig.toml"
|
||||
content: |
|
||||
### Reference config: https://raw.githubusercontent.com/lbryio/chainquery/master/config/default/chainqueryconfig.toml
|
||||
lbrycrdurl="rpc://lbry:lbry@lbrycrd:9245"
|
||||
mysqldsn="chainquery:chainquery@tcp(mysql:3306)/chainquery"
|
||||
apimysqldsn="chainquery:chainquery@tcp(mysql:3306)/chainquery"
|
||||
|
||||
- path: "/etc/systemd/system/chainquery.service"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=chainquery docker container
|
||||
After=mysql.service
|
||||
Requires=mysql.service
|
||||
Requires=snap.docker.dockerd.service
|
||||
|
||||
[Service]
|
||||
Environment=SERVICE=chainquery
|
||||
Environment=IMAGE=lbry/lbry-docker:chainquery-production
|
||||
TimeoutStartSec=0
|
||||
ExecStartPre=-/snap/bin/docker stop $SERVICE
|
||||
ExecStartPre=-/snap/bin/docker rm -f $SERVICE
|
||||
ExecStartPre=-/snap/bin/docker pull $IMAGE
|
||||
ExecStart=/snap/bin/docker run \
|
||||
--rm \
|
||||
--name chainquery \
|
||||
-p 127.0.0.1:6300:6300 \
|
||||
--mount type=bind,source=/etc/lbry/chainqueryconfig.toml,target=/etc/lbry/chainqueryconfig.toml \
|
||||
--link mysql:mysql \
|
||||
--link lbrycrd:lbrycrd \
|
||||
$IMAGE
|
||||
ExecStop=/snap/bin/docker stop $SERVICE
|
||||
Restart=always
|
||||
RestartSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
- path: "/root/.bash_aliases"
|
||||
content: |
|
||||
alias lbrycrd-cli="docker run --rm -it --link lbrycrd:lbrycrd --mount type=bind,source=/etc/lbry/lbrycrd.conf,target=/etc/lbry/lbrycrd.conf \
|
||||
lbry/lbry-docker:lbrycrd-production lbrycrd-cli -conf=/etc/lbry/lbrycrd.conf -rpcconnect=lbrycrd"
|
||||
alias mysql="docker run --rm -it --link mysql:mysql mysql:5 mysql -hmysql -u chainquery --password=chainquery"
|
||||
|
||||
runcmd:
|
||||
- apt-get update
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
|
||||
- snap install docker
|
||||
- until /snap/bin/docker ps; do echo "Waiting for docker startup..."; sleep 1; done; echo "Docker is up."
|
||||
- /snap/bin/docker volume create lbrycrd-data
|
||||
- /snap/bin/docker volume create mysql-data
|
||||
- systemctl enable --now lbrycrd
|
||||
- echo "Good to go."
|
||||
```
|
||||
* You can leave everything above as it is, to use the default configuration, OR
|
||||
you may edit the config in the box to your own liking.
|
||||
* For instance, if you wanted to run in [regtest
|
||||
mode](https://lbry.tech/resources/regtest-setup), you would set
|
||||
`regtest=1` in the first section under `write_files`.
|
||||
* You can also edit the config files at any later point in `/etc/lbry`,
|
||||
after you create the droplet.
|
||||
* Select your SSH key so you can login.
|
||||
* Give it a good hostname.
|
||||
* Click Create.
|
||||
|
||||
## Usage
|
||||
|
||||
### How to administer the system
|
||||
|
||||
Copy the IP address from the droplet status page, SSH into the droplet as root
|
||||
using the same SSH key you configured for the droplet.
|
||||
|
||||
The config file is in `/etc/lbry/lbrycrd.conf` on the host.
|
||||
|
||||
The systemd service is called `lbrycrd`, in
|
||||
`/etc/systemd/system/lbrycrd.service`. It is preconfigured to start on system
|
||||
startup.
|
||||
|
||||
#### Monitor the installer log
|
||||
|
||||
You can tail the log to monitor the install progress:
|
||||
|
||||
```
|
||||
tail -f /var/log/cloud-init-output.log
|
||||
```
|
||||
|
||||
Wait for the final `Good to go` message to know that the installer has finished.
|
||||
(Press Ctrl-C to exit from tail.)
|
||||
|
||||
#### Check the status of the systemd service
|
||||
|
||||
You can interact with systemd using `systemctl` (status, start, stop, restart,
|
||||
etc.) and `journalctl` (logging) tools.
|
||||
|
||||
```
|
||||
systemctl status lbrycrd
|
||||
```
|
||||
|
||||
```
|
||||
journalctl --unit lbrycrd
|
||||
```
|
||||
|
||||
[Here is a tutorial to get you familiarized with
|
||||
systemd](https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal)
|
||||
|
||||
#### Check the container
|
||||
|
||||
You can get the same information directly from docker:
|
||||
|
||||
```
|
||||
docker ps
|
||||
```
|
||||
|
||||
```
|
||||
docker logs lbrycrd
|
||||
```
|
||||
|
||||
### Utilize lbrycrd-cli
|
||||
|
||||
You can use lbrycrd-cli from the host console. A bash alias has been added to
|
||||
`/root/.bash_aliases` that invokes lbrycrd-cli in its own container.
|
||||
|
||||
```
|
||||
$ lbrycrd-cli getinfo
|
||||
{
|
||||
"version": 120400,
|
||||
"protocolversion": 70013,
|
||||
"walletversion": 60000,
|
||||
"balance": 0.00000000,
|
||||
"blocks": 551965,
|
||||
"timeoffset": 0,
|
||||
"connections": 12,
|
||||
"proxy": "",
|
||||
"difficulty": 739465688254.7942,
|
||||
"testnet": false,
|
||||
"keypoololdest": 1555360604,
|
||||
"keypoolsize": 101,
|
||||
"paytxfee": 0.00000000,
|
||||
"relayfee": 0.00001000,
|
||||
"errors": ""
|
||||
}
|
||||
```
|
||||
|
||||
### Chainquery (optional)
|
||||
|
||||
The chainquery service is pre-installed, but it is not enabled by default.
|
||||
|
||||
#### Enable and start the mysql service
|
||||
|
||||
```
|
||||
systemctl enable --now mysql
|
||||
```
|
||||
|
||||
In case you need it, there is a bash alias called `mysql`
|
||||
(`/root/.bash_aliases`) for the mysql client that allows you to login to the
|
||||
chainquery database.
|
||||
|
||||
#### Enable and start the chainquery service
|
||||
|
||||
The chainquery config file is located on the host: `/etc/lbry/chainqueryconfig.toml`
|
||||
|
||||
```
|
||||
systemctl enable --now chainquery
|
||||
```
|
||||
|
||||
In systemd, when you enable a service, it means to always start the service at
|
||||
system boot. (`--now` just means you also want to start the service right away.)
|
||||
|
||||
As with any service, you can control chainquery with `systemctl` and get logs
|
||||
with `journalctl`:
|
||||
|
||||
##### Starting and stopping chainquery service
|
||||
```
|
||||
systemctl start chainquery
|
||||
```
|
||||
|
||||
```
|
||||
systemctl stop chainquery
|
||||
```
|
||||
|
||||
##### Getting the chainquery service logs
|
||||
|
||||
```
|
||||
journalctl --unit chainquery
|
||||
```
|
||||
|
||||
(optionally use `-f` if you want to tail/follow the logs)
|
||||
|
||||
##### Disabling chainquery service
|
||||
|
||||
```
|
||||
systemctl disable --now chainquery
|
||||
```
|
||||
|
||||
### Known issues
|
||||
|
||||
Ubuntu's snap update mechanism will apparently [restart docker even if there are
|
||||
no updates
|
||||
available](https://github.com/lbryio/lbry-docker/pull/50#issuecomment-485435736).
|
||||
In the future, this tutorial may replace the snap version of docker with the
|
||||
regular PPA version of docker-ce, which has a more predictable update strategy
|
||||
(apt-get) rather than auto-updates. More long term testing is needed to know
|
||||
which way is better.
|
||||
|
||||
+21
-36
@@ -1,45 +1,30 @@
|
||||
## 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
|
||||
FROM ubuntu:18.04 as prep
|
||||
LABEL MAINTAINER="leopere [at] nixc [dot] us"
|
||||
## TODO: Implement version pinning. `apt-get install curl=<version>`
|
||||
RUN apt-get update && \
|
||||
apt-get -y install unzip curl build-essential && \
|
||||
apt-get autoclean -y && \
|
||||
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
|
||||
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
|
||||
|
||||
FROM ubuntu:18.04 as app
|
||||
COPY --from=prep /lbrycrdd /lbrycrd-cli /lbrycrd-tx /start /healthcheck /fix-permissions /usr/bin/
|
||||
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.2.2/lbrycrd-linux.zip && \
|
||||
cd /usr/bin/ && \
|
||||
unzip lbrycrd-linux.zip && \
|
||||
rm lbrycrd-linux.zip && \
|
||||
chmod +x lbrycrdd lbrycrd-cli lbrycrd-tx
|
||||
|
||||
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
|
||||
|
||||
# USER lbrycrd
|
||||
# RUN mkdir /data
|
||||
adduser lbrycrd --uid 1000 --gid 1000 --gecos GECOS --shell /bin/bash --disabled-password --home /data && \
|
||||
chmod a+s /usr/bin/fix-permissions
|
||||
VOLUME ["/data"]
|
||||
WORKDIR /data
|
||||
|
||||
## TODO: Implement healthcheck.
|
||||
# HEALTHCHECK ["healthcheck"]
|
||||
EXPOSE 9246 9245
|
||||
|
||||
## 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"]
|
||||
|
||||
USER lbrycrd
|
||||
CMD ["start"]
|
||||
@@ -1,7 +1,7 @@
|
||||
## 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"
|
||||
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 && \
|
||||
@@ -14,7 +14,7 @@ RUN addgroup --gid 1000 lbrycrd && \
|
||||
# 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.2.2/lbrycrd-linux.zip && \
|
||||
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 && \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
while true; do
|
||||
lbrycrd-cli -conf=/data/.lbrycrd/lbrycrd.conf generate 50 >> /tmp/output.log
|
||||
sleep 1
|
||||
lbrycrd-cli -conf=/data/.lbrycrd/lbrycrd.conf generate 1 >> /tmp/output.log
|
||||
sleep 2
|
||||
done
|
||||
@@ -28,9 +28,7 @@ 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
|
||||
#echo "bind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf
|
||||
|
||||
#advance nohup &
|
||||
nohup advance &>/dev/null &
|
||||
#nohup advance &>/dev/null &
|
||||
su -c "lbrycrdd -conf=/data/.lbrycrd/lbrycrd.conf" lbrycrd
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <unistd.h>
|
||||
int main() {
|
||||
// This program needs to run with setuid == root
|
||||
// This needs to be in a compiled language because you cannot setuid bash scripts
|
||||
setuid(0);
|
||||
execle("/bin/bash", "bash", "-c",
|
||||
"/bin/chown -R lbrycrd:lbrycrd /data && /bin/chmod -R 755 /data/",
|
||||
(char*) NULL, (char*) NULL);
|
||||
}
|
||||
+27
-27
@@ -1,40 +1,40 @@
|
||||
#!/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.
|
||||
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
|
||||
mkdir -p /data/.lbrycrd
|
||||
chown -R lbrycrd:lbrycrd /data
|
||||
chmod -R 755 /data/
|
||||
/usr/bin/fix-permissions
|
||||
|
||||
## 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=$RPC_USER" > /data/.lbrycrd/lbrycrd.conf
|
||||
echo "rpcpassword=$RPC_PASSWORD" >> /data/.lbrycrd/lbrycrd.conf
|
||||
echo "rpcallowip=$RPC_ALLOW_IP" >> /data/.lbrycrd/lbrycrd.conf
|
||||
echo "rpcport=9245" >> /data/.lbrycrd/lbrycrd.conf
|
||||
echo "rpcbind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf
|
||||
#echo "bind=0.0.0.0" >> /data/.lbrycrd/lbrycrd.conf
|
||||
|
||||
## Control this invocation through envvar.
|
||||
## You can optionally specify a run mode if you want to use lbry defined presets for compatibility.
|
||||
case $RUN_MODE in
|
||||
default )
|
||||
su -c "lbrycrdd -server -conf=/data/.lbrycrd/lbrycrd.conf -printtoconsole" lbrycrd
|
||||
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.
|
||||
reindex )
|
||||
su -c "lbrycrdd -server -txindex -reindex -conf=/data/.lbrycrd/lbrycrd.conf -printtoconsole" lbrycrd
|
||||
## 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.
|
||||
lbrycrdd -server -txindex -reindex -conf=$CONFIG_PATH -printtoconsole
|
||||
;;
|
||||
chainquery )
|
||||
su -c "lbrycrdd -server -txindex -conf=/data/.lbrycrd/lbrycrd.conf -printtoconsole" lbrycrd
|
||||
## 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.
|
||||
lbrycrdd -server -txindex -conf=$CONFIG_PATH -printtoconsole
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,40 @@
|
||||
## 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"]
|
||||
@@ -0,0 +1,7 @@
|
||||
To run a local instance of testnet via docker:
|
||||
|
||||
1) clone this repository
|
||||
|
||||
2) Run `cd ./lbrycrd/testnet`
|
||||
|
||||
3) Run `docker-compose up -d`
|
||||
@@ -0,0 +1,17 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
#############
|
||||
## Lbrycrd ##
|
||||
#############
|
||||
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"
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/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
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/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
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker build -t tiger5226/testnet:latest .
|
||||
docker push tiger5226/testnet:latest
|
||||
@@ -0,0 +1 @@
|
||||
data/
|
||||
@@ -0,0 +1 @@
|
||||
data/
|
||||
@@ -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"]
|
||||
@@ -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*
|
||||
@@ -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.
|
||||
@@ -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
|
||||
@@ -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"]
|
||||
@@ -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`
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
echo "TODO"
|
||||
@@ -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"]
|
||||
@@ -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`
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
echo "TODO"
|
||||
Executable
+2
@@ -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."
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## TODO: Start work for the docker-entrypoint.sh for lbrynet daemon
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
## TODO: write a healthcheck script.
|
||||
Executable
+17
@@ -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
|
||||
Reference in new issue
Block a user