Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
|
dbb3ae747b | ||
|
1dd0e6c333 |
140 changed files with 1686 additions and 23532 deletions
12
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
12
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
|
@ -36,12 +36,12 @@ Make sure that you're including the specific container your issue is in regards
|
|||
|
||||
<!-- Post your Unique LBC wallet RECEIVING address so that we can tip you ASAP -->
|
||||
## This is my LBC wallet address for tips
|
||||
{REPLACE ME WITH YOUR LBC RECIEVING ADDRESS}
|
||||
bQmvEEfu3TsfcVEPy3SCY1L38gcvXHBiEs
|
||||
|
||||
**Checklist**:
|
||||
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
|
||||
|
||||
- [ ] I made sure there are no duplicates of this report [(Use Search)](https://github.com/lbryio/lbry-docker/issues?utf8=%E2%9C%93&q=is%3Aissue)
|
||||
- [ ] I made sure I am using an up-to-date version of the container.
|
||||
- [ ] I Made sure the bug/error is not caused by any other application.
|
||||
- [ ] I have updated the wallet address in this issue from the one included to my own as I like getting paid for doing good and fun things in this world such as contributing to LBRY.
|
||||
~~- [] I included a `debugpaste` link debugpastes only last 90 days from last time they were loaded in a browser.[Inclusion of debugpaste is WIP]~~
|
||||
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/lbryio/lbry-docker/issues?utf8=%E2%9C%93&q=is%3Aissue)
|
||||
- [] I made sure I am using an up-to-date version of the container.
|
||||
- [] I Made sure the bug/error is not caused by any other application.
|
||||
- [] I have updated the wallet address in this issue from the one included to my own as I like getting paid for doing good and fun things in this world such as contributing to LBRY.
|
||||
|
|
13
.gitignore
vendored
13
.gitignore
vendored
|
@ -1,13 +1,4 @@
|
|||
.gitlab-ci.yml
|
||||
.DS_Store
|
||||
./docker-compose.yml
|
||||
*/docker-compose.override.yml
|
||||
|
||||
|
||||
*/*/data
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.tar.xz
|
||||
|
||||
./persist/lbrycrd/*
|
||||
./persist/lbrynet/*
|
||||
./persist/chainquery/*
|
||||
./docker-compose.yml
|
||||
|
|
14
.travis.yml
Normal file
14
.travis.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
# os: linux
|
||||
# dist: trusty
|
||||
#
|
||||
# services:
|
||||
# - docker
|
||||
#
|
||||
# before_install:
|
||||
# - docker build -t leopere/POTATO .
|
||||
# # - docker run -d -p 127.0.0.1:80:4567 carlad/sinatra /bin/sh -c "cd /root/sinatra; bundle exec foreman start;"
|
||||
# - docker ps -a
|
||||
# - docker run carlad/sinatra /bin/sh -c "cd /root/sinatra; bundle exec rake test"
|
||||
#
|
||||
# script:
|
||||
# - bundle exec rake test
|
28
README.md
28
README.md
|
@ -1,19 +1,16 @@
|
|||
# lbry-Docker
|
||||
|
||||
## Tags
|
||||
Document tags and link to their Dockerfiles here.
|
||||
|
||||
## Scope
|
||||
This repository is in 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.
|
||||
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.
|
||||
|
||||
#### Documentation is WIP
|
||||
Currently, this repository is a WIP and is under heavy construction, use at your own risk make sure you keep regular backups of your wallets. Your mileage may vary as to how far this will work for you be sure to file good and concise issues if you plan to and be mindful of we're allergic to regressions when filing PRs.
|
||||
Currently this repository is a WIP and is under heavy construction, use at your own risk make sure you keep regular backups of your wallets. Your milage may vary as how far this will work for you be sure to file good and concise issues if you plan to and keep in mind we're allergic to regressions when filing PR's.
|
||||
|
||||
#### Goals
|
||||
This repository aims for [Docker Best Practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) minimalism, ephemerality, and statelessness. It will use well commented **`Shell scripts`**, Dockerfiles, and Docker-Compose which is a template that is a baseline for many other container management services such as [RancherOS](https://rancher.com/rancher-os/) and [Kubernetes](https://kubernetes.io/).
|
||||
|
||||
#### Beautiful Screenshot/Gif
|
||||
Since there is nothing to see here just yet, I'll entertain you with the current state of affairs with this repository.
|
||||
Since there is nothing to see here just yet I'll entertain you with the current state of affairs with this repository.
|
||||
![image](https://spee.ch/855d1958650b850b249b9ee592ba2f4c6fc7eeec/container-unloading-gone-wrong-151175.gif)
|
||||
|
||||
## Installation
|
||||
|
@ -23,37 +20,34 @@ See [Running from source](##Running-from-source) for the current instructions on
|
|||
|
||||
#### Currently supported platforms
|
||||
|
||||
**X86_64 CPU architecture**
|
||||
Lbrynet, Lbrycrd, Chainqery are currently supported.
|
||||
|
||||
**Some arm architectures**
|
||||
**X64 cpu architecture**
|
||||
|
||||
**More will be added on request and over time**
|
||||
|
||||
## Usage
|
||||
For now, I don't recommend using this container cluster however you're welcomed to [contribute](#contributing) if you feel up to the task.
|
||||
For now I don't recommend using this container cluster however you're welcomed to [contribute](#contributing) if you feel up to the task.
|
||||
|
||||
|
||||
## Running from source
|
||||
Running this stuff from source should be possible if you have both [Docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) both installed. If these are both installed, you can proceed to run the following from within your development directory.
|
||||
Running this stuff from source should be possible if you have both [Docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) both installed. If these are both installed you can proceed to run the following from within your development directory.
|
||||
```
|
||||
git clone https://github.com/lbryio/lbry-docker.git
|
||||
```
|
||||
Once you have a local copy of the recent source, you will want to consider what containers/applications you require in your environment. At the moment since at the writing of this documentation, this comes with an assertion of [YMMV](https://dictionary.cambridge.org/dictionary/english/ymmv) so if something isn't working feel free to make suggestions in the form of a PR for how we should do this better. The beauty of Open Source is learning better ways to do things as well as contributing to the world, so I'm always going to be welcoming to contributions.
|
||||
Once you have a local copy of the recent source you will want to consider what containers/applications you require in your environment. At the moment since at the writing of this documentation this comes with an assertion of [YMMV](https://dictionary.cambridge.org/dictionary/english/ymmv) so if something isn't working feel free to make suggestions in the form of a PR for how we should do this better. The beauty of Open Source is learning better ways to do things as well as contributing to the world so I'm always going to be welcoming to contributions.
|
||||
|
||||
#### From Source for Contributions
|
||||
Running from source for contributing and Merge/Pull requests.
|
||||
My goal is to make contributing to this possible using Docker and also GitLab CI/CD time.
|
||||
|
||||
## [Contributing](CONTRIBUTING.md)
|
||||
Keep in mind [I am](https://github.com/leopere/) preferential to receiving patches over rule-following as we can always nudge you in the right direction to get things more compatible with the project ethos if it's not. Never be afraid to file a PR no one should be offended. Having said this following the next two guides will greatly improve the speed at which we can integrate your improvements.
|
||||
Keep in mind [I am](https://github.com/leopere/) preferential to receiving patches over rule following as we can always nudge you in the right direction to get things more compatible with the project ethos if it's not. Never be afraid to file a PR no one should be offended. This said following the next two guides will greatly improve the speed at which we can integrate your improvements.
|
||||
* [Repository Standards]( https://lbry.tech/resources/repository-standards)
|
||||
* [Contribute](https://lbry.tech/contribute)
|
||||
* Have an LBC wallet ready as we want you to have some for the help! Hell, why not post it in your Commit or Merge Request for all I care but take your tips!
|
||||
* Have a LBC wallet ready as we want you to have some for the help! Hell why not post it in your Commit or Merge Request for all I care but take your tips!
|
||||
|
||||
## Getting Support
|
||||
|
||||
<!-- #### Debugpaste [WIP]
|
||||
#### Debugpaste [WIP]
|
||||
I'll be including a function to get a self destructing debugpaste of your LBRY appliances logs you'll be able to execute something similar to the following in all containers to export raw logs to a paste service where you can then either modify them removing sensitive data or just take that URL and create a new issue after you [(Use Issue Search)](https://github.com/lbryio/lbry-docker/issues?utf8=%E2%9C%93&q=is%3Aissue) to make sure there isn't already an open thread for your issue.
|
||||
|
||||
#### Example debugpaste
|
||||
|
@ -63,7 +57,7 @@ docker-compose exec chainquery debugpaste
|
|||
https://haste.nixc.us/ocatumatozaq.nginx
|
||||
```
|
||||
You can then take output given in the response from the debugpaste command and put that into your github issue (This may be automated at some point to some degree).
|
||||
-->
|
||||
|
||||
|
||||
#### Creating an Issue
|
||||
Please be sure to fill out the [issue template](https://github.com/lbryio/lbry-docker/issues/new) as best as possible. This will help us answer your questions faster and fix things quicker if we have quality reports.
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
data/
|
||||
data.z*
|
||||
chainquery.z*
|
||||
data/*
|
||||
|
|
19
chainquery/.env
Normal file
19
chainquery/.env
Normal file
|
@ -0,0 +1,19 @@
|
|||
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.
|
1
chainquery/.gitignore
vendored
1
chainquery/.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
data/
|
||||
data.z*
|
||||
chainquery.z*
|
||||
*.zip
|
||||
|
|
52
chainquery/Dockerfile
Normal file
52
chainquery/Dockerfile
Normal file
|
@ -0,0 +1,52 @@
|
|||
## 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 --chown=1000:1000 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"]
|
|
@ -1,26 +0,0 @@
|
|||
## 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"
|
||||
RUN apt-get update && \
|
||||
apt-get -y install unzip curl busybox-static && \
|
||||
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
|
||||
RUN curl --progress-bar -L -o /chainquery https://build.lbry.io/chainquery/branch-master/chainquery && \
|
||||
chmod +x /chainquery /start /healthcheck
|
||||
|
||||
FROM ubuntu:18.04 as app
|
||||
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 ./healthcheck /chainquery /start /bin/busybox /usr/bin/
|
||||
HEALTHCHECK --interval=1m --timeout=30s \
|
||||
CMD healthcheck
|
||||
EXPOSE 6300
|
||||
USER chainquery
|
||||
STOPSIGNAL SIGINT
|
||||
CMD ["start"]
|
|
@ -1,46 +1,39 @@
|
|||
# Docker image tags
|
||||
`lbry/chainquery`
|
||||
`[linux-x86_64-production](https://github.com/lbryio/lbry-docker/blob/master/chainquery/Dockerfile-linux-x86_64-production)` (Latest release)
|
||||
|
||||
# Installation instructions for Chainquery and dependencies
|
||||
## Preface
|
||||
I have set up this tutorial so that you should be able to copy and paste the commands into your Linux console. However, if you run into issues, please be sure to read the detailed expansions on the current and prior steps to ensure you didn't miss a detail.
|
||||
|
||||
## Caveats to installing Chainquery
|
||||
Chainquery is an interface to an extensive index of data which has to parse an entire blockchain's history into a SQL database in a way that is easily query-able. The process of syncing your lbrycrd level.db files can take a long time depending on your deployment and then once your instance is synced you need to index the blockchain with Chainquery. All of this takes a fair bit of time or resources at first it is possible to deploy this stack without the shell scripts, and I will eventually include a docker-compose.yml file which gives you a baseline for deploying this to k8's and other platforms but for now single host deployment via shell script will be what's supported.
|
||||
I have set up this tutorial so that you should be able to simply copy and paste the commands into your linux console. However if you run into issues please be sure to read the detailed expansions on the current and prior steps to ensure you didn't miss a detail.
|
||||
|
||||
## Goals of this README.md
|
||||
This readme is targeted towards people who need a copy paste recipe to get Chainquery online and running asap and with some degree of repeatability. Once this is up and running on your machine, you should be able to see what a running instance of Chainquery looks like and start writing apps against its API.
|
||||
This readme is targeted towards people who need a copy pasta recipe to get Chainquery online and running asap and with some degree of repeatability. Once this is up and running on your machine you should be able to see what a running instance of Chainquery looks like and start writing apps against it's API calls etc.
|
||||
|
||||
## Dependencies
|
||||
My goal is to avoid as many dependencies as possible so for now the only pre-requisites you are required to have are `git`, `docker`, and `docker-compose` for the most part your understanding of the technologies can be superficial so long as you can follow commands and are open to reading a bit you should be fine.
|
||||
My goal is to avoid as many dependencies as possible so for now the only pre-requisites you are required to have will be `git`, `docker`, and `docker-compose` for the most part your understanding of the technologies can be superficial so long as you can follow commands and are open to reading a bit you should be fine.
|
||||
|
||||
### Docker
|
||||
Docker
|
||||
Docker is effectively the cross platform software package repository it allows you to ship an entire environment in what's referred to as a container. Implying that containers hold everything that is needed to ship what's inside effectively from one place to another with a degree of standard that makes it easy for everyone along the way to replicate what is needed for their step in the chain.
|
||||
|
||||
Docker is effectively the cross-platform software package repository it allows you to ship an entire environment in what's referred to as a container. Containers are intended to hold everything that is needed to ship what's required to run an application from one place to another with a degree of a standard that makes it easy for everyone along the way to reproduce the environment for their step in the chain.
|
||||
The other side of docker is it brings everything that we would normally have to teach you about the individual components of your soon to be installed Chainquery, Lbrycrd, and MySQL stack and wraps it up nicely in a handfull of easy to follow steps that should result in the same environment on everyones host.
|
||||
|
||||
The other side of docker is it brings everything that we would typically have to teach you about the individual components of your soon to be installed Chainquery, Lbrycrd, and MySQL stack and wraps it up nicely in a handful of easy to follow steps that should result in the same environment on everyone's host.
|
||||
The installation method we recommend is via the `docker.com` website however if your specific operating system's repository versions are at the latest along with docker you should be good to launch with you using whatever instructions you wish. The version of Docker we used in our deployment for testing this process was `Docker version 17.05.0-ce, build 89658be` however any versions later than this will suffice. At the writing of this tutorial this was not the latest version of Docker.
|
||||
|
||||
The installation method we recommend is via the `docker.com` website however if your specific operating system's repository versions are at the latest along with docker you should be good to launch with you using whatever instructions you wish. The version of Docker we used in our deployment for testing this process was `Docker version 17.05.0-ce, build 89658be` however any versions later than this is sufficient. At the writing of this tutorial, this was not the latest version of Docker.
|
||||
|
||||
#### Just the link to installation instructions, please
|
||||
#### Just the link to installation instructions please
|
||||
Instructions for installing on Ubuntu are at the link that follows:
|
||||
https://docs.docker.com/install/linux/docker-ce/ubuntu/
|
||||
|
||||
If you plan on using other versions of OS you should at least aim to be a Linux base with an x86_64 CPU and the appropriate minimum version of the dependencies.
|
||||
If you plan on using other versions of OS you should at least aim to be a linux base with a x64 CPU and the appropriate minimum version of the dependencies.
|
||||
|
||||
### Docker-compose
|
||||
Docker Compose's role in this deployment is to get you a fully working cluster of microservices in containers that will deploy Chainquery, MySQL, and LBRYCrd exactly as you would need it to have a reasonable instance for testing / developing on. You are encouraged to learn how to use the Docker-Compose format, but it's not a required prerequisite for getting this running you need to have it installed successfully.
|
||||
Docker Compose's role in this deployment is to get you a fully working cluster of microservices in containers that will deploy Chainquery, MySQL, and LBRYCrd exactly as you would need it to have a reasonable instance for testing / developing on. You are encouraged to learn how to use the Docker-Compose format but it's not a required prerequisite for getting this running you just need to have it installed successfully.
|
||||
|
||||
Install Docker Compose via this guide below, and it is essential if you're using an older version of Linux to use the official documentation from Docker.com because you require the more recent version of docker-compose at least version 3.4 aka 1.22.0 or newer.
|
||||
Install Docker Compose via this guide below, its important if you're using an older version of linux to use the official documentation from Docker.com because you will need the more recent version of docker-compose at least version 3.4 aka 1.22.0 or newer.
|
||||
|
||||
#### Just the link to installation instructions, please
|
||||
#### Just the link to installation instructions please
|
||||
https://docs.docker.com/compose/install/
|
||||
|
||||
### Git
|
||||
For now, the recommended install includes grabbing the latest git repository from https://github.com/lbryio/lbry-docker for this you're going to need to install git with the following command. The amount of git knowledge required for this is ideally reasonably minimal.
|
||||
For now the recommended install includes grabbing the latest git repository from https://github.com/lbryio/lbry-docker for this you're going to need to install git with the following command. The amount of git knowledge required for this is ideally fairly minimal.
|
||||
|
||||
#### Just the instructions, please
|
||||
#### Just the instructions please
|
||||
`apt-get install git -y`
|
||||
|
||||
## Get the lbry-docker repository
|
||||
|
@ -50,14 +43,14 @@ For now, the recommended install includes grabbing the latest git repository fro
|
|||
## Setup networking
|
||||
|
||||
You only need external networking if you plan on keeping your docker-compose files separate.
|
||||
For the sake of modularity in the design of this git repository, the plan is to give you examples to try and then you're supposed to move towards your custom docker-compose configuration. We're going to create
|
||||
a docker bridge network that is going to be managed externally to your usual docker-compose networks which are docker-compose internal.
|
||||
For the sake of modularity in the design of this git repository the plan is to give you examples to try and then you're supposed to move towards your own custom docker-compose configuration. We're going to create
|
||||
a docker bridge network that is going to be managed externally to your usual docker-compose networks which are compose internal.
|
||||
|
||||
`docker network create -d bridge --subnet=10.6.1.0/16 lbry-network`
|
||||
`docker network create -d bridge --subnet=10.5.1.0/16 lbrynet`
|
||||
|
||||
## Make directories and set permissions
|
||||
|
||||
Setting permissions is only typically required on host mounted volumes. (the default settings)
|
||||
This is only required on host mounted volumes. (the default settings)
|
||||
|
||||
`sudo mkdir -p ./lbry-docker/lbrycrd/data`
|
||||
|
||||
|
@ -73,19 +66,17 @@ Setting permissions is only typically required on host mounted volumes. (the def
|
|||
|
||||
Wait for lbrycrd to reach the top of the blockchain (console output should noticeably slow down)
|
||||
|
||||
Once you've reached the top of the blockchain, you can press `CTRL+C` to exit back to the Linux shell.
|
||||
Once you've reached the top of the blockchain you can press `CTRL+C` to exit back to the linux shell.
|
||||
|
||||
## Setup chainquery
|
||||
|
||||
Now you're finished syncing your copy of the lbry blockchain into the `lbrycrd` instance you can start spinning up Chainquery, and it's dependencies since Chainquery is parsing copious amounts of unstructured data stored in the `lbry` blockchain you have two routes to go.
|
||||
Now that you're done syncing your own copy of the lbry blockchain into the `lbrycrd` instance you can start spinning up Chainquery and it's dependencies. Since Chainquery is parsing copious amounts of unstructured data stored in the `lbry` blockchain you have two routes to go.
|
||||
|
||||
1. Route number one [Recommended]: You use some variant of this README.md's instructions to start your chainquery instance using an LBRY.io provided database checkpoint snapshot. The checkpoint should be copy-paste-able series of commands to get your staging instance up asap if you want Route number one, follow along with the rest of this README.md
|
||||
2. Route number two: You can your fresh copy of the chainquery database indexing times may vary from hours to days depending on your hardware.
|
||||
1. Route number one [Recommended]: You use some variant of this README.md's instructions to start your chainquery instance using a LBRY.io provided database checkpoint snapshot. This should be basically copy paste-able series of commands to get your own staging instance up asap if you want Route number one, follow along with the rest of this README.md
|
||||
2. Route number two: You can your own fresh copy of the chainquery database indexing times may vary from hours to days depending on your hardware.
|
||||
|
||||
`cd ../chainquery/`
|
||||
|
||||
`cat ./compose/docker-compose.yml-prod-example > docker-compose.yml`
|
||||
|
||||
`./quick-bootstrap.sh getdata`
|
||||
|
||||
`./quick-bootstrap.sh extract`
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
version: '3.4'
|
||||
|
||||
networks:
|
||||
lbry-network:
|
||||
external: true
|
||||
|
||||
services:
|
||||
###########
|
||||
## MYSQL ##
|
||||
###########
|
||||
## Work is underway to support percona
|
||||
mysql:
|
||||
image: mysql:5.7.23
|
||||
restart: always
|
||||
networks:
|
||||
lbry-network:
|
||||
ipv4_address: 10.6.1.10
|
||||
env_file:
|
||||
- ../environment/chainquery.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
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", 'mysql --database=$$MYSQL_DATABASE --password=$$MYSQL_ROOT_PASSWORD --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B']
|
||||
interval: 5s
|
||||
retries: 12
|
||||
volumes:
|
||||
- ../persist/chainquery/db:/var/lib/mysql
|
||||
## This one may need to be tweaked based on where you run this docker-compose from.
|
||||
- ../stuff/my.cnf:/etc/mysql/conf.d/chainquery-optimizations.cnf
|
||||
|
||||
################
|
||||
## Chainquery ##
|
||||
################
|
||||
chainquery:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-linux-x86_64-production
|
||||
restart: always
|
||||
networks:
|
||||
lbry-network:
|
||||
ipv4_address: 10.6.1.3
|
||||
env_file:
|
||||
- env
|
||||
- ../environment/chainquery.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:
|
||||
# - ../persist/chainquery/config/chainqueryconfig.toml:/etc/chainquery/chainqueryconfig.toml
|
54
chainquery/docker-compose.yml
Normal file
54
chainquery/docker-compose.yml
Normal file
|
@ -0,0 +1,54 @@
|
|||
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
|
16
chainquery/stuff/chainqueryconfig.toml
Normal file
16
chainquery/stuff/chainqueryconfig.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
## 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, `<yourscript>.sh`
|
||||
#DEFAULT-autoupdatecommand=[unset]
|
1
chainquery/stuff/debugpaste-it.sh
Executable file
1
chainquery/stuff/debugpaste-it.sh
Executable file
|
@ -0,0 +1 @@
|
|||
#!/usr/bin/env bash
|
13
chainquery/stuff/docker-entrypoint.sh
Executable file
13
chainquery/stuff/docker-entrypoint.sh
Executable file
|
@ -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
|
|
@ -7,12 +7,12 @@ COMPOSE_PROJECT_NAME=chainquery
|
|||
#RPC_USER=lbryrpc ## Not super necessery to change this.
|
||||
#RPC_PASSWORD=changeme ## Please replace changeme.
|
||||
|
||||
RPC_ALLOW_IP=10.6.1.3 ## You're better off not changing this.
|
||||
RPC_ALLOW_IP=10.5.1.3 ## You're better off not changing this.
|
||||
|
||||
#################
|
||||
## Mysql Creds ##
|
||||
#################
|
||||
MYSQL_SERVER=10.6.1.10 ## You're better off not changing this.
|
||||
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.
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
#!/bin/sh
|
||||
busybox wget -O- http://localhost:6300/api/status
|
||||
#!/usr/bin/env bash
|
||||
## TODO: Implement this at some point it requires CURL in the container.
|
||||
curl http://localhost:6300/api/status
|
||||
|
|
|
@ -1,32 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Override defaults with environment variables
|
||||
CONFIGFILE="${CONFIGFILE:-/etc/lbry/chainqueryconfig.toml}"
|
||||
DEBUGMODE="${DEBUGMODE:-false}"
|
||||
RPC_USER="${RPC_USER:-lbry}"
|
||||
RPC_PASSWORD="${RPC_PASSWORD:-lbry}"
|
||||
RPC_HOST="${RPC_HOST:-localhost}"
|
||||
RPC_PORT="${RPC_PORT:-9245}"
|
||||
MYSQL_SERVER="${MYSQL_SERVER:-localhost}"
|
||||
MYSQL_PORT="${MYSQL_PORT:-3306}"
|
||||
MYSQL_USER="${MYSQL_USER:-lbry}"
|
||||
MYSQL_PASSWORD="${MYSQL_PASSWORD:-lbry}"
|
||||
MYSQL_DATABASE="${MYSQL_DATABASE:-chainquery}"
|
||||
# TODO: Remove this notes section.
|
||||
## Keeping this here as notes for later sed magic.
|
||||
# #########################
|
||||
# ## Chainquery Settings ##
|
||||
# #########################
|
||||
# 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.
|
||||
|
||||
exec_chainquery() {
|
||||
CONFIG_DIR=$(dirname "${CONFIGFILE}")
|
||||
exec chainquery serve --configpath "$CONFIG_DIR"
|
||||
}
|
||||
# TODO: Add chainquery startup magic for configuration.
|
||||
# sed -i ''
|
||||
#
|
||||
#
|
||||
# debugmode=${DEBUGMODE:-false}
|
||||
# lbrycrdurl="rpc://${RPC_USER:-lbryrpc}:${RPC_PASSWORD:-changeme}@10.5.1.2:9245"
|
||||
# mysqldsn="${MYSQL_USER:-changeme}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}"
|
||||
# apimysqldsn="${MYSQL_USER:-changeme}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}"
|
||||
|
||||
if [[ -f "$CONFIGFILE" ]]; then
|
||||
echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/lbry"
|
||||
exec_chainquery
|
||||
fi
|
||||
|
||||
cat << EOF >> "${CONFIGFILE}"
|
||||
DEBUGMODE="${DEBUGMODE}"
|
||||
LBRYCRDURL="rpc://${RPC_USER}:${RPC_PASSWORD}@${RPC_HOST}:${RPC_PORT}"
|
||||
MYSQLDSN="${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_SERVER}:${MYSQL_PORT})/$MYSQL_DATABASE"
|
||||
APIMYSQLDSN="${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_SERVER}:${MYSQL_PORT})/$MYSQL_DATABASE"
|
||||
EOF
|
||||
exec_chainquery
|
||||
## 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
|
||||
chainquery serve -c "/etc/chainquery/"
|
||||
|
|
5
contrib/k8s-lbry/.gitignore
vendored
5
contrib/k8s-lbry/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
*.tgz
|
||||
values-dev.yaml
|
||||
values-staging.yaml
|
||||
values-production.yaml
|
||||
completion.bash.inc
|
|
@ -1,4 +0,0 @@
|
|||
index.yaml
|
||||
kick-ascii
|
||||
.gitignore
|
||||
completion.bash.inc
|
|
@ -1,11 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: LBRY on Kubernetes with Helm
|
||||
name: k8s-lbry
|
||||
version: 0.1.5
|
||||
maintainers:
|
||||
- email: ryan@enigmacurry.com
|
||||
name: EnigmaCurry
|
||||
- email: leopere [at] nixc [dot] us
|
||||
name: Leopere
|
||||
home: https://github.com/lbryio/lbry-docker/tree/master/contrib/k8s-lbry
|
|
@ -1,876 +0,0 @@
|
|||
# LBRY on Kubernetes with Helm
|
||||
|
||||
Contributing Author: [EnigmaCurry](https://www.enigmacurry.com)
|
||||
|
||||
Last Update: June 14 2019
|
||||
|
||||
Deploy [lbrycrd](https://github.com/lbryio/lbrycrd), [lbrynet](https://github.com/lbryio/lbry), [chainquery](https://github.com/lbryio/chainquery), [mysql](https://www.mysql.com), and [spee.ch](https://github.com/lbryio/spee.ch) on your [Kubernetes](https://kubernetes.io/) cluster.
|
||||
|
||||
[![asciicast](https://lbryio.github.io/lbry-docker/contrib/k8s-lbry/kick-ascii/cast/k8s-lbry.png)](https://lbryio.github.io/lbry-docker/contrib/k8s-lbry/kick-ascii/?cast=k8s-lbry&bg=lbry.png)
|
||||
|
||||
<!-- Regenerate Table of contents with markdown-toc npm library -->
|
||||
<!-- run: npx markdown-toc -i README.md -->
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Requirements](#requirements)
|
||||
- [Security Notice](#security-notice)
|
||||
- [Installation](#installation)
|
||||
* [Create a project directory](#create-a-project-directory)
|
||||
* [Setup alias and tab completion](#setup-alias-and-tab-completion)
|
||||
* [k8s-lbry setup](#k8s-lbry-setup)
|
||||
* [k8s-lbry install-nginx-ingress](#k8s-lbry-install-nginx-ingress)
|
||||
* [k8s-lbry install-cert-manager](#k8s-lbry-install-cert-manager)
|
||||
* [k8s-lbry install](#k8s-lbry-install)
|
||||
* [k8s-lbry upgrade](#k8s-lbry-upgrade)
|
||||
- [Services](#services)
|
||||
* [lbrycrd](#lbrycrd)
|
||||
* [chainquery](#chainquery)
|
||||
+ [MySQL for chainquery](#mysql-for-chainquery)
|
||||
+ [Start chainquery](#start-chainquery)
|
||||
+ [Startup chainquery with a database snapshot](#startup-chainquery-with-a-database-snapshot)
|
||||
* [lbrynet API service (not for spee.ch)](#lbrynet-api-service-not-for-speech)
|
||||
+ [IMPORTANT - Backup your cluster wallet](#important---backup-your-cluster-wallet)
|
||||
* [spee.ch (and lbrynet sidecar and mysql)](#speech-and-lbrynet-sidecar-and-mysql)
|
||||
+ [IMPORTANT - Backup your speech wallet](#important---backup-your-speech-wallet)
|
||||
+ [Fund your speech wallet](#fund-your-speech-wallet)
|
||||
+ [Create a thumbnail channel](#create-a-thumbnail-channel)
|
||||
+ [Finish speech setup](#finish-speech-setup)
|
||||
- [Extra commands that k8s-lbry (run.sh) provides](#extra-commands-that-k8s-lbry-runsh-provides)
|
||||
* [k8s-lbry helm](#k8s-lbry-helm)
|
||||
* [k8s-lbry kubectl](#k8s-lbry-kubectl)
|
||||
* [k8s-lbry logs](#k8s-lbry-logs)
|
||||
* [k8s-lbry shell](#k8s-lbry-shell)
|
||||
* [k8s-lbry shell-pvc](#k8s-lbry-shell-pvc)
|
||||
* [k8s-lbry restart](#k8s-lbry-restart)
|
||||
* [k8s-lbry lbrynet](#k8s-lbry-lbrynet)
|
||||
* [k8s-lbry chainquery-mysql-client](#k8s-lbry-chainquery-mysql-client)
|
||||
* [k8s-lbry speech-mysql-client](#k8s-lbry-speech-mysql-client)
|
||||
* [k8s-lbry lbrynet-copy-wallet](#k8s-lbry-lbrynet-copy-wallet-)
|
||||
* [k8s-lbry package](#k8s-lbry-package)
|
||||
- [TLS / SSL / HTTPS](#tls--ssl--https)
|
||||
- [Cloud specific notes](#cloud-specific-notes)
|
||||
* [AWS](#aws)
|
||||
* [minikube](#minikube)
|
||||
- [Uninstall](#uninstall)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Requirements
|
||||
|
||||
* A Kubernetes cluster.
|
||||
* Tested on DigitalOcean managed Kubernetes cluster on nodes with 8GB of RAM,
|
||||
on kubernetes 1.14.1.
|
||||
* Tested on AWS with [Charmed Kubenetes
|
||||
Distribution](https://www.ubuntu.com/kubernetes/docs/quickstart) - See
|
||||
[AWS specific notes](#aws).
|
||||
* Tested on
|
||||
[minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/) for a
|
||||
self-contained virtual machine running kubernetes in VirtualBox - - See
|
||||
[minikube specific notes](#minikube).
|
||||
* Local development machine dependencies:
|
||||
* [GNU Bash](https://www.gnu.org/software/bash/) and friends. If you're on
|
||||
Linux or Mac, you should be good to go.
|
||||
* [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
|
||||
* Tested with kubectl v1.14.0
|
||||
* [helm](https://github.com/helm/helm/releases)
|
||||
* Tested with helm v2.13.1
|
||||
* Optional: for TLS / HTTPs support, you will also need an internet domain
|
||||
name, and the ability to update its DNS.
|
||||
|
||||
Your cloud provider should have instructions for setting up `kubectl` to talk to
|
||||
your cluster. This usually involves downloading a config file and putting it in
|
||||
`$HOME/.kube/config`. (The file has to be renamed `config` and put in the
|
||||
`$HOME/.kube` directory.)
|
||||
|
||||
Test that your `kubectl` can talk to your cluster, by querying for a list of
|
||||
running nodes:
|
||||
|
||||
```
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
If everything is working, you should see a list of one or more nodes running and
|
||||
showing `STATUS=Ready`
|
||||
|
||||
## Security Notice
|
||||
|
||||
Any cryptocurrency wallet that is online is a security concern. For any
|
||||
real-world production deployment, you will need to review this architecture
|
||||
closely to see if it fits with your chosen platform and network environment.
|
||||
|
||||
This system is currently designed for a kubernetes cluster that has a single
|
||||
administrator (or possibly a small team of trusted users). It will not support
|
||||
untrusted multi-tenancy out of the box.
|
||||
|
||||
All of the services are created in their own namespace, but no [Security
|
||||
Policies](https://kubernetes.io/docs/concepts/policy/pod-security-policy/) have
|
||||
been applied to the pods.
|
||||
|
||||
The Helm configuration file contains *all* of the configuration for the system,
|
||||
*including passwords* in plain text.
|
||||
|
||||
The lbrynet SDK wallets are individually stored unencrypted in their own
|
||||
persistent volumes.
|
||||
|
||||
“We take security seriously. Please contact
|
||||
[security@lbry.io](mailto:security@lbry.io) regarding any security issues. Our
|
||||
PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.” If you find
|
||||
vulnerabilites, especially any that might increase the risk of someone losing
|
||||
their crypto currency [Responsible
|
||||
Disclosure](https://en.wikipedia.org/wiki/Responsible_disclosure) is
|
||||
appreciated.
|
||||
|
||||
## Installation
|
||||
|
||||
This system is installed via [Helm](https://helm.sh/docs/), the package manager
|
||||
for Kubernetes. [Helm Charts](https://helm.sh/docs/developing_charts/#charts)
|
||||
are the basis for packages in Helm. This directory is a Helm chart itself.
|
||||
|
||||
All of the helm and kubectl commands necessary to install, upgrade, and maintain
|
||||
your deployments, are wrapped in the included [`run.sh`](run.sh) script. For
|
||||
debugging purposes, this wrapper also prints to stdout the full underlying
|
||||
commands (helm, kubectl, etc) as they are run.
|
||||
|
||||
### Create a project directory
|
||||
|
||||
Create a new directory someplace to store your deployment configuration. For the
|
||||
rest of this tutorial, you will work from this directory:
|
||||
|
||||
```
|
||||
mkdir $HOME/k8s-lbry-test
|
||||
|
||||
cd $HOME/k8s-lbry-test
|
||||
```
|
||||
|
||||
Download `run.sh` to this same directory:
|
||||
|
||||
```
|
||||
curl -Lo run.sh https://raw.githubusercontent.com/lbryio/lbry-docker/master/contrib/k8s-lbry/run.sh
|
||||
|
||||
chmod a+x run.sh
|
||||
```
|
||||
|
||||
It's a good idea to always read any script you download from the internet,
|
||||
before running it.
|
||||
|
||||
### Setup alias and tab completion
|
||||
|
||||
`run.sh` can be run directly without any setup. However, without adding it to
|
||||
your `PATH`, you need to specify the full path to the script each time. Setting
|
||||
a bash alias for `run.sh` is the quickest way of setting up to run from
|
||||
anywhere, as well as activating support for bash tab completion.
|
||||
|
||||
One time setup to install alias to `$HOME/.bashrc`:
|
||||
|
||||
```
|
||||
./run.sh setup-alias
|
||||
```
|
||||
|
||||
It should prompt you if it is OK for the script to edit `$HOME/.bashrc`. Once
|
||||
you confirm, close your terminal session, then reopen it.
|
||||
|
||||
Verify the new `k8s-lbry` alias to `run.sh` is working:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl get nodes
|
||||
```
|
||||
|
||||
Notice that tab completion should work throughout typing the above command.
|
||||
|
||||
### k8s-lbry setup
|
||||
|
||||
Setup will check for dependencies, update helm repositories, and create an
|
||||
initial config file (`values-dev.yaml`).
|
||||
|
||||
```
|
||||
k8s-lbry setup
|
||||
```
|
||||
|
||||
### k8s-lbry install-nginx-ingress
|
||||
|
||||
An Ingress Controller
|
||||
([nginx-ingress](https://github.com/helm/charts/tree/master/stable/nginx-ingress))
|
||||
will help you to route outside internet traffic into your cluster. nginx-ingress
|
||||
will also help terminate TLS connections (SSL) so that your containers don't
|
||||
need to worry about encryption of traffic.
|
||||
|
||||
Install nginx-ingress into the `k8s-lbry` namespace:
|
||||
|
||||
```
|
||||
k8s-lbry install-nginx-ingress
|
||||
```
|
||||
|
||||
### k8s-lbry install-cert-manager
|
||||
|
||||
[cert-manager](https://docs.cert-manager.io/en/latest/index.html) will provide
|
||||
TLS certificates (SSL) for your cluster, using [Let's
|
||||
Encrypt](https://letsencrypt.org/).
|
||||
|
||||
Install cert-manager into the `cert-manager` namespace:
|
||||
|
||||
```
|
||||
k8s-lbry install-cert-manager
|
||||
```
|
||||
|
||||
### k8s-lbry install
|
||||
|
||||
Once nginx-ingress and cert-manager are installed, the main helm chart can be
|
||||
installed. This installs lbrycrd, chainquery, lbrynet, spee.ch, and mysql,
|
||||
depending on what you enable in `values-dev.yaml`.
|
||||
|
||||
Find the External IP address for your load balancer:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl get svc nginx-ingress-controller -o wide
|
||||
```
|
||||
|
||||
If you find a hostname instead of an IP address, this means your load balancer
|
||||
has multiple IP addresses. In this case, you will need to resolve the domain
|
||||
name to find the IP addresses. If this affects you, run `dig` with the hostname
|
||||
as the second argument. If your system does not have `dig` installed, you can
|
||||
[paste the hostname into this tool](https://toolbox.googleapps.com/apps/dig/).
|
||||
Look for the `;ANSWER` section and you should see two or more IP addresses
|
||||
listed. Since lbrycrd will only advertise one IP address, pick just one of the
|
||||
IP addresses to use for the purposes of this tutorial.
|
||||
|
||||
You must edit your own `values-dev.yaml`. (The setup procedure created an
|
||||
initial configuration in the same directory as `run.sh`.) To use a different
|
||||
config file, export the `VALUES` environment variable before subsequent
|
||||
commands, specifying the full path to your values file.
|
||||
|
||||
Edit `values-dev.yaml`. You only need to change one thing right now:
|
||||
|
||||
* Change `lbrycrd.configurationFile.lbrycrd.conf` at the bottom of this section
|
||||
find `externalip=` and set it equal to the External IP address of the Load
|
||||
Balancer obtained above. (Example: `externalip=123.123.123.123`)
|
||||
|
||||
Save `values-dev.yaml`.
|
||||
|
||||
Now run the install script to create the new release:
|
||||
|
||||
```
|
||||
k8s-lbry install
|
||||
```
|
||||
|
||||
### k8s-lbry upgrade
|
||||
|
||||
For helm, `upgrade` does not necessarily mean you are upgrading to a new version
|
||||
of any particular software, `upgrade` just means to apply your configuration
|
||||
file to the cluster. If you edit `values-dev.yaml`, you then need to apply your
|
||||
changes with `k8s-lbry upgrade`.
|
||||
|
||||
You can make changes to `values-dev.yaml` at any time. You can apply your
|
||||
configuration to your cluster by upgrading the release:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
You can upgrade as often as you want. Each time you upgrade the release, helm
|
||||
increases the `REVISION` number:
|
||||
|
||||
```
|
||||
k8s-lbry helm ls
|
||||
```
|
||||
|
||||
## Services
|
||||
|
||||
### lbrycrd
|
||||
|
||||
After running the installation above, you should now have a running lbrycrd pod.
|
||||
Verify this by listing the pods for the `k8s-lbry` namespace:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl get pods
|
||||
```
|
||||
|
||||
You should see a pod listed with a name that starts with `lbrycrd`.
|
||||
|
||||
Check the lbrycrd logs:
|
||||
|
||||
```
|
||||
k8s-lbry logs lbrycrd
|
||||
```
|
||||
|
||||
Press Ctrl-C to stop viewing the log.
|
||||
|
||||
It is advisable to wait for lbrycrd to synchronize with the full blockchain
|
||||
before starting other services, so watch the logs until synchronization
|
||||
completes (`progress=1.0`).
|
||||
|
||||
You can utilize `lbrycrd-cli` as well:
|
||||
|
||||
```
|
||||
k8s-lbry lbrycrd-cli --help
|
||||
```
|
||||
|
||||
### chainquery
|
||||
|
||||
#### MySQL for chainquery
|
||||
[MySQL](https://github.com/helm/charts/tree/master/stable/mysql) is used as
|
||||
the database chainquery talks to.
|
||||
|
||||
Edit `values-dev.yaml` and set `chainquery-mysql.enabled` to `true`.
|
||||
|
||||
Upgrade the release to turn on mysql for chainquery:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
You can try logging into the mysql shell if you like:
|
||||
|
||||
```
|
||||
k8s-lbry chainquery-mysql-client
|
||||
```
|
||||
|
||||
You can view the mysql logs:
|
||||
|
||||
```
|
||||
k8s-lbry logs chainquery-mysql
|
||||
```
|
||||
|
||||
Press Ctrl-C to stop viewing the log.
|
||||
|
||||
#### Start chainquery
|
||||
|
||||
Edit `values-dev.yaml` and set `chainquery.enabled` to `true`.
|
||||
|
||||
Upgrade the release to turn on chainquery:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
You can view the chainquery logs:
|
||||
|
||||
```
|
||||
k8s-lbry logs chainquery
|
||||
```
|
||||
|
||||
#### Startup chainquery with a database snapshot
|
||||
|
||||
If chainquery is starting with a blank MySQL database, it will take several days
|
||||
to synchronize with the full lbrycrd blockchain. If this is OK, you can just
|
||||
watch the chainquery logs and wait for it to get to the [current block
|
||||
height](https://explorer.lbry.io/).
|
||||
|
||||
If you cannot wait that long, you can scrap your existing chainquery database
|
||||
and restart from a more recent database snapshot:
|
||||
|
||||
```
|
||||
k8s-lbry chainquery-override-snapshot
|
||||
```
|
||||
|
||||
This will prompt if you really wish to destroy the current chainquery database.
|
||||
If you confirm, the existing chainquery and chainquery-mysql deployments will be
|
||||
deleted, and pods will be terminated, ***and the contents of the Persistent
|
||||
Volume Claim (PVC) for chainquery-mysql will be deleted.*** The snapshot will be
|
||||
downloaded and restored in its place.
|
||||
|
||||
Once the snapshot is restored, upgrade the release to restore the chainquery and
|
||||
chainquery-mysql deployments, and restart pods:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
You can verify that the database now has data up to the height of the database
|
||||
snapshot. Login to the mysql shell:
|
||||
|
||||
```
|
||||
k8s-lbry chainquery-mysql-client
|
||||
```
|
||||
|
||||
Then query for the latest block height:
|
||||
|
||||
```
|
||||
mysql> select height from chainquery.block order by id desc limit 1;
|
||||
+--------+
|
||||
| height |
|
||||
+--------+
|
||||
| 561080 |
|
||||
+--------+
|
||||
1 row in set (0.00 sec)
|
||||
```
|
||||
|
||||
Also verify that chainquery is again happy. View the chainquery logs:
|
||||
|
||||
```
|
||||
k8s-lbry logs chainquery
|
||||
```
|
||||
|
||||
Press Ctrl-C to quit viewing the logs.
|
||||
|
||||
### lbrynet API service (not for spee.ch)
|
||||
|
||||
This is for a standalone lbrynet API service inside your cluster. Blob storage
|
||||
goes to its own persistent volume, but is configured with `save_files=false`.
|
||||
There is no outside access to the Downloads directory provided. You can stream
|
||||
blobs from lbrynet via `http://lbrynet:5279/get/CLAIM_NAME/CLAIM_ID`.
|
||||
|
||||
This particular lbrynet configuration won't work for spee.ch (v0.5.12). spee.ch
|
||||
needs direct access to the Downloads directory of lbrynet. **If you are wanting
|
||||
lbrynet for spee.ch, skip this section, and head directly to the [spee.ch
|
||||
section](#speech-and-lbrynet-sidecar-and-mysql), which implements its own
|
||||
lbrynet sidecar.**
|
||||
|
||||
Edit `values-dev.yaml` and set `lbrynet.enabled` to `true`.
|
||||
|
||||
Upgrade the release to turn on lbrynet:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
You can view the lbrynet logs:
|
||||
|
||||
```
|
||||
k8s-lbry logs lbrynet
|
||||
```
|
||||
|
||||
#### IMPORTANT - Backup your cluster wallet
|
||||
|
||||
The wallet is created inside the `lbrynet` persistent volume.
|
||||
|
||||
Copy the wallet in case the volume gets destroyed:
|
||||
|
||||
```
|
||||
k8s-lbry lbrynet-copy-wallet /tmp/k8s-lbry-lbrynet-wallet-backup.json
|
||||
```
|
||||
|
||||
Check the contents of `/tmp/k8s-lbry-lbrynet-wallet-backup.json` and move the
|
||||
file to a safe place for backup (make sure to delete the temporary file.)
|
||||
|
||||
Once your wallet is backed up, you can generate a receiving address in order to
|
||||
deposit LBC:
|
||||
|
||||
```
|
||||
k8s-lbry lbrynet address unused
|
||||
```
|
||||
|
||||
### spee.ch (and lbrynet sidecar and mysql)
|
||||
|
||||
*Note: Throughout this deployment, the unstylized name `speech` is used.*
|
||||
|
||||
Speech needs three containers, running in two pods:
|
||||
|
||||
* `speech` pod:
|
||||
|
||||
* speech, the nodejs server container.
|
||||
|
||||
* lbrynet, running in the same pod as speech, so as to share one downloads
|
||||
directory. (This is called a 'sidecar' container, which is guaranteed to
|
||||
run on the same kubernetes node as the spee.ch container.)
|
||||
|
||||
* `speech-mysql` pod:
|
||||
|
||||
* mysql for storing the speech database.
|
||||
|
||||
Edit `values-dev.yaml`.
|
||||
|
||||
* Set `speech-mysql.enabled` to `true`.
|
||||
* Set `speech.enabled` to `true`.
|
||||
* Set `speech.service.hostname` to your subdomain name for speech.
|
||||
* Set `speech.site.details.host` to your subdomain name for speech.
|
||||
* Set `speech.site.details.ipAddress` to your Load Balancer external IP address.
|
||||
* Set `speech.site.details.title`
|
||||
|
||||
Upgrade the release to turn on `speech`, `speech-lbrynet`, and `speech-mysql`:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
Speech will not work yet! Continue on through the next sections.
|
||||
|
||||
#### IMPORTANT - Backup your speech wallet
|
||||
|
||||
The wallet for speech is created inside the `speech-lbrynet` persistent volume.
|
||||
|
||||
Copy the wallet in case the volume gets destroyed:
|
||||
|
||||
```
|
||||
k8s-lbry speech-lbrynet-copy-wallet /tmp/k8s-lbry-speech-lbrynet-wallet-backup.json
|
||||
```
|
||||
|
||||
Check the contents of `/tmp/k8s-lbry-speech-lbrynet-wallet-backup.json` and move
|
||||
the file to a safe place for backup (make sure to delete the temporary file.)
|
||||
|
||||
#### Fund your speech wallet
|
||||
|
||||
Once your wallet is backed up, you can generate a receiving address in order to
|
||||
deposit LBC:
|
||||
|
||||
```
|
||||
k8s-lbry speech-lbrynet address unused
|
||||
```
|
||||
|
||||
Now send at least 5 LBC to your new speech wallet address.
|
||||
|
||||
Verify your speech wallet balance:
|
||||
|
||||
```
|
||||
k8s-lbry speech-lbrynet account balance
|
||||
```
|
||||
|
||||
#### Create a thumbnail channel
|
||||
|
||||
Create the LBRY channel for hosting speech thumbnails. Replace `@YOUR_NAME_HERE`
|
||||
with your chosen (unique) channel name to create. Amount is how much LBC to
|
||||
reserve for the claim:
|
||||
|
||||
```
|
||||
k8s-lbry speech-lbrynet channel new @YOUR_NAME_HERE --amount=1.0
|
||||
```
|
||||
|
||||
Get the claim id for the channel:
|
||||
|
||||
```
|
||||
k8s-lbry speech-lbrynet channel list
|
||||
```
|
||||
|
||||
The `claim_id` field is your `thumbnailChannelId` used in the next section.
|
||||
|
||||
#### Finish speech setup
|
||||
|
||||
Edit `values-dev.yaml` again:
|
||||
|
||||
* Set `speech.site.publishing.primaryClaimAddress` The fresh wallet address
|
||||
generated above.
|
||||
* Set `speech.site.publishing.thumbnailChannel` The name of the channel to
|
||||
publish thumbnails
|
||||
* Set `speech.site.publishing.thumbnailChannelId` The claim id of the channel
|
||||
to publish thumbnails. (see `k8s-lbry speech-lbrynet channel list`)
|
||||
* Set `speech.site.publishing.serviceOnlyApproved` if you want to limit the
|
||||
channels served.
|
||||
* Set `speech.site.publishing.approvedChannels` if you want to limit the
|
||||
channels served.
|
||||
* Set `speech.site.analytics.googleId`
|
||||
|
||||
See the [speech settings docs for more
|
||||
info](https://github.com/lbryio/spee.ch/blob/master/docs/settings.md)
|
||||
|
||||
Upgrade the release to apply the new settings:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
Restart the speech pod:
|
||||
|
||||
```
|
||||
k8s-lbry restart speech
|
||||
```
|
||||
|
||||
## Extra commands that k8s-lbry (run.sh) provides
|
||||
|
||||
You can run `k8s-lbry` without any arguments, and it will provide you some help.
|
||||
|
||||
### k8s-lbry helm
|
||||
|
||||
This script encapsulates helm so that it can run it's own local instance of
|
||||
tiller through [helm-tiller](https://github.com/rimusz/helm-tiller). As a
|
||||
convenience function, run.sh can start tiller locally, pass through any helm
|
||||
commands to your cluster, and then shutdown tiller:
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry helm ls
|
||||
```
|
||||
|
||||
|
||||
If you try to run `helm` without the `run.sh helm` wrapper, you should expect to
|
||||
see this error:
|
||||
|
||||
```
|
||||
Error: could not find tiller
|
||||
```
|
||||
|
||||
By design, [tiller is not running on your
|
||||
cluster](https://rimusz.net/tillerless-helm), it just runs locally for the
|
||||
duration that `run.sh` needs it, then shuts down.
|
||||
|
||||
### k8s-lbry kubectl
|
||||
|
||||
This script encapsulates kubectl so that you do not have to keep typing
|
||||
`--namespace k8s-lbry` all the time. All kubectl commands will default to
|
||||
`k8s-lbry` or the `NAMESPACE` environment variable if set.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl get pods
|
||||
```
|
||||
|
||||
### k8s-lbry logs
|
||||
|
||||
Stream the logs for a pod into your terminal, given the helm app name. If the
|
||||
pod contains more than one container you must specify it as the third argument.
|
||||
|
||||
Examples:
|
||||
|
||||
```
|
||||
k8s-lbry logs lbrycrd
|
||||
|
||||
k8s-lbry logs speech speech-lbrynet
|
||||
```
|
||||
|
||||
Press Ctrl-C to stop streaming the logs. If the logs seemingly hang forever,
|
||||
press Ctrl-C and try the command again.
|
||||
|
||||
|
||||
### k8s-lbry shell
|
||||
|
||||
When doing maintainance tasks, it is often useful to be able to attach a shell
|
||||
to a running pod. This is a convenience wrapper that uses the helm app name to
|
||||
connect to the correct pod.
|
||||
|
||||
This will connect to the pod running the `lbrynet` service.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry shell lbrynet
|
||||
```
|
||||
|
||||
Once in the shell, do whatever maintaince is necessary, and press `Ctrl-D` or
|
||||
type `exit` when done.
|
||||
|
||||
### k8s-lbry shell-pvc
|
||||
|
||||
When doing maintainance tasks, it is often useful to be able to run a utility
|
||||
container that mounts the persistent volume
|
||||
([PVC](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)) of
|
||||
another container. This is especially useful in scenarios where the pod will not
|
||||
start, and therefore cannot use the `run.sh shell` command in the previous
|
||||
section.
|
||||
|
||||
This will run a shell in a new utility container, mounting the lbrynet PVC to
|
||||
`/pvcs/lbrynet`.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry shell-pvc lbrynet
|
||||
```
|
||||
|
||||
Once in the shell, do whatever maintaince is necessary, and press `Ctrl-D` or
|
||||
type `exit` when done.
|
||||
|
||||
|
||||
### k8s-lbry restart
|
||||
|
||||
Delete a pod for a given app name. The existing deployment will immediately
|
||||
restart a new pod.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry restart speech
|
||||
```
|
||||
|
||||
### k8s-lbry lbrynet
|
||||
You can run the `lbrynet` client from within the running pod, redirecting output
|
||||
to your local console.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry lbrynet --help
|
||||
```
|
||||
|
||||
### k8s-lbry chainquery-mysql-client
|
||||
|
||||
Run the mysql shell for the chainquery database.
|
||||
|
||||
### k8s-lbry speech-mysql-client
|
||||
|
||||
Run the mysql shell for the speech database.
|
||||
|
||||
### k8s-lbry lbrynet-copy-wallet <local_backup_path>
|
||||
|
||||
Backup the lbrynet wallet to a local path.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry lbrynet-copy-wallet /tmp/k8s-lbry-lbrynet-wallet-backup.json
|
||||
```
|
||||
### k8s-lbry package
|
||||
|
||||
This is for the developer of this package to build and maintain the helm package
|
||||
releases, and upload to the S3 package repository. Requires `s3cmd` installed.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
k8s-lbry package 0.1.1
|
||||
```
|
||||
|
||||
|
||||
## TLS / SSL / HTTPS
|
||||
|
||||
You have already installed cert-manager for your cluster, but HTTPs is not
|
||||
turned on out of the box. Setup is easy:
|
||||
|
||||
* You need to create a DNS A record for your domain pointing to the External IP
|
||||
address of the nginx-ingress Load Balancer. (Preferably create a wildcard
|
||||
record for an entire subdomain [`*.example.com` or `*.lbry.example.com`],
|
||||
that way you only have to set this up once, no matter how many sub-domains
|
||||
you end up needing.) Refer to the [install
|
||||
section](https://github.com/EnigmaCurry/lbry-docker/tree/k8s-lbry/contrib/k8s-lbry#k8s-lbry-install)
|
||||
for how to retrieve the IP address.
|
||||
|
||||
* Edit `values-dev.yaml`
|
||||
|
||||
* Change `cert-manager-issuer.email` from the example email address to your
|
||||
own. [Let's Encrypt](https://letsencrypt.org/) is a free TLS certificate
|
||||
issuer, and they will send you important emails about your domain and
|
||||
certificate expirations.
|
||||
|
||||
* You can turn on the echo service to test with:
|
||||
|
||||
* Change `echo-http-server.enabled` to `true`
|
||||
|
||||
* Change `echo-http-server.hostname` to a hostname you've configured the DNS
|
||||
for.
|
||||
|
||||
Upgrade nginx-ingress, turning on HTTPs support (copy the command **including the wrapping parentheses**):
|
||||
|
||||
```
|
||||
(
|
||||
NGINX_ENABLE_HTTPS=true
|
||||
k8s-lbry upgrade-nginx-ingress
|
||||
)
|
||||
```
|
||||
|
||||
And Upgrade `k8s-lbry`:
|
||||
|
||||
```
|
||||
k8s-lbry upgrade
|
||||
```
|
||||
|
||||
If you turned on the echo service, try it out with curl:
|
||||
|
||||
```
|
||||
curl -L https://echo.example.com
|
||||
```
|
||||
|
||||
It should return the name of the service: `echo-http-server`.
|
||||
|
||||
If you get any certificate validation errors, then you may need to wait for up
|
||||
to 20 minutes for the certificate to be issued, and then retry.
|
||||
|
||||
If you run into problems with certificates, check out the cert-manager logs:
|
||||
|
||||
```
|
||||
kubectl -n cert-manager logs -l app=cert-manager -f
|
||||
```
|
||||
|
||||
Also check the certificate resources:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl get certificates
|
||||
```
|
||||
|
||||
You should see the `echo-http-server-tls` certificate resource listed. The
|
||||
`READY` status is the indicator as to whether the certificate has been issued
|
||||
yet or not.
|
||||
|
||||
## Cloud specific notes
|
||||
|
||||
### AWS
|
||||
|
||||
Deployment on AWS requires these modifications:
|
||||
|
||||
Following the [CDK on
|
||||
AWS](https://www.ubuntu.com/kubernetes/docs/aws-integration) docs, install the
|
||||
StorageClass for EBS:
|
||||
|
||||
```
|
||||
kubectl create -f - <<EOF
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: ebs-gp2
|
||||
provisioner: kubernetes.io/aws-ebs
|
||||
parameters:
|
||||
type: gp2
|
||||
EOF
|
||||
```
|
||||
|
||||
In `values-dev.yaml` all of your persistence configurations need to add
|
||||
`storageClass: ebs-gp2`. There are commented versions in the default config file
|
||||
which you can simply uncomment.
|
||||
|
||||
### minikube
|
||||
|
||||
[minikube](https://kubernetes.io/docs/setup/minikube/) lets you run kubernetes
|
||||
on your development machine, in VirtualBox.
|
||||
|
||||
Make sure you start minikube with sufficient RAM for testing:
|
||||
|
||||
```
|
||||
minikube start --memory 4096
|
||||
```
|
||||
|
||||
In order for minikube to route the LoadBalancer correctly, you need to [add a
|
||||
route on the host, and install a
|
||||
patch](https://github.com/elsonrodriguez/minikube-lb-patch) to your cluster:
|
||||
|
||||
```
|
||||
## ONLY RUN THESE COMMANDS IF YOU ARE USING MINIKUBE:
|
||||
sudo ip route add $(cat ~/.minikube/profiles/minikube/config.json | jq -r ".KubernetesConfig.ServiceCIDR") via $(minikube ip)
|
||||
|
||||
kubectl run minikube-lb-patch --replicas=1 --image=elsonrodriguez/minikube-lb-patch:0.1 --namespace=kube-system
|
||||
```
|
||||
|
||||
If it works correctly, after you run `k8s-lbry install-nginx-ingress`, the
|
||||
External IP address for the LoadBalancer should no longer be `pending`:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl get svc nginx-ingress-controller
|
||||
```
|
||||
|
||||
## Uninstall
|
||||
|
||||
If you wish to uninstall k8s-lbry from your cluster, here are the steps:
|
||||
|
||||
* Delete the helm releases:
|
||||
|
||||
```
|
||||
k8s-lbry helm delete k8s-lbry
|
||||
|
||||
k8s-lbry helm delete cert-manager
|
||||
|
||||
k8s-lbry helm delete nginx-ingress
|
||||
```
|
||||
|
||||
* By deleting the `nginx-ingress` release, the Load Balancer resource should
|
||||
be automatically cleaned up. You can verify this yourself in your cloud
|
||||
provider's console that no Load Balancer is still running.
|
||||
|
||||
* Delete the Persistent Volume Claims:
|
||||
|
||||
* In `values-dev.yaml` all of the persistence claims are labeled as
|
||||
`"helm.sh/resource-policy": keep`. This means that helm will not
|
||||
automatically delete the volume when it deletes the release.
|
||||
|
||||
* List all of your Persistent Volume Claims:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl get pvc
|
||||
```
|
||||
|
||||
* Then delete each one you no longer want:
|
||||
|
||||
```
|
||||
k8s-lbry kubectl delete pvc [name-of-pvc]
|
||||
```
|
||||
|
||||
* Deleting the claim, should delete the volume. You can verify this yourself
|
||||
in your cloud provider's console that no Volumes exist.
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: Install staging and production certificate issuers with Lets Encrypt ACME.
|
||||
name: cert-manager-issuer
|
||||
version: 0.1.0
|
|
@ -1,32 +0,0 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "cert-manager-issuer.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "cert-manager-issuer.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "cert-manager-issuer.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: certmanager.k8s.io/v1alpha1
|
||||
kind: Issuer
|
||||
metadata:
|
||||
name: letsencrypt-prod
|
||||
spec:
|
||||
acme:
|
||||
# The ACME server URL
|
||||
server: https://acme-v02.api.letsencrypt.org/directory
|
||||
# Email address used for ACME registration
|
||||
email: {{ .Values.email }}
|
||||
# Name of a secret used to store the ACME account private key
|
||||
privateKeySecretRef:
|
||||
name: letsencrypt-prod
|
||||
# Enable the HTTP-01 challenge provider
|
||||
http01: {}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
apiVersion: certmanager.k8s.io/v1alpha1
|
||||
kind: Issuer
|
||||
metadata:
|
||||
name: letsencrypt-staging
|
||||
spec:
|
||||
acme:
|
||||
# The ACME server URL
|
||||
server: https://acme-staging-v02.api.letsencrypt.org/directory
|
||||
# Email address used for ACME registration
|
||||
email: {{ .Values.email }}
|
||||
# Name of a secret used to store the ACME account private key
|
||||
privateKeySecretRef:
|
||||
name: letsencrypt-staging
|
||||
# Enable the HTTP-01 challenge provider
|
||||
http01: {}
|
|
@ -1,22 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "v0.0.0"
|
||||
description: LBRY chainquery
|
||||
name: chainquery
|
||||
version: 0.1.0
|
|
@ -1,32 +0,0 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "chainquery.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "chainquery.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "chainquery.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -1,13 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "chainquery.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "chainquery.name" . }}
|
||||
chart: {{ template "chainquery.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{ toYaml .Values.configurationFile | indent 2 }}
|
||||
{{- end }}
|
|
@ -1,61 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "chainquery.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "chainquery.name" . }}
|
||||
chart: {{ template "chainquery.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "chainquery.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "chainquery.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
{{- if .Values.configurationFile }}
|
||||
initContainers:
|
||||
- name: copy-chainquery-config
|
||||
image: busybox
|
||||
command: ['sh', '-c', 'cp /configmap/chainqueryconfig.toml /etc/lbry/chainqueryconfig.toml']
|
||||
volumeMounts:
|
||||
- name: configmap
|
||||
mountPath: /configmap
|
||||
- name: config
|
||||
mountPath: /etc/lbry
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "chainquery.fullname" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 10 }}
|
||||
ports:
|
||||
- name: port
|
||||
containerPort: {{ .Values.service.port }}
|
||||
volumeMounts:
|
||||
{{- if .Values.configurationFile }}
|
||||
- name: config
|
||||
mountPath: /etc/lbry/chainqueryconfig.toml
|
||||
subPath: chainqueryconfig.toml
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.configurationFile }}
|
||||
- name: config
|
||||
emptyDir: {}
|
||||
- name: configmap
|
||||
configMap:
|
||||
name: {{ template "chainquery.fullname" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,19 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "chainquery.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "chainquery.name" . }}
|
||||
chart: {{ template "chainquery.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
ports:
|
||||
- name: port
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: port
|
||||
selector:
|
||||
app: {{ template "chainquery.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
|
@ -1,22 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: An HTTP echo service
|
||||
name: echo-http-server
|
||||
version: 0.1.0
|
|
@ -1,32 +0,0 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "echo-http-server.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "echo-http-server.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "echo-http-server.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -1,24 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ .Values.service }}
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
certmanager.k8s.io/issuer: {{ .Values.certificateIssuer }}
|
||||
certmanager.k8s.io/acme-challenge-type: http01
|
||||
spec:
|
||||
{{ if .Values.enableHttps }}
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ .Values.hostname }}
|
||||
secretName: {{ .Values.service }}-tls
|
||||
{{ end }}
|
||||
rules:
|
||||
- host: {{ .Values.hostname }}
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: {{ .Values.service }}
|
||||
servicePort: 80
|
||||
{{- end }}
|
|
@ -1,34 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.service }}
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 5678
|
||||
selector:
|
||||
app: {{ .Values.service }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Values.service }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Values.service }}
|
||||
replicas: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Values.service }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ template "echo-http-server.fullname" . }}
|
||||
image: hashicorp/http-echo
|
||||
args:
|
||||
- "-text={{ .Values.service }}"
|
||||
ports:
|
||||
- containerPort: 5678
|
||||
{{- end }}
|
|
@ -1,22 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A socket echo service
|
||||
name: echo-socket-server
|
||||
version: 0.1.0
|
|
@ -1,32 +0,0 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "echo-socket-server.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "echo-socket-server.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "echo-socket-server.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -1,33 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.service }}
|
||||
spec:
|
||||
ports:
|
||||
- port: 8000
|
||||
targetPort: 8000
|
||||
selector:
|
||||
app: {{ .Values.service }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Values.service }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Values.service }}
|
||||
replicas: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Values.service }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ template "echo-socket-server.fullname" . }}
|
||||
image: enigmacurry/echo-socket-server
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
{{- end }}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "v0.0.0"
|
||||
description: lbrycrd LBRY blockchain daemon
|
||||
name: lbrycrd
|
||||
version: 0.1.0
|
|
@ -1,32 +0,0 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "lbrycrd.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "lbrycrd.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "lbrycrd.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -1,13 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "lbrycrd.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrycrd.name" . }}
|
||||
chart: {{ template "lbrycrd.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{ toYaml .Values.configurationFile | indent 2 }}
|
||||
{{- end }}
|
|
@ -1,78 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "lbrycrd.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrycrd.name" . }}
|
||||
chart: {{ template "lbrycrd.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "lbrycrd.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "lbrycrd.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
{{- if .Values.configurationFile }}
|
||||
initContainers:
|
||||
- name: copy-lbrycrd-config
|
||||
image: busybox
|
||||
command: ['sh', '-c', 'cp /configmap/lbrycrd.conf /etc/lbry/lbrycrd.conf']
|
||||
volumeMounts:
|
||||
- name: configmap
|
||||
mountPath: /configmap
|
||||
- name: config
|
||||
mountPath: /etc/lbry
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "lbrycrd.fullname" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
env:
|
||||
- name: RUN_MODE
|
||||
value: "default"
|
||||
- name: PORT
|
||||
value: "{{ .Values.service.port }}"
|
||||
- name: RPC_PORT
|
||||
value: "{{ .Values.service.rpcPort }}"
|
||||
resources: {{ toYaml .Values.resources | indent 10 }}
|
||||
ports:
|
||||
- name: port
|
||||
containerPort: {{ .Values.service.port }}
|
||||
- name: rpc
|
||||
containerPort: {{ .Values.service.rpcPort }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
{{- if .Values.configurationFile }}
|
||||
- name: config
|
||||
mountPath: /etc/lbry/lbrycrd.conf
|
||||
subPath: lbrycrd.conf
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.configurationFile }}
|
||||
- name: config
|
||||
emptyDir: {}
|
||||
- name: configmap
|
||||
configMap:
|
||||
name: {{ template "lbrycrd.fullname" . }}
|
||||
{{- end }}
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.persistence.existingClaim | default (include "lbrycrd.fullname" .) }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end -}}
|
||||
{{- end }}
|
|
@ -1,31 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "lbrycrd.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrycrd.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,22 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "lbrycrd.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrycrd.name" . }}
|
||||
chart: {{ template "lbrycrd.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
ports:
|
||||
- name: port
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: port
|
||||
- name: rpc
|
||||
port: {{ .Values.service.rpcPort }}
|
||||
targetPort: rpc
|
||||
selector:
|
||||
app: {{ template "lbrycrd.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
|
@ -1,22 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "v0.0.0"
|
||||
description: LBRY lbrynet
|
||||
name: lbrynet
|
||||
version: 0.1.0
|
|
@ -1,32 +0,0 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "lbrynet.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "lbrynet.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "lbrynet.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -1,15 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "lbrynet.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrynet.name" . }}
|
||||
chart: {{ template "lbrynet.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{- with .Values.daemon_settings }}
|
||||
daemon_settings.yml: {{ toYaml . | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,76 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "lbrynet.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrynet.name" . }}
|
||||
chart: {{ template "lbrynet.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "lbrynet.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "lbrynet.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
{{- if .Values.daemon_settings }}
|
||||
initContainers:
|
||||
- name: copy-lbrynet-config
|
||||
image: busybox
|
||||
command: ['sh', '-c', 'cp /configmap/daemon_settings.yml /etc/lbry/daemon_settings.yml']
|
||||
volumeMounts:
|
||||
- name: configmap
|
||||
mountPath: /configmap
|
||||
- name: config
|
||||
mountPath: /etc/lbry
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "lbrynet.fullname" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
env:
|
||||
- name: RUN_MODE
|
||||
value: "default"
|
||||
- name: PORT
|
||||
value: "{{ .Values.service.port }}"
|
||||
- name: RPC_PORT
|
||||
value: "{{ .Values.service.rpcPort }}"
|
||||
resources: {{ toYaml .Values.resources | indent 10 }}
|
||||
ports:
|
||||
- name: rpc
|
||||
containerPort: {{ .Values.service.rpcPort }}
|
||||
volumeMounts:
|
||||
- name: lbrynet-home
|
||||
mountPath: /home/lbrynet
|
||||
{{- if .Values.daemon_settings }}
|
||||
- name: config
|
||||
mountPath: /etc/lbry/daemon_settings.yml
|
||||
subPath: daemon_settings.yml
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.daemon_settings }}
|
||||
- name: config
|
||||
emptyDir: {}
|
||||
- name: configmap
|
||||
configMap:
|
||||
name: {{ template "lbrynet.fullname" . }}
|
||||
{{- end }}
|
||||
- name: lbrynet-home
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.persistence.existingClaim | default (include "lbrynet.fullname" .) }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end -}}
|
||||
{{- end }}
|
|
@ -1,30 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "lbrynet.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrynet.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,19 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "lbrynet.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "lbrynet.name" . }}
|
||||
chart: {{ template "lbrynet.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
ports:
|
||||
- name: rpc
|
||||
port: {{ .Values.service.rpcPort }}
|
||||
targetPort: rpc
|
||||
selector:
|
||||
app: {{ template "lbrynet.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
|
@ -1,22 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: v1
|
||||
appVersion: "v0.0.0"
|
||||
description: LBRY spee.ch
|
||||
name: speech
|
||||
version: 0.1.0
|
|
@ -1,32 +0,0 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "speech.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "speech.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "speech.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -1,36 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "speech.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "speech.name" . }}
|
||||
chart: {{ template "speech.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{- with .Values.auth }}
|
||||
authConfig.json: {{ toJson . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.mysql }}
|
||||
mysqlConfig.json: {{ toJson . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.chainquery }}
|
||||
chainqueryConfig.json: {{ toJson . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.lbrynet }}
|
||||
lbryConfig.json: {{ toJson . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.site }}
|
||||
siteConfig.json: {{ toJson . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.logger }}
|
||||
loggerConfig.json: {{ toJson . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.slack }}
|
||||
slackConfig.json: {{ toJson . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.lbrynet.daemon_settings }}
|
||||
daemon_settings.yml: {{ toYaml . | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,93 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "speech.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "speech.name" . }}
|
||||
chart: {{ template "speech.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "speech.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "speech.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
initContainers:
|
||||
- name: copy-lbrycrd-config
|
||||
image: busybox
|
||||
command: ['sh', '-c', 'cp /configmap/chainqueryConfig.json /configmap/lbryConfig.json /configmap/loggerConfig.json /configmap/mysqlConfig.json /configmap/siteConfig.json /configmap/slackConfig.json /configmap/daemon_settings.yml /config && cp /configmap/authConfig.json /private']
|
||||
volumeMounts:
|
||||
- name: configmap
|
||||
mountPath: /configmap
|
||||
- name: config
|
||||
mountPath: /config
|
||||
- name: private
|
||||
mountPath: /private
|
||||
containers:
|
||||
- name: {{ template "speech.fullname" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
resources: {{ toYaml .Values.resources | indent 10 }}
|
||||
ports:
|
||||
- name: port
|
||||
containerPort: {{ .Values.service.port }}
|
||||
volumeMounts:
|
||||
- name: configmap
|
||||
mountPath: /spee.ch/site/config
|
||||
- name: private
|
||||
mountPath: /spee.ch/site/private
|
||||
- name: speech-data
|
||||
mountPath: /data
|
||||
{{- if .Values.lbrynet.enabled }}
|
||||
- name: {{ template "speech.fullname" . }}-lbrynet
|
||||
image: "{{ .Values.lbrynet.image.repository }}:{{ .Values.lbrynet.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.lbrynet.image.pullPolicy }}
|
||||
resources: {{ toYaml .Values.resources | indent 10 }}
|
||||
ports:
|
||||
- name: rpc
|
||||
containerPort: {{ .Values.lbrynet.service.rpcPort }}
|
||||
volumeMounts:
|
||||
- name: configmap
|
||||
mountPath: /etc/lbry
|
||||
- name: lbrynet-home
|
||||
mountPath: /home/lbrynet
|
||||
- name: speech-data
|
||||
mountPath: /data
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
- name: private
|
||||
- name: configmap
|
||||
configMap:
|
||||
name: {{ template "speech.fullname" . }}
|
||||
- name: speech-data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.persistence.existingClaim | default (include "speech.fullname" .) }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: lbrynet-home
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
{{- if .Values.lbrynet.persistence.existingClaim }}
|
||||
claimName: {{ .Values.lbrynet.persistence.existingClaim }}
|
||||
{{- else }}
|
||||
claimName: {{ template "speech.fullname" .}}-lbrynet
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,24 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ .Values.service.name }}
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
certmanager.k8s.io/issuer: {{ .Values.service.certificateIssuer }}
|
||||
certmanager.k8s.io/acme-challenge-type: http01
|
||||
spec:
|
||||
{{ if .Values.service.enableHttps }}
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ .Values.service.hostname }}
|
||||
secretName: {{ .Values.service.name }}-tls
|
||||
{{ end }}
|
||||
rules:
|
||||
- host: {{ .Values.service.hostname }}
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: {{ .Values.service.name }}
|
||||
servicePort: {{ .Values.service.port }}
|
||||
{{- end }}
|
|
@ -1,62 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "speech.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "speech.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if and .Values.lbrynet.persistence.enabled (not .Values.lbrynet.persistence.existingClaim) }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "speech.fullname" . }}-lbrynet
|
||||
labels:
|
||||
app: {{ template "speech.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end }}
|
|
@ -1,19 +0,0 @@
|
|||
{{- if .Values.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "speech.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "speech.name" . }}
|
||||
chart: {{ template "speech.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
ports:
|
||||
- name: port
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: port
|
||||
selector:
|
||||
app: {{ template "speech.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
|
@ -1,44 +0,0 @@
|
|||
apiVersion: v1
|
||||
entries:
|
||||
k8s-lbry:
|
||||
- apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
created: "2019-06-16T20:45:37.131503885-04:00"
|
||||
description: LBRY on Kubernetes with Helm
|
||||
digest: 0e28fad6b25fcbf79ea30390a65340c50422e84408a86f6e366abdfb1c471cf0
|
||||
home: https://github.com/lbryio/lbry-docker/tree/master/contrib/k8s-lbry
|
||||
maintainers:
|
||||
- email: ryan@enigmacurry.com
|
||||
name: EnigmaCurry
|
||||
- email: leopere [at] nixc [dot] us
|
||||
name: Leopere
|
||||
name: k8s-lbry
|
||||
urls:
|
||||
- https://github.com/lbryio/lbry-docker/releases/download/k8s-lbry-0.1.5/k8s-lbry-0.1.5.tgz
|
||||
version: 0.1.5
|
||||
mysql:
|
||||
- appVersion: 5.7.14
|
||||
created: "2019-06-16T20:45:37.133445969-04:00"
|
||||
description: Fast, reliable, scalable, and easy to use open-source relational
|
||||
database system.
|
||||
digest: dacef52f53a395059131064cfdc7ae39ae2d7be2580440575d1532dfaa3fd2b8
|
||||
engine: gotpl
|
||||
home: https://www.mysql.com/
|
||||
icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png
|
||||
keywords:
|
||||
- mysql
|
||||
- database
|
||||
- sql
|
||||
maintainers:
|
||||
- email: o.with@sportradar.com
|
||||
name: olemarkus
|
||||
- email: viglesias@google.com
|
||||
name: viglesiasce
|
||||
name: mysql
|
||||
sources:
|
||||
- https://github.com/kubernetes/charts
|
||||
- https://github.com/docker-library/mysql
|
||||
urls:
|
||||
- charts/mysql-0.19.0.tgz
|
||||
version: 0.19.0
|
||||
generated: "2019-06-16T20:45:36.911335647-04:00"
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 190 KiB |
Binary file not shown.
Before Width: | Height: | Size: 51 KiB |
|
@ -1,12 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="player/asciinema-player.css">
|
||||
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAe94AAEpSAABKUgAAe94AAAAAAAB73gAAe9IAAHvSAAB73gAAAAAAAHveAAB6XgAAel4AAHveAAAAAAAA" rel="icon" type="image/x-icon" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="CRT_BOX"></div>
|
||||
<script src="player/asciinema-player.v2.6.1.js"></script>
|
||||
<script src="kick-ascii.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
window.onload = function() {
|
||||
var crt = document.getElementById("CRT_BOX")
|
||||
var urlParams = new URLSearchParams(window.location.search)
|
||||
var cast = urlParams.get("cast") != null ? urlParams.get("cast") : "index"
|
||||
var speed = urlParams.get("speed") == null ? " speed=\"1\" " : " speed=\"" + urlParams.get("speed") + "\" "
|
||||
var bg = urlParams.get("bg")
|
||||
var autoplay = urlParams.get("autoplay") === "false" ? "" : " autoplay=\"true\" "
|
||||
var loop = urlParams.get("loop") === "false" ? "" : " loop=\"true\" "
|
||||
var preload = urlParams.get("preload") === "false" ? "" : " preload=\"true\" "
|
||||
var fontsize = urlParams.get("fontsize") == null ? " fontsize=\"small\" " : " fontsize=\"" + urlParams.get("fontsize") + "\" "
|
||||
|
||||
crt.innerHTML = "<asciinema-player id=\"asciinema-player\" src=\"cast/" + cast + ".cast\"" + fontsize + autoplay + loop + preload + speed + "></asciinema-player>"
|
||||
|
||||
var player = document.getElementsByTagName("asciinema-player")[0]
|
||||
|
||||
var background = document.createElement("img")
|
||||
background.classList.add("bg_image")
|
||||
|
||||
if (bg != null) {
|
||||
background.src = "img/" + bg
|
||||
document.body.append(background)
|
||||
}
|
||||
|
||||
window.addEventListener('resize', function() {
|
||||
var wrapper = document.getElementsByClassName("asciinema-player-wrapper")[0]
|
||||
if (wrapper != null) {
|
||||
var control_bar_offset = 23;
|
||||
var scale = (document.body.clientHeight / (wrapper.clientHeight + control_bar_offset));
|
||||
if (wrapper.clientWidth * scale < document.body.clientWidth) {
|
||||
crt.style.transform = "scale("+scale+") translate(-50%, 0%)";
|
||||
crt.classList.add("crt_wide")
|
||||
background.classList.remove("bg_raised")
|
||||
} else {
|
||||
scale = (document.body.clientWidth / (wrapper.clientWidth));
|
||||
crt.style.transform = "scale("+scale+")";
|
||||
crt.classList.remove("crt_wide")
|
||||
background.classList.add("bg_raised")
|
||||
}
|
||||
}
|
||||
});
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
setInterval(function(){window.dispatchEvent(new Event('resize'));}, 1000)
|
||||
|
||||
var playing = true;
|
||||
let drag = false;
|
||||
|
||||
// Click anywhere to play/pause
|
||||
// Allow selecting/dragging text without affecting play/pause
|
||||
document.addEventListener('mousedown', () => drag = false);
|
||||
document.addEventListener('mousemove', () => drag = true);
|
||||
document.addEventListener('mouseup', function() {
|
||||
if(!drag){
|
||||
if (playing) {
|
||||
player.pause()
|
||||
playing = false
|
||||
} else {
|
||||
player.play()
|
||||
playing = true
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,9 +0,0 @@
|
|||
dependencies:
|
||||
- name: mysql
|
||||
repository: https://kubernetes-charts.storage.googleapis.com
|
||||
version: 0.19.0
|
||||
- name: mysql
|
||||
repository: https://kubernetes-charts.storage.googleapis.com
|
||||
version: 0.19.0
|
||||
digest: sha256:dcb695ba5d5865f2a0b760e1bbef189b9465df4592a69463d18eed925e34e91a
|
||||
generated: 2019-05-17T10:07:58.995024521-04:00
|
|
@ -1,11 +0,0 @@
|
|||
dependencies:
|
||||
- name: mysql
|
||||
alias: chainquery-mysql
|
||||
repository: "@stable"
|
||||
version: 0.19.0
|
||||
condition: chainquery-mysql.enabled,global.chainquery-mysql.enabled
|
||||
- name: mysql
|
||||
alias: speech-mysql
|
||||
repository: "@stable"
|
||||
version: 0.19.0
|
||||
condition: speech-mysql.enabled,global.speech-mysql.enabled
|
|
@ -1,656 +0,0 @@
|
|||
#!/bin/bash
|
||||
BASEDIR=$(cd $(dirname "$0"); pwd)
|
||||
BASENAME=$(basename "$0")
|
||||
|
||||
## RELEASE - The name for the helm release.
|
||||
RELEASE=${RELEASE:-k8s-lbry}
|
||||
|
||||
## NAMESPACE - The Kubernetes namespace for the release
|
||||
NAMESPACE=${NAMESPACE:-k8s-lbry}
|
||||
|
||||
## CHART - The helm chart location (local path, or from repository)
|
||||
### Use the stable chart from the HELM_REPO repository:
|
||||
CHART=${CHART:-lbry/k8s-lbry}
|
||||
### Use the chart from the current directory:
|
||||
#CHART=${CHART:-$BASEDIR}
|
||||
|
||||
## VALUES - The path to your configured helm values.yaml:
|
||||
VALUES=${VALUES:-$BASEDIR/values-dev.yaml}
|
||||
DEFAULT_VALUES_URL=${DEFAULT_VALUES_URL:-https://raw.githubusercontent.com/lbryio/lbry-docker/master/contrib/k8s-lbry/values.yaml}
|
||||
|
||||
## HELM_REPO - The stable helm chart repository for this chart:
|
||||
HELM_REPO=${HELM_REPO:-https://lbryio.github.io/lbry-docker/contrib/k8s-lbry/}
|
||||
|
||||
## TILLER_HOST - The host that runs tiller
|
||||
TILLER_HOST=${TILLER_HOST:-localhost}
|
||||
|
||||
## CERTMANAGER_NAMESPACE - The namespace cert-manager runs in
|
||||
CERTMANAGER_NAMESPACE=${CERTMANAGER_NAMESPACE:-cert-manager}
|
||||
CERTMANAGER_VERSION=v0.7.1
|
||||
|
||||
## NGINX_ENABLE_HTTPS - This needs to be set false until DNS is setup.
|
||||
NGINX_ENABLE_HTTPS=${NGINX_ENABLE_HTTPS:-false}
|
||||
|
||||
## Mysql Database snapshot download url:
|
||||
## TODO: Use lbry owned bucket for this:
|
||||
CHAINQUERY_SNAPSHOT_URL=${CHAINQUERY_SNAPSHOT_URL:-https://lbry-chainquery-mysql-dump.sfo2.digitaloceanspaces.com/chainquery_height_560900.mysql-backup.tar.gz}
|
||||
|
||||
## lbrycrd snapshot download url:
|
||||
## TODO: Use lbry owned bucket for this:
|
||||
LBRYCRD_SNAPSHOT_URL=${LBRYCRD_SNAPSHOT_URL:-https://lbry-chainquery-mysql-dump.sfo2.digitaloceanspaces.com/lbrycrd-566588-snapshot.tar.gz}
|
||||
|
||||
LBRYCRD_RPC_USER=${LBRYCRD_RPC_USER:-lbry}
|
||||
LBRYCRD_RPC_PASSWORD=${LBRYCRD_RPC_PASSWORD:-lbry}
|
||||
|
||||
## Bash alias name for run.sh
|
||||
## defaults to $NAMESPACE (k8s-lbry)
|
||||
RUN_ALIAS=${RUN_ALIAS:-$NAMESPACE}
|
||||
|
||||
exe() { ( echo "## $*"; $*; ) }
|
||||
|
||||
setup() {
|
||||
### Check for external dependencies:
|
||||
if ! which helm > /dev/null; then
|
||||
echo "Error: You must install helm"
|
||||
echo "On Ubuntu you can run: sudo snap install --classic helm"
|
||||
echo "For other platforms, see https://github.com/helm/helm/releases/latest"
|
||||
exit 1
|
||||
fi
|
||||
if ! which kubectl > /dev/null; then
|
||||
echo "Error: You must install kubectl"
|
||||
echo "On Ubuntu you can run: sudo snap install --classic kubectl"
|
||||
echo "For other platforms, see https://kubernetes.io/docs/tasks/tools/install-kubectl/"
|
||||
exit 1
|
||||
fi
|
||||
if ! which git > /dev/null; then
|
||||
echo "Error: You must install git"
|
||||
echo "On Ubuntu you can run: sudo apt install -y git"
|
||||
echo "For other platforms, see https://git-scm.com/downloads"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### Initialize helm locally, but do not install tiller to the cluster:
|
||||
HELM=$(which helm)
|
||||
if [ ! -f "$HOME"/.helm/repository/repositories.yaml ]; then
|
||||
exe "$HELM" init --client-only
|
||||
fi
|
||||
|
||||
### Add the stable helm chart repository:
|
||||
if [ "$CHART" != "$BASEDIR" ]; then
|
||||
exe "$HELM" repo add lbry "$HELM_REPO"
|
||||
exe "$HELM" repo update
|
||||
fi
|
||||
|
||||
### Install helm-tiller plugin, so that no tiller needs to be installed to the cluster:
|
||||
exe "$HELM" plugin install https://github.com/rimusz/helm-tiller || true
|
||||
|
||||
### Setup the values.yaml for the chart, using the VALUES environment variable or script default
|
||||
### If no values file exists, interactively ask if a default config should be created in its place.
|
||||
if [ ! -f "$VALUES" ]; then
|
||||
echo ""
|
||||
echo "Values file does not exist: $VALUES"
|
||||
read -p "Would you like to create a default config file here? (y/N)" choice
|
||||
echo ""
|
||||
case "$choice" in
|
||||
y|Y ) curl "$DEFAULT_VALUES_URL" -Lo "$VALUES"
|
||||
echo "Default configuration created: $VALUES"
|
||||
;;
|
||||
* ) echo "You must create your own values file: $VALUES (using values.yaml as a template.)"
|
||||
echo "Or set VALUES=/path/to/values.yaml before subsequent commands."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "Configuration found: $VALUES"
|
||||
fi
|
||||
echo "Edit this config file to suit your own environment before install/upgrade"
|
||||
|
||||
}
|
||||
|
||||
helm() {
|
||||
## Redefine all helm commands to run through local tiller instance
|
||||
## https://rimusz.net/tillerless-helm
|
||||
HELM=$(which helm)
|
||||
exe "$HELM" tiller run "$NAMESPACE" -- helm "$*"
|
||||
}
|
||||
|
||||
kubectl() {
|
||||
## kubectl wrapper that defaults to k8s-lbry namespace, so you don't have to
|
||||
## type as much, but still passes all the provided arguments on to kubectl.
|
||||
## So you can still specify a different namespace, because the client args
|
||||
## are applied last.
|
||||
KUBECTL=$(which kubectl)
|
||||
exe "$KUBECTL" --namespace "$NAMESPACE" "$*"
|
||||
}
|
||||
|
||||
install-nginx-ingress() {
|
||||
### Install nginx-ingress from stable helm repository
|
||||
### See https://github.com/helm/charts/tree/master/stable/nginx-ingress
|
||||
helm install stable/nginx-ingress --namespace "$NAMESPACE" --name nginx-ingress --set nginx-ingress.controller.service.enableHttps="$NGINX_ENABLE_HTTPS" --set tcp.9246="$NAMESPACE/lbrycrd:9246"
|
||||
}
|
||||
|
||||
upgrade-nginx-ingress() {
|
||||
### Upgrade nginx-ingress
|
||||
helm upgrade nginx-ingress stable/nginx-ingress --namespace "$NAMESPACE" --set nginx-ingress.controller.service.enableHttps="$NGINX_ENABLE_HTTPS" --set tcp.9246="$NAMESPACE/lbrycrd:9246"
|
||||
}
|
||||
|
||||
install-cert-manager() {
|
||||
### Install cert-manager from jetstack helm repository
|
||||
### See https://docs.cert-manager.io/en/latest/index.html
|
||||
kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.7/deploy/manifests/00-crds.yaml
|
||||
|
||||
helm repo add jetstack https://charts.jetstack.io
|
||||
helm repo update
|
||||
|
||||
helm install --name cert-manager --namespace "$CERTMANAGER_NAMESPACE" jetstack/cert-manager --version $CERTMANAGER_VERSION
|
||||
|
||||
kubectl label namespace "$CERTMANAGER_NAMESPACE" certmanager.k8s.io/disable-validation="true"
|
||||
}
|
||||
|
||||
upgrade-cert-manager() {
|
||||
### Upgrade cert-manager
|
||||
helm upgrade cert-manager jetstack/cert-manager --namespace "$CERTMANAGER_NAMESPACE" --version $CERTMANAGER_VERSION
|
||||
}
|
||||
|
||||
install() {
|
||||
### Install the k8s-lbry helm chart
|
||||
if [ ! -f "$VALUES" ]; then
|
||||
echo "Could not find chart values file: $VALUES"
|
||||
exit 1
|
||||
fi
|
||||
helm install "$CHART" --name "$RELEASE" --namespace="$NAMESPACE" -f "$VALUES"
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
### Upgrade the k8s-lbry helm chart
|
||||
if [ ! -f "$VALUES" ]; then
|
||||
echo "Could not find chart values file: $VALUES"
|
||||
exit 1
|
||||
fi
|
||||
helm upgrade "$RELEASE" "$CHART" --namespace="$NAMESPACE" -f "$VALUES"
|
||||
}
|
||||
|
||||
shell() {
|
||||
### Execute a shell in the running container with helm app name provided by first argument
|
||||
(
|
||||
if [ "$#" -eq 1 ]; then
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL get --namespace "$NAMESPACE" pod -l app="$1" -o name | sed s+pod/++)
|
||||
exe kubectl exec -it "$POD" /bin/bash
|
||||
else
|
||||
echo "Required arg: helm app name of pod to shell into"
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
shell-pvc() {
|
||||
### Start a utility container shell with an attached Persistent Volume Claim.
|
||||
(
|
||||
# From https://gist.github.com/yuanying/3aa7d59dcce65470804ab43def646ab6
|
||||
|
||||
IMAGE="ubuntu:18.04"
|
||||
COMMAND="/bin/bash"
|
||||
SUFFIX=$(date +%s | shasum | base64 | fold -w 10 | head -1 | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
usage_exit() {
|
||||
echo "Usage: $0 [-c command] [-i image] PVC ..." 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
usage_exit
|
||||
fi
|
||||
|
||||
while getopts i:h OPT
|
||||
do
|
||||
case $OPT in
|
||||
i) IMAGE=$OPTARG
|
||||
;;
|
||||
c) COMMAND=$OPTARG
|
||||
;;
|
||||
h) usage_exit
|
||||
;;
|
||||
\?) usage_exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
VOL_MOUNTS=""
|
||||
VOLS=""
|
||||
COMMA=""
|
||||
|
||||
for i in $@
|
||||
do
|
||||
VOL_MOUNTS="${VOL_MOUNTS}${COMMA}{\"name\": \"${i}\",\"mountPath\": \"/pvcs/${i}\"}"
|
||||
VOLS="${VOLS}${COMMA}{\"name\": \"${i}\",\"persistentVolumeClaim\": {\"claimName\": \"${i}\"}}"
|
||||
COMMA=","
|
||||
done
|
||||
|
||||
$(which kubectl) --namespace "$NAMESPACE" run -it --rm --restart=Never --image="${IMAGE}" pvc-mounter-"${SUFFIX}" --overrides "
|
||||
{
|
||||
\"spec\": {
|
||||
\"hostNetwork\": true,
|
||||
\"containers\":[
|
||||
{
|
||||
\"args\": [\"${COMMAND}\"],
|
||||
\"stdin\": true,
|
||||
\"tty\": true,
|
||||
\"name\": \"pvc\",
|
||||
\"image\": \"${IMAGE}\",
|
||||
\"volumeMounts\": [
|
||||
${VOL_MOUNTS}
|
||||
]
|
||||
}
|
||||
],
|
||||
\"volumes\": [
|
||||
${VOLS}
|
||||
]
|
||||
}
|
||||
}
|
||||
" -- "${COMMAND}"
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
restart() {
|
||||
### Restart the pod given by a helm app name
|
||||
(
|
||||
if [ "$#" -eq 1 ]; then
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL get --namespace "$NAMESPACE" pod -l app="$1" -o name | sed s+pod/++)
|
||||
exe kubectl delete pod "$POD"
|
||||
else
|
||||
echo "Required arg: helm app name of pod to restart"
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
package() {
|
||||
### Create a packaged helm release and upload to the S3 repository
|
||||
(
|
||||
cd $BASEDIR
|
||||
set -e
|
||||
if [ "$#" -eq 1 ]; then
|
||||
if ! grep "version: $1" Chart.yaml; then
|
||||
echo "Chart.yaml version does not match intended package version ($1)."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "required argument: package version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGE="k8s-lbry-$1.tgz"
|
||||
|
||||
# Package release and rebuild repository
|
||||
exe helm dependency update
|
||||
exe helm package .
|
||||
exe helm repo index --merge index.yaml .
|
||||
## Replace URLs in index to point to github releases:
|
||||
sed -i 's|- k8s-lbry-\(.*\).tgz$|- https://github.com/lbryio/lbry-docker/releases/download/k8s-lbry-\1/k8s-lbry-\1.tgz|g' index.yaml
|
||||
echo "Created package: $PACKAGE"
|
||||
echo "Next steps: "
|
||||
echo " 1) Create new github release (https://github.com/lbryio/lbry-docker/releases) and upload $PACKAGE"
|
||||
echo " 2) Commit index.yaml and push to github"
|
||||
)
|
||||
}
|
||||
|
||||
chainquery-mysql-client() {
|
||||
### Access the mysql shell for chainquery
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL -n "$NAMESPACE" get pod -l app=chainquery-mysql -o name | sed s+pod/++)
|
||||
if [ ${#POD} -gt 0 ]; then
|
||||
kubectl exec -it "$POD" -- mysql -u chainquery -pchainquery
|
||||
else
|
||||
echo "chainquery-mysql pod not found"
|
||||
fi
|
||||
}
|
||||
|
||||
speech-mysql-client() {
|
||||
### Access the mysql shell for speech
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL -n "$NAMESPACE" get pod -l app=speech-mysql -o name | sed s+pod/++)
|
||||
if [ ${#POD} -gt 0 ]; then
|
||||
kubectl exec -it "$POD" -- mysql -u speech -pspeech
|
||||
else
|
||||
echo "speech-mysql pod not found"
|
||||
fi
|
||||
}
|
||||
|
||||
chainquery-override-snapshot() {
|
||||
### Delete the existing chainquery database and download a snapshot to restore
|
||||
read -p "Would you like to DESTROY the existing chainquery database,
|
||||
and restore from a fresh snapshot? (y/N) " destroy_chainquery
|
||||
case "$destroy_chainquery" in
|
||||
y|Y )
|
||||
kubectl delete deployments chainquery chainquery-mysql || true
|
||||
echo "Please wait.."
|
||||
IMAGE="ubuntu:18.04"
|
||||
SUFFIX=$(date +%s | shasum | base64 | fold -w 10 | head -1 | tr '[:upper:]' '[:lower:]')
|
||||
VOL_MOUNTS="{\"name\": \"chainquery-mysql\",\"mountPath\": \"/pvcs/chainquery-mysql\"}"
|
||||
VOLS="{\"name\": \"chainquery-mysql\",\"persistentVolumeClaim\": {\"claimName\": \"chainquery-mysql\"}}"
|
||||
COMMAND="rm -rf /pvcs/chainquery-mysql/* && apt-get update && apt-get install -y curl && curl -s ${CHAINQUERY_SNAPSHOT_URL} | tar xvz -C /pvcs/chainquery-mysql/"
|
||||
$(which kubectl) --namespace "$NAMESPACE" run -it --rm --restart=Never --image=${IMAGE} pvc-mounter-"${SUFFIX}" --overrides "
|
||||
{
|
||||
\"spec\": {
|
||||
\"hostNetwork\": true,
|
||||
\"containers\":[
|
||||
{
|
||||
\"args\": [\"bin/bash\", \"-c\", \"${COMMAND}\"],
|
||||
\"stdin\": true,
|
||||
\"tty\": true,
|
||||
\"name\": \"pvc\",
|
||||
\"image\": \"${IMAGE}\",
|
||||
\"volumeMounts\": [
|
||||
${VOL_MOUNTS}
|
||||
]
|
||||
}
|
||||
],
|
||||
\"volumes\": [
|
||||
${VOLS}
|
||||
]
|
||||
}
|
||||
}
|
||||
"
|
||||
echo "Extraction complete"
|
||||
;;
|
||||
* ) echo "Aborted."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
lbrycrd-override-snapshot() {
|
||||
### Delete the existing lbrycrd data and download a snapshot to restore
|
||||
read -p "Would you like to DESTROY the existing lbrycrd data,
|
||||
and restore from a fresh snapshot? (y/N) " destroy_lbrycrd
|
||||
case "$destroy_lbrycrd" in
|
||||
y|Y )
|
||||
kubectl delete deployments lbrycrd || true
|
||||
echo "Please wait.."
|
||||
IMAGE="ubuntu:18.04"
|
||||
SUFFIX=$(date +%s | shasum | base64 | fold -w 10 | head -1 | tr '[:upper:]' '[:lower:]')
|
||||
VOL_MOUNTS="{\"name\": \"lbrycrd\",\"mountPath\": \"/pvcs/lbrycrd\"}"
|
||||
VOLS="{\"name\": \"lbrycrd\",\"persistentVolumeClaim\": {\"claimName\": \"lbrycrd\"}}"
|
||||
COMMAND="rm -rf /pvcs/lbrycrd/* && apt-get update && apt-get install -y curl && curl -s ${LBRYCRD_SNAPSHOT_URL} | tar xvz -C /pvcs/lbrycrd/"
|
||||
$(which kubectl) --namespace "$NAMESPACE" run -it --rm --restart=Never --image=${IMAGE} pvc-mounter-"${SUFFIX}" --overrides "
|
||||
{
|
||||
\"spec\": {
|
||||
\"hostNetwork\": true,
|
||||
\"containers\":[
|
||||
{
|
||||
\"args\": [\"bin/bash\", \"-c\", \"${COMMAND}\"],
|
||||
\"stdin\": true,
|
||||
\"tty\": true,
|
||||
\"name\": \"pvc\",
|
||||
\"image\": \"${IMAGE}\",
|
||||
\"volumeMounts\": [
|
||||
${VOL_MOUNTS}
|
||||
]
|
||||
}
|
||||
],
|
||||
\"volumes\": [
|
||||
${VOLS}
|
||||
]
|
||||
}
|
||||
}
|
||||
"
|
||||
echo "Extraction complete"
|
||||
;;
|
||||
* ) echo "Aborted."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
logs() {
|
||||
### Watch the logs of a pod by helm app name
|
||||
(
|
||||
set -e
|
||||
if [ "$#" -eq 1 ]; then
|
||||
kubectl logs -l app="$1" -f
|
||||
elif [ "$#" -eq 2 ]; then
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL get --namespace "$NAMESPACE" pod -l app="$1" -o name | sed s+pod/++)
|
||||
kubectl logs "$POD" "$2" -f
|
||||
else
|
||||
echo "Required arg: app_name"
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
lbrynet-copy-wallet() {
|
||||
### Copy the lbrynet wallet to a local path for backup
|
||||
(
|
||||
set -e
|
||||
if [ "$#" -eq 1 ]; then
|
||||
WALLET=/home/lbrynet/.local/share/lbry/lbryum/wallets/default_wallet
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL -n "$NAMESPACE" get pod -l app=lbrynet -o name | sed s+pod/++)
|
||||
kubectl cp "$POD":$WALLET "$1"
|
||||
chmod 600 "$1"
|
||||
echo "lbrynet wallet copied to $1"
|
||||
else
|
||||
echo "Required arg: path of backup location for wallet"
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
speech-lbrynet-copy-wallet() {
|
||||
### Copy the speech-lbrynet wallet to a local path for backup
|
||||
(
|
||||
set -e
|
||||
if [ "$#" -eq 1 ]; then
|
||||
WALLET=/home/lbrynet/.local/share/lbry/lbryum/wallets/default_wallet
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL -n "$NAMESPACE" get pod -l app=speech -o name | sed s+pod/++)
|
||||
kubectl cp "$POD":$WALLET "$1" -c speech-lbrynet
|
||||
chmod 600 "$1"
|
||||
echo "lbrynet wallet copied to $1"
|
||||
else
|
||||
echo "Required arg: path of backup location for wallet"
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
lbrycrd-cli() {
|
||||
## Run lbrycrd-cli client from inside the running pod outputting to your local terminal
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL -n "$NAMESPACE" get pod -l app=lbrycrd -o name | sed s+pod/++)
|
||||
if [ ${#POD} -gt 0 ]; then
|
||||
kubectl exec "$POD" -- lbrycrd-cli -rpcuser="$LBRYCRD_RPC_USER" -rpcpassword="$LBRYCRD_RPC_PASSWORD" "$*"
|
||||
else
|
||||
echo "lbrycrd pod not found"
|
||||
fi
|
||||
}
|
||||
|
||||
lbrynet() {
|
||||
## Run lbrynet client from inside the running pod outputting to your local terminal
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL -n "$NAMESPACE" get pod -l app=lbrynet -o name | sed s+pod/++)
|
||||
if [ ${#POD} -gt 0 ]; then
|
||||
kubectl exec "$POD" -- lbrynet "$*"
|
||||
else
|
||||
echo "lbrynet pod not found"
|
||||
fi
|
||||
}
|
||||
|
||||
speech-lbrynet() {
|
||||
## Run lbrynet client from inside the running pod outputting to your local terminal
|
||||
KUBECTL=$(which kubectl)
|
||||
POD=$($KUBECTL -n "$NAMESPACE" get pod -l app=speech -o name | sed s+pod/++)
|
||||
if [ ${#POD} -gt 0 ]; then
|
||||
kubectl exec "$POD" -c speech-lbrynet -- lbrynet "$*"
|
||||
else
|
||||
echo "lbrynet pod not found"
|
||||
fi
|
||||
}
|
||||
|
||||
SUBCOMMANDS_NO_ARGS=(setup install install-nginx-ingress install-cert-manager upgrade
|
||||
upgrade-nginx-ingress upgrade-cert-manager chainquery-mysql-client
|
||||
speech-mysql-client chainquery-override-snapshot lbrycrd-override-snapshot
|
||||
setup-alias)
|
||||
|
||||
SUBCOMMANDS_PASS_ARGS=(helm kubectl shell shell-pvc restart package logs lbrynet-copy-wallet lbrynet speech-lbrynet-copy-wallet speech-lbrynet lbrycrd-cli completion)
|
||||
|
||||
completion() {
|
||||
if [ "$#" -eq 1 ] && [ "$1" == "bash" ]; then
|
||||
cat <<EOF
|
||||
__delegate_k8s_lbry() {
|
||||
alias kubectl="kubectl --namespace=$NAMESPACE"
|
||||
local cur subs
|
||||
cur="\${COMP_WORDS[COMP_CWORD]}" # partial word, if any
|
||||
subs="${SUBCOMMANDS_NO_ARGS[*]} ${SUBCOMMANDS_PASS_ARGS[*]}"
|
||||
if [[ \${COMP_CWORD} -gt 1 ]]; then
|
||||
# complete subcommands
|
||||
_command \${@: -1}
|
||||
else
|
||||
# complete with the list of subcommands
|
||||
COMPREPLY=( \$(compgen -W "\${subs}" -- \${cur}) )
|
||||
fi
|
||||
}
|
||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||
complete -o default -F __delegate_k8s_lbry $RUN_ALIAS
|
||||
else
|
||||
complete -o default -o nospace -F __delegate_k8s_lbry $RUN_ALIAS
|
||||
fi
|
||||
EOF
|
||||
else
|
||||
echo "## I only know how to do completion for the bash shell."
|
||||
echo "## Try '$0 completion bash' instead."
|
||||
fi
|
||||
}
|
||||
|
||||
setup-alias() {
|
||||
if [[ $SHELL != */bash ]]; then
|
||||
echo "It looks like you are currently running $SHELL";
|
||||
echo "This tool only supports bash."
|
||||
echo ""
|
||||
echo "You will need to setup an alias in your own shell called \"$RUN_ALIAS\" for $BASEDIR/run.sh"
|
||||
echo ""
|
||||
read -p "Would you like to setup the alias for bash anyway? (Y/n)" choice
|
||||
case "$choice" in
|
||||
y|Y )
|
||||
echo "Note: You will need to run bash as a subshell before running $RUN_ALIAS"
|
||||
;;
|
||||
* ) echo "Aborting" && exit 1
|
||||
;;
|
||||
esac
|
||||
echo ""
|
||||
fi
|
||||
$(which kubectl) completion bash > "$BASEDIR"/completion.bash.inc
|
||||
$(which helm) completion bash >> "$BASEDIR"/completion.bash.inc
|
||||
completion bash >> "$BASEDIR"/completion.bash.inc
|
||||
|
||||
if [[ -z $K8S_LBRY_HOME ]] && ! grep "K8S_LBRY_HOME" "$HOME"/.bashrc > /dev/null; then
|
||||
echo "K8S_LBRY_HOME not set."
|
||||
read -p "Would you this script to edit $HOME/.bashrc to add tab completion support? (y/N) " choice
|
||||
case "$choice" in
|
||||
y|Y )
|
||||
cat <<EOF >> "$HOME"/.bashrc
|
||||
|
||||
## Enable bash completion
|
||||
if [ -f /etc/bash_completion ]; then
|
||||
source /etc/bash_completion
|
||||
fi
|
||||
|
||||
## k8s-lbry alias and tab completion
|
||||
K8S_LBRY_HOME=$BASEDIR
|
||||
alias $RUN_ALIAS=\$K8S_LBRY_HOME/run.sh
|
||||
if [ -f \$K8S_LBRY_HOME/completion.bash.inc ]; then
|
||||
source \$K8S_LBRY_HOME/completion.bash.inc
|
||||
fi
|
||||
EOF
|
||||
echo "Created new alias: $RUN_ALIAS"
|
||||
echo "To use the new alias, run \"source ~/.bashrc\" or just close your terminal session and restart it."
|
||||
;;
|
||||
* ) echo "Aborting" && exit 1;;
|
||||
esac
|
||||
else
|
||||
echo "K8S_LBRY_HOME environment already setup. Nothing left to do."
|
||||
fi
|
||||
}
|
||||
|
||||
if printf '%s\n' ${SUBCOMMANDS_NO_ARGS[@]} | grep -q -P "^$1$"; then
|
||||
## Subcommands that take no arguments:
|
||||
(
|
||||
set -e
|
||||
if [ "$#" -eq 1 ]; then
|
||||
$*
|
||||
else
|
||||
echo "$1 does not take any additional arguments"
|
||||
fi
|
||||
)
|
||||
elif printf '%s\n' ${SUBCOMMANDS_PASS_ARGS[@]} | grep -q -P "^$1$"; then
|
||||
## Subcommands that pass all arguments:
|
||||
(
|
||||
set -e
|
||||
$*
|
||||
)
|
||||
else
|
||||
if [[ $# -gt 0 ]]; then
|
||||
echo "## Invalid command: $1"
|
||||
else
|
||||
echo "## Must specify a command:"
|
||||
fi
|
||||
echo ""
|
||||
echo "## $0 setup"
|
||||
echo "## - Setup dependencies"
|
||||
echo ""
|
||||
echo "## $0 install-nginx-ingress"
|
||||
echo "## - Deploy nginx-ingress chart"
|
||||
echo ""
|
||||
echo "## $0 install-cert-manager"
|
||||
echo "## - Deploy cert-manager chart"
|
||||
echo ""
|
||||
echo "## $0 install"
|
||||
echo "## - Deploy main k8s-lbry chart"
|
||||
echo ""
|
||||
echo "## $0 upgrade"
|
||||
echo "## - Upgrade an existing release"
|
||||
echo ""
|
||||
echo "## $0 shell <app>"
|
||||
echo "## - execute shell into running helm application pod"
|
||||
echo ""
|
||||
echo "## $0 shell-pvc [-c command] [-i image] PVC"
|
||||
echo "## - run a utility shell with the named PVC mounted in /pvcs"
|
||||
echo ""
|
||||
echo "## $0 helm <cmd> [...] "
|
||||
echo "## - run any helm command (through helm-tiller wrapper)"
|
||||
echo ""
|
||||
echo "## $0 kubectl <cmd> [...]"
|
||||
echo "## - run any kubectl command (defaulting to configured namespace)"
|
||||
echo ""
|
||||
echo "## $0 chainquery-mysql-client"
|
||||
echo "## - run mysql shell for chainquery database"
|
||||
echo ""
|
||||
echo "## $0 speech-mysql-client"
|
||||
echo "## - run mysql shell for speech database"
|
||||
echo ""
|
||||
echo "## $0 chainquery-override-snapshot"
|
||||
echo "## - Restore chainquery database from snapshot"
|
||||
echo ""
|
||||
echo "## $0 lbrycrd-override-snapshot"
|
||||
echo "## - Restore lbrycrd database from snapshot"
|
||||
echo ""
|
||||
echo "## $0 logs <app> [container]"
|
||||
echo "## - Stream the logs for the pod running the helm app name provided"
|
||||
echo "## (specify which container if the pod has more than one.)"
|
||||
echo ""
|
||||
echo "## $0 lbrynet-copy-wallet <local-path>"
|
||||
echo "## - Backup the lbrynet wallet file to a local path"
|
||||
echo ""
|
||||
echo "## $0 lbrynet <args ... >"
|
||||
echo "## - Run lbrynet client inside running lbrynet pod"
|
||||
echo ""
|
||||
echo "## $0 speech-lbrynet-copy-wallet <local-path>"
|
||||
echo "## - Backup the speech-lbrynet wallet file to a local path"
|
||||
echo ""
|
||||
echo "## $0 speech-lbrynet <args ... >"
|
||||
echo "## - Run speech-lbrynet client inside running speech pod"
|
||||
echo ""
|
||||
echo "## $0 setup-alias"
|
||||
echo "## - Setup bash alias and tab completion for run.sh"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
|
@ -1,281 +0,0 @@
|
|||
cert-manager-issuer:
|
||||
# Enter your email address to receive important notices from Let's Encrypt:
|
||||
email: "fred@example.com"
|
||||
|
||||
lbrycrd:
|
||||
fullnameOverride: lbrycrd
|
||||
enabled: true
|
||||
image:
|
||||
repository: lbry/lbrycrd
|
||||
tag: linux-x86_64-production
|
||||
pullPolicy: Always
|
||||
service:
|
||||
port: 9246
|
||||
rpcPort: 9245
|
||||
persistence:
|
||||
enabled: true
|
||||
accessMode: ReadWriteOnce
|
||||
size: 50Gi
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
# If on AWS:
|
||||
# storageClass: "ebs-gp2"
|
||||
configurationFile:
|
||||
lbrycrd.conf: |-
|
||||
datadir=/data
|
||||
rpcuser=lbry
|
||||
rpcpassword=lbry
|
||||
regtest=0
|
||||
txindex=1
|
||||
rpcallowip=10.0.0.0/8
|
||||
server=1
|
||||
listen=1
|
||||
daemon=0
|
||||
externalip=
|
||||
|
||||
chainquery-mysql:
|
||||
fullnameOverride: chainquery-mysql
|
||||
enabled: false
|
||||
mysqlUser: chainquery
|
||||
mysqlPassword: chainquery
|
||||
mysqlDatabase: chainquery
|
||||
persistence:
|
||||
enabled: true
|
||||
accessMode: ReadWriteOnce
|
||||
size: 100Gi
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
# If on AWS:
|
||||
# storageClass: "ebs-gp2"
|
||||
|
||||
chainquery:
|
||||
fullnameOverride: chainquery
|
||||
enabled: false
|
||||
image:
|
||||
repository: lbry/chainquery
|
||||
tag: linux-x86_64-production
|
||||
pullPolicy: IfNotPresent
|
||||
service:
|
||||
port: 6300
|
||||
configurationFile:
|
||||
chainqueryconfig.toml: |-
|
||||
lbrycrdurl="rpc://lbry:lbry@lbrycrd:9245"
|
||||
mysqldsn="chainquery:chainquery@tcp(chainquery-mysql:3306)/chainquery"
|
||||
apimysqldsn="chainquery:chainquery@tcp(chainquery-mysql:3306)/chainquery"
|
||||
|
||||
lbrynet:
|
||||
fullnameOverride: lbrynet
|
||||
enabled: false
|
||||
image:
|
||||
repository: lbry/lbrynet
|
||||
tag: linux-x86_64-production
|
||||
pullPolicy: Always
|
||||
service:
|
||||
rpcPort: 5279
|
||||
persistence:
|
||||
enabled: true
|
||||
accessMode: ReadWriteOnce
|
||||
size: 10Gi
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
# If on AWS:
|
||||
# storageClass: "ebs-gp2"
|
||||
daemon_settings:
|
||||
api: 0.0.0.0:5279
|
||||
use_upnp: false
|
||||
auto_re_reflect_interval: 0
|
||||
max_key_fee: {amount: 0, currency: LBC}
|
||||
run_reflector_server: false
|
||||
save_files: false
|
||||
|
||||
speech-mysql:
|
||||
fullnameOverride: speech-mysql
|
||||
labels:
|
||||
app: speech-mysql
|
||||
enabled: false
|
||||
mysqlUser: speech
|
||||
mysqlPassword: speech
|
||||
mysqlDatabase: speech
|
||||
persistence:
|
||||
enabled: true
|
||||
accessMode: ReadWriteOnce
|
||||
size: 100Gi
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
# If on AWS:
|
||||
# storageClass: "ebs-gp2"
|
||||
|
||||
|
||||
speech:
|
||||
fullnameOverride: speech
|
||||
enabled: false
|
||||
service:
|
||||
name: speech
|
||||
hostname: "speech.example.com"
|
||||
port: 3000
|
||||
enableHttps: true
|
||||
certificateIssuer: letsencrypt-prod
|
||||
image:
|
||||
repository: enigmacurry/dump
|
||||
tag: spee.ch
|
||||
pullPolicy: Always
|
||||
persistence:
|
||||
enabled: true
|
||||
accessMode: ReadWriteOnce
|
||||
size: 20Gi
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
# If on AWS:
|
||||
# storageClass: "ebs-gp2"
|
||||
auth:
|
||||
masterPassword: speech
|
||||
mysql:
|
||||
host: speech-mysql
|
||||
database: speech
|
||||
username: speech
|
||||
password: speech
|
||||
chainquery:
|
||||
host: chainquery-mysql
|
||||
port: 3306
|
||||
timeout: 30
|
||||
database: chainquery
|
||||
username: chainquery
|
||||
password: chainquery
|
||||
lbrynet:
|
||||
enabled: true
|
||||
apiHost: 127.0.0.1
|
||||
apiPort: 5279
|
||||
getTimeout: 30
|
||||
image:
|
||||
repository: enigmacurry/dump
|
||||
tag: lbrynet-v0.33.0
|
||||
pullPolicy: Always
|
||||
service:
|
||||
rpcPort: 5279
|
||||
daemon_settings:
|
||||
api: 0.0.0.0:5279
|
||||
use_upnp: false
|
||||
auto_re_reflect_interval: 0
|
||||
max_key_fee: {amount: 0, currency: LBC}
|
||||
run_reflector_server: false
|
||||
download_dir: /data/Downloads
|
||||
persistence:
|
||||
enabled: true
|
||||
accessMode: ReadWriteOnce
|
||||
size: 10Gi
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
# If on AWS:
|
||||
# storageClass: "ebs-gp2"
|
||||
logger:
|
||||
logLevel: verbose
|
||||
slack:
|
||||
slackWebHook: false
|
||||
slackErrorChannel: false
|
||||
slackInfoChannel: false
|
||||
site:
|
||||
analytics:
|
||||
googleId:
|
||||
assetDefaults:
|
||||
description: 'Default Content Description'
|
||||
thumbnail: https://spee.ch/0e5d4e8f4086e13f5b9ca3f9648f518e5f524402/speechflag.png
|
||||
title: 'Default Content Title'
|
||||
details:
|
||||
blockListEndpoint: https://api.lbry.com/file/list_blocked
|
||||
description: 'A decentralized hosting platform built on LBRY'
|
||||
host: https://www.example.com
|
||||
ipAddress: ""
|
||||
port: 3000
|
||||
title: 'My Site'
|
||||
twitter: false
|
||||
publishing:
|
||||
primaryClaimAddress:
|
||||
additionalClaimAddresses: []
|
||||
approvedChannels: []
|
||||
channelClaimBidAmount: "0.1"
|
||||
closedRegistration: false
|
||||
disabled: false
|
||||
disabledMessage: 'Default publishing disabled message'
|
||||
fileClaimBidAmount: "0.01"
|
||||
fileSizeLimits:
|
||||
application: 50000000
|
||||
audio: 50000000
|
||||
customByContentType:
|
||||
application/octet-stream: 50000000
|
||||
image: 50000000
|
||||
model: 50000000
|
||||
text: 50000000
|
||||
video: 50000000
|
||||
publishOnlyApproved: false
|
||||
publishingChannelWhitelist: []
|
||||
serveOnlyApproved: false
|
||||
thumbnailChannel:
|
||||
thumbnailChannelId:
|
||||
uploadDirectory: /data/Uploads
|
||||
serving:
|
||||
customFileExtensions:
|
||||
application/x-mif: mif
|
||||
application/x-pn-realaudio: ram
|
||||
application/x-python-code: pyc
|
||||
application/x-sgml: sgm
|
||||
application/x-troff: roff
|
||||
application/x-troff-man: man
|
||||
application/x-troff-me: me
|
||||
application/x-troff-ms: ms
|
||||
image/pict: pct
|
||||
model/stl: stl
|
||||
text/x-go: go
|
||||
text/x-python: py
|
||||
text/xul: xul
|
||||
dynamicFileSizing:
|
||||
enabled: true
|
||||
maxDimension: 2000
|
||||
markdownSettings:
|
||||
allowedTypesDescriptions: []
|
||||
allowedTypesExample:
|
||||
- 'see react-markdown docs'
|
||||
- root
|
||||
- text
|
||||
- break
|
||||
- paragraph
|
||||
- emphasis
|
||||
- strong
|
||||
- thematicBreak
|
||||
- blockquote
|
||||
- delete
|
||||
- link
|
||||
- image
|
||||
- linkReference
|
||||
- imageReference
|
||||
- table
|
||||
- tableHead
|
||||
- tableBody
|
||||
- tableRow
|
||||
- tableCell
|
||||
- list
|
||||
- listItem
|
||||
- heading
|
||||
- inlineCode
|
||||
- code
|
||||
- html
|
||||
- parsedHtml
|
||||
allowedTypesMain: []
|
||||
escapeHtmlDescriptions: true
|
||||
escapeHtmlMain: true
|
||||
skipHtmlDescriptions: true
|
||||
skipHtmlMain: true
|
||||
startup:
|
||||
performChecks: true
|
||||
performUpdates: true
|
||||
|
||||
echo-http-server:
|
||||
enabled: false
|
||||
# Enter your domain name for the echo test service:
|
||||
hostname: "echo.example.com"
|
||||
service: echo-http-server
|
||||
enableHttps: true
|
||||
certificateIssuer: letsencrypt-prod
|
||||
|
||||
echo-socket-server:
|
||||
enabled: false
|
||||
service: echo-socket-server
|
|
@ -1,321 +0,0 @@
|
|||
# LBRY cloud-init with systemd
|
||||
|
||||
Contributing Author: [EnigmaCurry](https://www.enigmacurry.com)
|
||||
|
||||
Last Update: April 18 2019
|
||||
|
||||
This tutorial meant to be easy instructions for running a lbrycrd and chainquery
|
||||
service on DigitalOcean. It's pretty much just copy-and-paste.
|
||||
|
||||
This tutorial 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 uses cloud-init and systemd to control docker.
|
||||
|
||||
## It's easy to run your full lbrycrd node
|
||||
|
||||
[![Video of creating lbrycrd droplet on DigitalOcean](https://spee.ch/@EnigmaCurry:d/lbrycrd-video-thumb.jpg)](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 runs docker on vanilla Ubuntu,
|
||||
## it uses systemd in place 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/lbrycrd:linux-x86-64-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/chainquery:linux-x86-64-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/lbrycrd:linux-x86-64-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 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 log in.
|
||||
* 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,
|
||||
and more.) 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 gets 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 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 log in to the
|
||||
chainquery database.
|
||||
|
||||
#### Enable and start the chainquery service
|
||||
|
||||
The chainquery config file located on the host at: `/etc/lbry/chainqueryconfig.toml`
|
||||
|
||||
```
|
||||
systemctl enable --now chainquery
|
||||
```
|
||||
|
||||
In systemd, when you enable a service, it means always to start the service at
|
||||
system boot. (`--now` 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.
|
|
@ -1,16 +0,0 @@
|
|||
## Contains environment variables for chainquery containers
|
||||
|
||||
#########################
|
||||
## Chainquery Settings ##
|
||||
#########################
|
||||
RPC_ALLOW_IP=10.6.1.3
|
||||
DEBUGMODE=false
|
||||
|
||||
#################
|
||||
## Mysql Creds ##
|
||||
#################
|
||||
MYSQL_SERVER=10.6.1.10
|
||||
MYSQL_USER=lbry
|
||||
MYSQL_PASSWORD=lbry
|
||||
MYSQL_DATABASE=chainquery
|
||||
MYSQL_ROOT_PASSWORD=lbry
|
|
@ -1,2 +0,0 @@
|
|||
## Contains environment variables for lbrynet containers
|
||||
RUN_MODE=default
|
1
lbrycrd/.dockerignore
Normal file
1
lbrycrd/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
data/
|
|
@ -1,13 +1,14 @@
|
|||
## Contains environment variables for lbrycrd containers
|
||||
COMPOSE_PROJECT_NAME=lbrycrd
|
||||
|
||||
#############
|
||||
## Lbrycrd ##
|
||||
#############
|
||||
## TODO: The credentials are a formality but we should randomize these with magic.
|
||||
RPC_USER=lbryrpc
|
||||
RPC_PASSWORD=changeme
|
||||
RPC_USER=${RPC_USER=lbryrpc}
|
||||
RPC_PASSWORD=${RPC_PASSWORD:-changeme}
|
||||
UID=$UID
|
||||
GID=$UID
|
||||
|
||||
## This should be the internal container IP from which you'll be calling the RPC for Lbrycrdd from.
|
||||
## TODO: make this more dynamic before we move to scalability
|
||||
RPC_ALLOW_IP=10.6.1.3
|
||||
RPC_ALLOW_IP=${RPC_ALLOW_IP:-10.5.1.3}
|
1
lbrycrd/.gitignore
vendored
1
lbrycrd/.gitignore
vendored
|
@ -1,2 +1 @@
|
|||
data/.lbrycrd
|
||||
regtest/data
|
||||
|
|
45
lbrycrd/Dockerfile
Normal file
45
lbrycrd/Dockerfile
Normal file
|
@ -0,0 +1,45 @@
|
|||
## 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.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
|
||||
VOLUME ["/data"]
|
||||
WORKDIR /data
|
||||
|
||||
## TODO: Implement healthcheck.
|
||||
# HEALTHCHECK ["healthcheck"]
|
||||
|
||||
## 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"]
|
|
@ -1 +0,0 @@
|
|||
# moved to https://github.com/lbryio/lbrycrd/tree/master/packaging/docker-for-binary
|
1
lbrycrd/compile/.dockerignore
Normal file
1
lbrycrd/compile/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
data/
|
67
lbrycrd/compile/Dockerfile
Normal file
67
lbrycrd/compile/Dockerfile
Normal file
|
@ -0,0 +1,67 @@
|
|||
###########################
|
||||
## 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"]
|
0
lbrycrd/compile/docker-compose.yml
Normal file
0
lbrycrd/compile/docker-compose.yml
Normal file
13
lbrycrd/compile/docker-entrypoint.sh
Normal file
13
lbrycrd/compile/docker-entrypoint.sh
Normal file
|
@ -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
|
56
lbrycrd/compile/start.sh
Normal file
56
lbrycrd/compile/start.sh
Normal file
|
@ -0,0 +1,56 @@
|
|||
#!/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.5.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.5.1.3}
|
26
lbrycrd/docker-compose.yml
Normal file
26
lbrycrd/docker-compose.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
version: '3.4'
|
||||
|
||||
networks:
|
||||
lbrynet:
|
||||
external: true
|
||||
|
||||
services:
|
||||
#############
|
||||
## Lbrycrd ##
|
||||
#############
|
||||
lbrycrd:
|
||||
build: .
|
||||
restart: always
|
||||
networks:
|
||||
lbrynet:
|
||||
ipv4_address: 10.5.1.2
|
||||
labels:
|
||||
- "traefik.expose=false"
|
||||
environment:
|
||||
RUN_MODE: chainquery
|
||||
expose:
|
||||
- 9245
|
||||
- 9246
|
||||
## host volumes for persistent data such as wallet private keys.
|
||||
volumes:
|
||||
- "./data:/data"
|
3
lbrycrd/stuff/debugpaste-it.sh
Executable file
3
lbrycrd/stuff/debugpaste-it.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "placeholder for now, come back soon for more debugging magic"
|
13
lbrycrd/stuff/docker-entrypoint.sh
Executable file
13
lbrycrd/stuff/docker-entrypoint.sh
Executable file
|
@ -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
|
12
lbrycrd/stuff/env-example
Normal file
12
lbrycrd/stuff/env-example
Normal file
|
@ -0,0 +1,12 @@
|
|||
COMPOSE_PROJECT_NAME=lbrycrd
|
||||
|
||||
#############
|
||||
## Lbrycrd ##
|
||||
#############
|
||||
## TODO: The credentials are a formality but we should randomize these with magic.
|
||||
RPC_USER=${RPC_USER=lbryrpc}
|
||||
RPC_PASSWORD=${RPC_PASSWORD:-changeme}
|
||||
|
||||
## This should be the internal container IP from which you'll be calling the RPC for Lbrycrdd from.
|
||||
## TODO: make this more dynamic before we move to scalability
|
||||
RPC_ALLOW_IP=${RPC_ALLOW_IP:-10.5.1.3}
|
4
lbrycrd/stuff/healthcheck.sh
Executable file
4
lbrycrd/stuff/healthcheck.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
## TODO: Implement a healthcheck for lbrycrd.
|
||||
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://$RPC_USER:$RPC_PASSWORD@127.0.0.1:9246
|
||||
## OR
|
||||
lbrycrd-cli getinfo
|
47
lbrycrd/stuff/start.sh
Executable file
47
lbrycrd/stuff/start.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/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=lbryrpc\nrpcpassword=${RPC_PASSWORD:-changeme}" > /data/.lbrycrd/lbrycrd.conf
|
||||
echo "rpcallowip=${RPC_ALLOW_IP:-10.5.1.3}" >> /data/.lbrycrd/lbrycrd.conf
|
||||
echo "rpcuser=${RPC_USER:-lbryrpc}" >> /data/.lbrycrd/lbrycrd.conf
|
||||
|
||||
## Control this invocation through envvar.
|
||||
case ${RUN_MODE:-default} in
|
||||
default )
|
||||
su -c "lbrycrdd -server -conf=/data/.lbrycrd/ -printtoconsole" lbrycrd
|
||||
;;
|
||||
reindex )
|
||||
su -c "lbrycrdd -server -txindex -reindex -conf=/data/.lbrycrd/ -printtoconsole" lbrycrd
|
||||
;;
|
||||
chainquery )
|
||||
su -c "lbrycrdd -server -txindex -conf=/data/.lbrycrd/ -printtoconsole" lbrycrd
|
||||
;;
|
||||
esac
|
||||
|
||||
## TODO: Look into what we can do with these launch params
|
||||
## 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.5.1.3}
|
3
lbrynet/.gitignore
vendored
3
lbrynet/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
data/
|
||||
data/
|
||||
config/
|
||||
|
|
57
lbrynet/Dockerfile
Normal file
57
lbrynet/Dockerfile
Normal file
|
@ -0,0 +1,57 @@
|
|||
## 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 mkdir -pv /data && chown 1000:1000 /data
|
||||
RUN adduser lbrynet --gecos GECOS --shell /bin/bash/ --disabled-password --home /data/
|
||||
|
||||
## Add lbrynet
|
||||
ADD https://lbry.io/get/lbrynet.linux.zip /data/lbrynet.linux.zip
|
||||
RUN unzip /data/lbrynet.linux.zip -d /data/ && \
|
||||
rm /data/lbrynet.linux.zip && \
|
||||
chown -Rv traefik:lbrynet /data
|
||||
|
||||
RUN wget -quiet -O /usr/bin/debugpaste https://github.com/nixc-us/debugpaste-it/raw/master/bin/debugpaste_64 && \
|
||||
chmod +x /usr/bin/debugpaste
|
||||
|
||||
## Install into PATH
|
||||
RUN mv /data/lbrynet-* /bin/
|
||||
|
||||
COPY debugpaste-it.sh /usr/local/bin/debugpaste-it
|
||||
|
||||
## Daemon port [Intended for internal use]
|
||||
EXPOSE 4444
|
||||
## Wallet port [Intended for internal use]
|
||||
EXPOSE 50001
|
||||
|
||||
## Undocumented ports that exist in conf.py
|
||||
## API port
|
||||
# EXPOSE 5279
|
||||
# ## Reflector port
|
||||
# EXPOSE 5566
|
||||
|
||||
## VOLUMES
|
||||
## Right now the volumes are just added in a commented out state but if the end
|
||||
## user would prefer to add volumes to their own usage cases all they will need
|
||||
## to do is uncomment what they require and then build the container using docker-compose.yml
|
||||
|
||||
## Volumize the wallets in a separate location for backup purposes may be unnecessary.
|
||||
# VOLUME /data/.local/share/lbry/lbryum/wallets
|
||||
# VOLUME /data/.local/
|
||||
## If the config ends up needing it's own volume it should be located here.
|
||||
# VOLUME /etc/lbry/conf.py
|
||||
## 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 /data/Downloads/
|
||||
|
||||
## Never run container processes as root
|
||||
USER lbrynet
|
||||
## Run on container launch
|
||||
CMD ["lbrynet-daemon"]
|
||||
|
||||
## Setting this entrypoint should mean that you can `docker exec lbrynet commands`
|
||||
## and you should be able to control the daemon's CLI this way. There is an
|
||||
## alternative method we could use here where we have an entrypoint shell script which could be a bit smarter.
|
||||
## An docker-entrypoint should eventually be created and installed into the container $PATH with a config install script that checks for the existance of a config.py and if it exists don't install docker envvars established elsewhere.
|
||||
## If the container doesn't detect a conf.py file however have it install a fresh copy into /etc/lbry/conf.py and run that from a fresh copy from somewhere sensible.
|
||||
# ENTRYPOINT ["lbrynet-cli"]
|
|
@ -1,66 +0,0 @@
|
|||
## Compiler for lbrynet container for any architecture supported by Ubuntu 18.04
|
||||
## Specify the BASE_IMAGE build argument to choose which Ubuntu base image to build from.
|
||||
## Docs for ARG in FROM: https://github.com/docker/cli/blob/master/docs/reference/builder.md#understand-how-arg-and-from-interact
|
||||
## Architecture | Build command
|
||||
## x86_64 | docker build -t lbrynet -f Dockerfile-compiler .
|
||||
## armhf | docker build -t lbrynet-armhf -f Dockerfile-compiler --build-arg BASE_IMAGE=multiarch/ubuntu-core:armhf-bionic .
|
||||
## arm64 | docker build -t lbrynet-arm64 -f Dockerfile-compiler --build-arg BASE_IMAGE=multiarch/ubuntu-core:arm64-bionic .
|
||||
|
||||
ARG BASE_IMAGE=ubuntu:18.04
|
||||
FROM ${BASE_IMAGE} 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
|
||||
|
||||
ARG REPO=https://github.com/lbryio/lbry.git
|
||||
ARG VERSION=master
|
||||
ARG RUN_FROM_SOURCE=false
|
||||
RUN python3.7 -m pip install -U pyinstaller && \
|
||||
git clone ${REPO} /lbry-sdk && \
|
||||
git -C /lbry-sdk checkout ${VERSION}
|
||||
RUN python3.7 -m pip install -e /lbry-sdk/torba
|
||||
WORKDIR /lbry-sdk/lbry
|
||||
COPY stuff/start.sh /usr/local/bin/start
|
||||
COPY stuff/checkmount.sh /usr/local/bin/checkmount
|
||||
RUN export TRAVIS_COMMIT=`git rev-parse HEAD` && \
|
||||
python3.7 scripts/set_build.py && \
|
||||
python3.7 -m pip install -e . && \
|
||||
pyinstaller -F -n lbrynet lbry/extras/cli.py && \
|
||||
chmod +x /lbry-sdk/lbry/dist/lbrynet && \
|
||||
chmod a+x /usr/local/bin/* && \
|
||||
/lbry-sdk/lbry/dist/lbrynet --version
|
||||
|
||||
FROM ${BASE_IMAGE} as app
|
||||
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
|
||||
COPY --from=compile /usr/local/bin/start /usr/local/bin/checkmount /lbry-sdk/lbry/dist/lbrynet /usr/local/bin/
|
||||
EXPOSE 5279
|
||||
USER lbrynet
|
||||
ENTRYPOINT ["/usr/local/bin/checkmount"]
|
||||
CMD ["start"]
|
|
@ -1,27 +0,0 @@
|
|||
## This base image is for running the latest lbrynet-daemon release.
|
||||
FROM ubuntu:18.04 as prep
|
||||
LABEL MAINTAINER="leopere [at] nixc [dot] us"
|
||||
RUN apt-get update && apt-get -y install unzip curl
|
||||
|
||||
## Add lbrynet
|
||||
ARG VERSION=latest
|
||||
RUN URL=$(curl -Ls https://api.github.com/repos/lbryio/lbry-sdk/releases/$(if [ "${VERSION}" = 'latest' ]; then echo "latest"; else echo "tags/${VERSION}"; fi) | grep browser_download_url | grep lbrynet-linux.zip | cut -d'"' -f4) && echo $URL && curl -L -o /lbrynet.linux.zip $URL
|
||||
|
||||
COPY stuff/start.sh /usr/bin/start
|
||||
COPY stuff/checkmount.sh /usr/bin/checkmount
|
||||
RUN unzip /lbrynet.linux.zip -d /lbrynet/ && \
|
||||
mv /lbrynet/lbrynet /usr/bin && \
|
||||
chmod a+x /usr/bin/checkmount /usr/bin/start /usr/bin/lbrynet
|
||||
|
||||
FROM ubuntu:18.04 as app
|
||||
COPY --from=prep /usr/bin/start /usr/bin/checkmount /usr/bin/lbrynet /usr/bin/
|
||||
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
|
||||
## 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
|
||||
USER lbrynet
|
||||
ENTRYPOINT ["/usr/bin/checkmount"]
|
||||
CMD ["start"]
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue