Merge branch 'master' into lbrynet
This commit is contained in:
commit
d37a932774
32 changed files with 1 additions and 1055 deletions
14
.travis.yml
14
.travis.yml
|
@ -1,14 +0,0 @@
|
||||||
# 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
|
|
1
lbrynet/.gitignore
vendored
1
lbrynet/.gitignore
vendored
|
@ -1,2 +1 @@
|
||||||
data/
|
data/
|
||||||
config/
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
## Convert this guide into a Dockerfile, have it spit out the compiled output.
|
|
||||||
## https://github.com/lbryio/lbry/blob/master/INSTALL.md
|
|
|
@ -1,14 +0,0 @@
|
||||||
#MYSQL_SERVER=${MYSQL_SERVER:-10.5.1.11}
|
|
||||||
#MYSQL_USER=${MYSQL_USER:-changeme}
|
|
||||||
#MYSQL_PASSWORD=${MYSQL_PASSWORD:-changeme}
|
|
||||||
#MYSQL_DATABASE=${MYSQL_DATABASE:-reflector}
|
|
||||||
#MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-changeme}
|
|
||||||
#AWS_ID=${AWS_ID:-default}
|
|
||||||
#AWS_SECRET=${AWS_SECRET:-default}
|
|
||||||
#BUCKET_REGION=${BUCKET_REGION:-default}
|
|
||||||
#BUCKET_NAME=${BUCKET_NAME:-default}
|
|
||||||
#DB_USER=${MYSQL_USER:-changeme}
|
|
||||||
#DB_PASSWORD=${MYSQL_PASSWORD:-changeme}
|
|
||||||
#DB_HOSTIP=${MYSQL_SERVER:-10.5.1.11}
|
|
||||||
#DB_PORT=${DB_PORT:-3306}
|
|
||||||
#DB_NAME=${MYSQL_DATABASE:-reflector}
|
|
|
@ -1,28 +0,0 @@
|
||||||
## base image for github.com/lbryio/reflector.go release binaries
|
|
||||||
FROM golang:1.11.1 as builder
|
|
||||||
LABEL MAINTAINER="leopere [at] nixc [dot] us"
|
|
||||||
|
|
||||||
RUN export GOROOT=$GOPATH/bin && \
|
|
||||||
go get -v -u github.com/lbryio/reflector.go && \
|
|
||||||
cd "/go/src/github.com/lbryio/reflector.go" && \
|
|
||||||
make && \
|
|
||||||
mv ./bin/prism-bin /usr/bin/prism-bin && \
|
|
||||||
chmod +x /usr/bin/prism-bin
|
|
||||||
|
|
||||||
## base image for github.com/lbryio/reflector.go release binaries
|
|
||||||
FROM ubuntu:18:04 as app
|
|
||||||
LABEL MAINTAINER="leopere [at] nixc [dot] us"
|
|
||||||
|
|
||||||
COPY /go/src/github.com/lbryio/reflector.go/bin/prism-bin /usr/bin/prism-bin
|
|
||||||
COPY start.sh /usr/local/bin/start
|
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
|
||||||
|
|
||||||
RUN adduser reflector --gecos GECOS --shell /bin/bash --disabled-password --home /data/ && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get -y install && \
|
|
||||||
wget -O /data/config.tmpl https://raw.githubusercontent.com/lbryio/reflector.go/master/config.tmpl && \
|
|
||||||
chown -R 1000:1000 /data/config.tmpl
|
|
||||||
|
|
||||||
USER reflector
|
|
||||||
|
|
||||||
CMD ["start"]
|
|
|
@ -1,22 +0,0 @@
|
||||||
## base image for github.com/lbryio/reflector.go release binaries
|
|
||||||
FROM golang:1.11.1
|
|
||||||
LABEL MAINTAINER="leopere [at] nixc [dot] us"
|
|
||||||
|
|
||||||
COPY start.sh /usr/local/bin/start
|
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
|
||||||
|
|
||||||
RUN adduser reflector --gecos GECOS --shell /bin/bash --disabled-password --home /data/
|
|
||||||
|
|
||||||
RUN export GOROOT=$GOPATH/bin && \
|
|
||||||
go get -v -u github.com/lbryio/reflector.go && \
|
|
||||||
cd "/go/src/github.com/lbryio/reflector.go" && \
|
|
||||||
make && \
|
|
||||||
mv ./bin/prism-bin /usr/bin/prism-bin && \
|
|
||||||
chmod +x /usr/bin/prism-bin
|
|
||||||
|
|
||||||
RUN wget -O /data/config.tmpl https://raw.githubusercontent.com/lbryio/reflector.go/master/config.tmpl && \
|
|
||||||
chown -R 1000:1000 /data/config.tmpl
|
|
||||||
|
|
||||||
USER reflector
|
|
||||||
|
|
||||||
CMD ["start"]
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"aws_id": "YOUR-AWS-ID",
|
|
||||||
"aws_secret": "YOUR-AWS-SECRET",
|
|
||||||
"bucket_region": "YOUR-BUCKET-REGION",
|
|
||||||
"bucket_name": "YOUR-BUCKET-NAME",
|
|
||||||
"db_conn": "USER:PASSWORD@tcp(localhost:3306)/DBNAME",
|
|
||||||
"slack_hook_url": ""
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
version: '3.4'
|
|
||||||
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
external: true
|
|
||||||
|
|
||||||
services:
|
|
||||||
###########
|
|
||||||
## MYSQL ##
|
|
||||||
###########
|
|
||||||
## MariaDB is currently not supported and neither is later versions of MySQL this may change.
|
|
||||||
## https://hub.docker.com/r/_/mariadb/
|
|
||||||
mysql:
|
|
||||||
image: mysql.5.7.23
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
ipv4_address: 10.5.1.11
|
|
||||||
aliases:
|
|
||||||
- mysql
|
|
||||||
environment:
|
|
||||||
## These variables are stored in the .env file next to this docker-compose.yml file.
|
|
||||||
## I will include a default .env file and .gitignore the ".env" pattern so you should be able to just git pull in the future if you need to.
|
|
||||||
MYSQL_SERVER: ${MYSQL_SERVER:-10.5.1.11}
|
|
||||||
MYSQL_USER: ${MYSQL_USER:-changeme}
|
|
||||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-changeme}
|
|
||||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-reflector}
|
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-changeme}
|
|
||||||
expose:
|
|
||||||
- 3306
|
|
||||||
volumes:
|
|
||||||
- ./data/db:/var/lib/mysql
|
|
||||||
|
|
||||||
##################
|
|
||||||
## reflector.go ##
|
|
||||||
##################
|
|
||||||
reflector-go:
|
|
||||||
build: .
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
ipv4_address: 10.5.1.20
|
|
||||||
environment:
|
|
||||||
AWS_ID: ${AWS_ID:-default}
|
|
||||||
AWS_SECRET: ${AWS_SECRET:-default}
|
|
||||||
BUCKET_REGION: ${BUCKET_REGION:-default}
|
|
||||||
BUCKET_NAME: ${BUCKET_NAME:-default}
|
|
||||||
DB_USER: ${MYSQL_USER:-changeme}
|
|
||||||
DB_PASSWORD: ${MYSQL_PASSWORD:-changeme}
|
|
||||||
DB_HOSTIP: ${MYSQL_SERVER:-10.5.1.11}
|
|
||||||
DB_PORT: ${DB_PORT:-3306}
|
|
||||||
DB_NAME: ${MYSQL_DATABASE:-reflector}
|
|
||||||
labels:
|
|
||||||
- "traefik.expose=false"
|
|
||||||
depends_on:
|
|
||||||
- mysql
|
|
|
@ -1,120 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## Launch service will tell prism-bin what mode to run in.
|
|
||||||
LAUNCHMODE="${MODE:-$1}"
|
|
||||||
|
|
||||||
## This variable will be what can override default launch args. I may modify this as I learn more about prism-bin
|
|
||||||
LAUNCHARGS="${CUSTOM_ARGS:-$2}"
|
|
||||||
|
|
||||||
## This is setup this way to handle any situations that might arise from the
|
|
||||||
## config being JSON and bash not being any good at JSON.
|
|
||||||
# ## Strings to replace.
|
|
||||||
AWS_ID_STR="YOUR-AWS-ID"
|
|
||||||
AWS_SECRET_STR="YOUR-AWS-SECRET"
|
|
||||||
BUCKET_REGION_STR="YOUR-BUCKET-REGION"
|
|
||||||
BUCKET_NAME_STR="YOUR-BUCKET-NAME"
|
|
||||||
DB_USER_STR="USER"
|
|
||||||
DB_PASSWORD_STR="PASSWORD"
|
|
||||||
DB_HOSTIP_STR="localhost"
|
|
||||||
DB_PORT_STR="3306"
|
|
||||||
DB_NAME_STR="DBNAME"
|
|
||||||
|
|
||||||
## For the most part this section is disabled
|
|
||||||
# ## Keys to re-insert
|
|
||||||
# AWS_ID_KEY=''
|
|
||||||
# AWS_SECRET_KEY=''
|
|
||||||
# BUCKET_REGION_KEY=''
|
|
||||||
# BUCKET_NAME_KEY=''
|
|
||||||
# DB_USER_KEY=''
|
|
||||||
# DB_PASSWORD_KEY=''
|
|
||||||
# DB_HOSTIP_KEY=''
|
|
||||||
# DB_PORT_KEY=''
|
|
||||||
# DB_NAME_KEY=''
|
|
||||||
|
|
||||||
# Environment Variables/Defaults
|
|
||||||
## Json sucks in BASH/Shell so you need to add trailing commas intermittently.
|
|
||||||
## Just pay attention to this. Also at some point I'll need to make a fringe
|
|
||||||
## case for handling key/values that aren't included in the default config.
|
|
||||||
AWS_ID="${AWS_ID:-potato}"
|
|
||||||
AWS_SECRET="${AWS_SECRET:-potato}"
|
|
||||||
BUCKET_REGION="${BUCKET_REGION:-potato}"
|
|
||||||
BUCKET_NAME="${BUCKET_NAME:-potato}"
|
|
||||||
DB_USER="${DB_USER:-potato}"
|
|
||||||
DB_PASSWORD="${DB_PASSWORD:-potato}"
|
|
||||||
DB_HOSTIP="${DB_HOSTIP:-potato}"
|
|
||||||
DB_PORT="${DB_PORT:-potato}"
|
|
||||||
DB_NAME="${DB_NAME:-potato}"
|
|
||||||
|
|
||||||
## Environment Variables
|
|
||||||
## Missing Vars off the hop SLACK_HOOK_URL
|
|
||||||
CONFIG_SETTINGS=(
|
|
||||||
AWS_ID
|
|
||||||
AWS_SECRET
|
|
||||||
BUCKET_REGION
|
|
||||||
BUCKET_NAME
|
|
||||||
DB_USER
|
|
||||||
DB_PASSWORD
|
|
||||||
DB_HOSTIP
|
|
||||||
DB_PORT
|
|
||||||
DB_NAME
|
|
||||||
)
|
|
||||||
CONFIG_SECRETS=(
|
|
||||||
AWS_ID
|
|
||||||
AWS_ID_STR
|
|
||||||
AWS_SECRET
|
|
||||||
AWS_SECRET_STR
|
|
||||||
BUCKET_NAME
|
|
||||||
BUCKET_NAME_STR
|
|
||||||
DB_USER
|
|
||||||
DB_USER_STR
|
|
||||||
DB_PASSWORD
|
|
||||||
DB_PASSWORD_STR
|
|
||||||
DB_HOSTIP
|
|
||||||
DB_HOSTIP_STR
|
|
||||||
DB_PORT
|
|
||||||
DB_PORT_STR
|
|
||||||
DB_NAME
|
|
||||||
DB_NAME_STR
|
|
||||||
)
|
|
||||||
|
|
||||||
## This function might be a bit overkill as all key/value pairs are unique in this config.
|
|
||||||
for i in "${!CONFIG_SETTINGS[@]}"; do
|
|
||||||
echo ${CONFIG_SETTINGS[$i]}"_KEY"
|
|
||||||
## Indirect references http://tldp.org/LDP/abs/html/ivr.html
|
|
||||||
eval FROM_STRING=\$"${CONFIG_SETTINGS[$i]}_STR"
|
|
||||||
eval VALUE_STRING=\$${CONFIG_SETTINGS[$i]}
|
|
||||||
eval KEY_STRING=\$"${CONFIG_SETTINGS[$i]}_KEY"
|
|
||||||
TO_STRING="$KEY_STRING$VALUE_STRING"
|
|
||||||
## DEBUG
|
|
||||||
# echo DEBUG FROM_STRING: "$FROM_STRING"
|
|
||||||
# echo DEBUG VALUE_STRING: $VALUE_STRING
|
|
||||||
# echo DEBUG KEY_STRING: $KEY_STRING
|
|
||||||
# echo DEBUG TO_STRING: "$TO_STRING"
|
|
||||||
sed -i '' "s/$FROM_STRING/$TO_STRING/g" ./config.tmpl
|
|
||||||
done
|
|
||||||
|
|
||||||
## Sanitization section
|
|
||||||
# Awaiting someone smarter than me to suggest a method for this.
|
|
||||||
# https://unix.stackexchange.com/questions/474097/i-want-to-unset-a-list-of-bash-variables-that-have-their-variable-strings-stored
|
|
||||||
for i in "${CONFIG_SECRETS[@]}"; do
|
|
||||||
unset $i
|
|
||||||
done
|
|
||||||
|
|
||||||
# Actual launch invoked here
|
|
||||||
case $MODE in
|
|
||||||
cluster )
|
|
||||||
prism-bin cluster ${LAUNCHARGS:-'-v --conf /data/config.tmpl'}
|
|
||||||
;;
|
|
||||||
dht )
|
|
||||||
## Env vars NODEID DHTPORT
|
|
||||||
## Figure out what port we want to run --rpcPort on by default
|
|
||||||
## Figure out if we need seed strings and set default(s)
|
|
||||||
prism-bin dht ${LAUNCHARGS:-'-v --conf /data/config.tmpl --nodeID $NODEID --port "${DHTPORT:-4567}"'}
|
|
||||||
;;
|
|
||||||
peer )
|
|
||||||
prism-bin peer ${LAUNCHARGS:-'-v --conf /data/config.tmpl'}
|
|
||||||
;;
|
|
||||||
reflector )
|
|
||||||
prism-bin reflector ${LAUNCHARGS:-'-v --conf /data/config.tmpl'}
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"aws_id": "YOUR-AWS-ID",
|
|
||||||
"aws_secret": "YOUR-AWS-SECRET",
|
|
||||||
"bucket_region": "YOUR-BUCKET-REGION",
|
|
||||||
"bucket_name": "YOUR-BUCKET-NAME",
|
|
||||||
"db_conn": "USER:PASSWORD@tcp(localhost:3306)/DBNAME",
|
|
||||||
"slack_hook_url": ""
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
version: '3.4'
|
|
||||||
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
external: true
|
|
||||||
|
|
||||||
services:
|
|
||||||
###########
|
|
||||||
## MYSQL ##
|
|
||||||
###########
|
|
||||||
## MariaDB is currently not supported and neither is later versions of MySQL this may change.
|
|
||||||
## https://hub.docker.com/r/_/mariadb/
|
|
||||||
mysql:
|
|
||||||
image: mysql.5.7.23
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
ipv4_address: 10.5.1.11
|
|
||||||
aliases:
|
|
||||||
- mysql
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
environment:
|
|
||||||
## These variables are stored in the .env file next to this docker-compose.yml file.
|
|
||||||
## I will include a default .env file and .gitignore the ".env" pattern so you should be able to just git pull in the future if you need to.
|
|
||||||
MYSQL_SERVER: ${MYSQL_SERVER:-10.5.1.11}
|
|
||||||
MYSQL_USER: ${MYSQL_USER:-changeme}
|
|
||||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-changeme}
|
|
||||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-reflector}
|
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-changeme}
|
|
||||||
expose:
|
|
||||||
- 3306
|
|
||||||
volumes:
|
|
||||||
- ./data/db:/var/lib/mysql
|
|
||||||
|
|
||||||
##################
|
|
||||||
## reflector.go ##
|
|
||||||
##################
|
|
||||||
reflector-go:
|
|
||||||
build: .
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
ipv4_address: 10.5.1.20
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
environment:
|
|
||||||
AWS_ID: ${AWS_ID:-default}
|
|
||||||
AWS_SECRET: ${AWS_SECRET:-default}
|
|
||||||
BUCKET_REGION: ${BUCKET_REGION:-default}
|
|
||||||
BUCKET_NAME: ${BUCKET_NAME:-default}
|
|
||||||
DB_USER: ${MYSQL_USER:-changeme}
|
|
||||||
DB_PASSWORD: ${MYSQL_PASSWORD:-changeme}
|
|
||||||
DB_HOSTIP: ${MYSQL_SERVER:-10.5.1.11}
|
|
||||||
DB_PORT: ${DB_PORT:-3306}
|
|
||||||
DB_NAME: ${MYSQL_DATABASE:-reflector}
|
|
||||||
labels:
|
|
||||||
- "traefik.expose=false"
|
|
||||||
depends_on:
|
|
||||||
- mysql
|
|
|
@ -1,120 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## Launch service will tell prism-bin what mode to run in.
|
|
||||||
LAUNCHMODE="${MODE:-$1}"
|
|
||||||
|
|
||||||
## This variable will be what can override default launch args. I may modify this as I learn more about prism-bin
|
|
||||||
LAUNCHARGS="${CUSTOM_ARGS:-$2}"
|
|
||||||
|
|
||||||
## This is setup this way to handle any situations that might arise from the
|
|
||||||
## config being JSON and bash not being any good at JSON.
|
|
||||||
# ## Strings to replace.
|
|
||||||
AWS_ID_STR="YOUR-AWS-ID"
|
|
||||||
AWS_SECRET_STR="YOUR-AWS-SECRET"
|
|
||||||
BUCKET_REGION_STR="YOUR-BUCKET-REGION"
|
|
||||||
BUCKET_NAME_STR="YOUR-BUCKET-NAME"
|
|
||||||
DB_USER_STR="USER"
|
|
||||||
DB_PASSWORD_STR="PASSWORD"
|
|
||||||
DB_HOSTIP_STR="localhost"
|
|
||||||
DB_PORT_STR="3306"
|
|
||||||
DB_NAME_STR="DBNAME"
|
|
||||||
|
|
||||||
## For the most part this section is disabled
|
|
||||||
# ## Keys to re-insert
|
|
||||||
# AWS_ID_KEY=''
|
|
||||||
# AWS_SECRET_KEY=''
|
|
||||||
# BUCKET_REGION_KEY=''
|
|
||||||
# BUCKET_NAME_KEY=''
|
|
||||||
# DB_USER_KEY=''
|
|
||||||
# DB_PASSWORD_KEY=''
|
|
||||||
# DB_HOSTIP_KEY=''
|
|
||||||
# DB_PORT_KEY=''
|
|
||||||
# DB_NAME_KEY=''
|
|
||||||
|
|
||||||
# Environment Variables/Defaults
|
|
||||||
## Json sucks in BASH/Shell so you need to add trailing commas intermittently.
|
|
||||||
## Just pay attention to this. Also at some point I'll need to make a fringe
|
|
||||||
## case for handling key/values that aren't included in the default config.
|
|
||||||
AWS_ID="${AWS_ID:-potato}"
|
|
||||||
AWS_SECRET="${AWS_SECRET:-potato}"
|
|
||||||
BUCKET_REGION="${BUCKET_REGION:-potato}"
|
|
||||||
BUCKET_NAME="${BUCKET_NAME:-potato}"
|
|
||||||
DB_USER="${DB_USER:-potato}"
|
|
||||||
DB_PASSWORD="${DB_PASSWORD:-potato}"
|
|
||||||
DB_HOSTIP="${DB_HOSTIP:-potato}"
|
|
||||||
DB_PORT="${DB_PORT:-potato}"
|
|
||||||
DB_NAME="${DB_NAME:-potato}"
|
|
||||||
|
|
||||||
## Environment Variables
|
|
||||||
## Missing Vars off the hop SLACK_HOOK_URL
|
|
||||||
CONFIG_SETTINGS=(
|
|
||||||
AWS_ID
|
|
||||||
AWS_SECRET
|
|
||||||
BUCKET_REGION
|
|
||||||
BUCKET_NAME
|
|
||||||
DB_USER
|
|
||||||
DB_PASSWORD
|
|
||||||
DB_HOSTIP
|
|
||||||
DB_PORT
|
|
||||||
DB_NAME
|
|
||||||
)
|
|
||||||
CONFIG_SECRETS=(
|
|
||||||
AWS_ID
|
|
||||||
AWS_ID_STR
|
|
||||||
AWS_SECRET
|
|
||||||
AWS_SECRET_STR
|
|
||||||
BUCKET_NAME
|
|
||||||
BUCKET_NAME_STR
|
|
||||||
DB_USER
|
|
||||||
DB_USER_STR
|
|
||||||
DB_PASSWORD
|
|
||||||
DB_PASSWORD_STR
|
|
||||||
DB_HOSTIP
|
|
||||||
DB_HOSTIP_STR
|
|
||||||
DB_PORT
|
|
||||||
DB_PORT_STR
|
|
||||||
DB_NAME
|
|
||||||
DB_NAME_STR
|
|
||||||
)
|
|
||||||
|
|
||||||
## This function might be a bit overkill as all key/value pairs are unique in this config.
|
|
||||||
for i in "${!CONFIG_SETTINGS[@]}"; do
|
|
||||||
echo ${CONFIG_SETTINGS[$i]}"_KEY"
|
|
||||||
## Indirect references http://tldp.org/LDP/abs/html/ivr.html
|
|
||||||
eval FROM_STRING=\$"${CONFIG_SETTINGS[$i]}_STR"
|
|
||||||
eval VALUE_STRING=\$${CONFIG_SETTINGS[$i]}
|
|
||||||
eval KEY_STRING=\$"${CONFIG_SETTINGS[$i]}_KEY"
|
|
||||||
TO_STRING="$KEY_STRING$VALUE_STRING"
|
|
||||||
## DEBUG
|
|
||||||
# echo DEBUG FROM_STRING: "$FROM_STRING"
|
|
||||||
# echo DEBUG VALUE_STRING: $VALUE_STRING
|
|
||||||
# echo DEBUG KEY_STRING: $KEY_STRING
|
|
||||||
# echo DEBUG TO_STRING: "$TO_STRING"
|
|
||||||
sed -i '' "s/$FROM_STRING/$TO_STRING/g" ./config.tmpl
|
|
||||||
done
|
|
||||||
|
|
||||||
## Sanitization section
|
|
||||||
# Awaiting someone smarter than me to suggest a method for this.
|
|
||||||
# https://unix.stackexchange.com/questions/474097/i-want-to-unset-a-list-of-bash-variables-that-have-their-variable-strings-stored
|
|
||||||
for i in "${CONFIG_SECRETS[@]}"; do
|
|
||||||
unset $i
|
|
||||||
done
|
|
||||||
|
|
||||||
# Actual launch invoked here
|
|
||||||
case $MODE in
|
|
||||||
cluster )
|
|
||||||
prism-bin cluster ${LAUNCHARGS:-'-v --conf /data/config.tmpl'}
|
|
||||||
;;
|
|
||||||
dht )
|
|
||||||
## Env vars NODEID DHTPORT
|
|
||||||
## Figure out what port we want to run --rpcPort on by default
|
|
||||||
## Figure out if we need seed strings and set default(s)
|
|
||||||
prism-bin dht ${LAUNCHARGS:-'-v --conf /data/config.tmpl --nodeID $NODEID --port "${DHTPORT:-4567}"'}
|
|
||||||
;;
|
|
||||||
peer )
|
|
||||||
prism-bin peer ${LAUNCHARGS:-'-v --conf /data/config.tmpl'}
|
|
||||||
;;
|
|
||||||
reflector )
|
|
||||||
prism-bin reflector ${LAUNCHARGS:-'-v --conf /data/config.tmpl'}
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,8 +0,0 @@
|
||||||
COMPOSE_PROJECT_NAME=speech
|
|
||||||
## This value can generally be left alone in a default setup.
|
|
||||||
MYSQL_SERVER=10.5.1.8
|
|
||||||
## Update the rest of these if possible.
|
|
||||||
MYSQL_USER=replaceme
|
|
||||||
MYSQL_PASSWORD=REPLACEME
|
|
||||||
MYSQL_DATABASE=speech
|
|
||||||
MYSQL_ROOT_PASSWORD=REPLACEME
|
|
2
spee.ch/.gitignore
vendored
2
spee.ch/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
data/
|
|
||||||
config/
|
|
|
@ -1,33 +0,0 @@
|
||||||
## Base Image
|
|
||||||
## Using the smallest container available
|
|
||||||
## https://hub.docker.com/_/node/
|
|
||||||
# 8.11.2-alpine, 8.11-alpine, 8-alpine, carbon-alpine (8/alpine/Dockerfile)
|
|
||||||
FROM node:8-alpine
|
|
||||||
LABEL MAINTAINER="leopere [at] nixc [dot] us"
|
|
||||||
|
|
||||||
## Install base packages and clone repo to src directory.
|
|
||||||
RUN apk update && apk --no-cache add git curl wget python build-base bash && \
|
|
||||||
npm update && npm i npm@latest -g && \
|
|
||||||
npm install -g node-gyp && \
|
|
||||||
adduser speech -h /app/ -s /bin/bash -D && \
|
|
||||||
chown -Rv speech /app && \
|
|
||||||
git clone https://github.com/lbryio/spee.ch.git /usr/local/src/spee.ch/ && \
|
|
||||||
cd /usr/local/src/spee.ch/ && \
|
|
||||||
npm install
|
|
||||||
|
|
||||||
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 container support files
|
|
||||||
RUN curl -s https://raw.githubusercontent.com/leopere/docker-support/master/install | /bin/sh
|
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
|
||||||
COPY healthcheck.sh /usr/local/bin/healthcheck
|
|
||||||
COPY debugpaste-it.sh /usr/local/bin/debugpaste-it
|
|
||||||
|
|
||||||
|
|
||||||
HEALTHCHECK CMD healthcheck
|
|
||||||
EXPOSE 3000
|
|
||||||
USER speech
|
|
||||||
WORKDIR /app/
|
|
||||||
ENTRYPOINT ["docker-entrypoint"]
|
|
||||||
CMD ["npm", "run", "start:dev"]
|
|
|
@ -1,45 +0,0 @@
|
||||||
# Status WIP
|
|
||||||
This is still a WIP and documentation may be wildly out of sync with reality.
|
|
||||||
|
|
||||||
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
|
|
||||||
|
|
||||||
- [Status WIP](#status-wip)
|
|
||||||
- [Container Base](#container-base)
|
|
||||||
- [Goals](#goals)
|
|
||||||
- [Fresh install on creation](#fresh-install-on-creation)
|
|
||||||
- [Your changes take priority](#your-changes-take-priority)
|
|
||||||
- [Configuration](#configuration)
|
|
||||||
- [Try it out immediately](#try-it-out-immediately)
|
|
||||||
- [Docker & Docker-compose](#docker--docker-compose)
|
|
||||||
|
|
||||||
<!-- /TOC -->
|
|
||||||
|
|
||||||
# Container Base
|
|
||||||
[Based on this documentation](https://docs.google.com/document/d/1eeEx1wNVxfFEzxC4P_tL4-peZiUjD0KL_ODkKvEucrk/edit) I will be creating a container which should aim to work on top of any customizations you add yourself.
|
|
||||||
|
|
||||||
## Goals
|
|
||||||
#### Fresh install on creation
|
|
||||||
The end goal will be to iterate through all of the directories you have in any volumes you include and then copy anything else into the service directory omitting any files which you've changed.
|
|
||||||
|
|
||||||
Configuration should be absolutely bare minimal and doable via the docker environment variables. This makes it so that you can launch this project in any environment you like Kubernetes, Amazon Elastic Container Service, RancherOS, Docker Swarm, Docker-Compose.
|
|
||||||
|
|
||||||
An advanced container example using docker-compose which contains the full stack including https handling via a reverse proxy. This should automagically by default include automagic LetsEncrypt provisioning and renewal so long as you've set your own DNS records correctly to point where this container will be hosted.
|
|
||||||
|
|
||||||
#### Your changes take priority
|
|
||||||
This means any content that you've included in the /app/ path should be ignored when the container is instantiated. So generally only include files that you plan to have changed. Eventually I may add something a bit smarter and do a hash check & compare to be a bit smarter but for now simpler is better.
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
The configuration will take place on container instantiation based on any environment variables which you include in your docker invocation be it a `docker-compose.yml` or a simple `docker run`.
|
|
||||||
|
|
||||||
You should prefer to include your configuration variables through means of the environment variables. However, if you find something in the configuration which you feel needs changed which we haven't included an environment variable for you should be free to include your own custom configuration file you're welcomed to.
|
|
||||||
|
|
||||||
# Try it out immediately
|
|
||||||
What's better than something that works right out of the box? I really have no idea because if you have a goal that is small and iterative why would you want to do things the hard way unless you know for a fact that you're really into this.
|
|
||||||
|
|
||||||
## Docker & Docker-compose
|
|
||||||
Docker compose is the most recommended way to get started and even run in deployment as it saves you a lot of pain of sifting through old commands to re-execute your docker container. So pre-requisites will be to have the following installed and most of these support packages are as easy as copy paste commands.
|
|
||||||
```
|
|
||||||
git
|
|
||||||
docker
|
|
||||||
docker-compose
|
|
||||||
```
|
|
|
@ -1,154 +0,0 @@
|
||||||
## YMMV and this is not supported but should be a few steps away from deployable.
|
|
||||||
version: '3.4'
|
|
||||||
services:
|
|
||||||
|
|
||||||
############
|
|
||||||
## Speech ##
|
|
||||||
############
|
|
||||||
speech:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
# restart: always
|
|
||||||
expose:
|
|
||||||
- 3000
|
|
||||||
volumes:
|
|
||||||
- ../data/spee.ch:/data
|
|
||||||
labels:
|
|
||||||
# https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
|
|
||||||
- "traefik.backend=speech"
|
|
||||||
- "traefik.docker.network=green"
|
|
||||||
- "traefik.frontend.rule=Host:YOURDOMAINHERE"
|
|
||||||
- "traefik.expose=true"
|
|
||||||
- "traefik.port=3000"
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.6
|
|
||||||
aliases:
|
|
||||||
- speech
|
|
||||||
|
|
||||||
#############
|
|
||||||
## Lbrynet ##
|
|
||||||
#############
|
|
||||||
lbrynet:
|
|
||||||
build:
|
|
||||||
context: ../lbrynet-daemon/
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
# restart: always
|
|
||||||
expose:
|
|
||||||
- 4444
|
|
||||||
- 50001
|
|
||||||
## host volumes for persistent data such as wallet private keys.
|
|
||||||
volumes:
|
|
||||||
- ../data/traefik:/data
|
|
||||||
labels:
|
|
||||||
test: traefik.enable=false
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.7
|
|
||||||
aliases:
|
|
||||||
- lbrynet
|
|
||||||
|
|
||||||
#############
|
|
||||||
## MariaDB ##
|
|
||||||
#############
|
|
||||||
## https://hub.docker.com/r/_/mariadb/
|
|
||||||
mysql:
|
|
||||||
image: mariadb
|
|
||||||
# restart: always
|
|
||||||
environment:
|
|
||||||
MYSQL_SERVER: 10.5.1.8
|
|
||||||
MYSQL_USER: replaceme
|
|
||||||
MYSQL_PASSWORD: REPLACEME
|
|
||||||
MYSQL_DATABASE: speech
|
|
||||||
MYSQL_ROOT_PASSWORD: REPLACEME
|
|
||||||
expose:
|
|
||||||
- 3306
|
|
||||||
volumes:
|
|
||||||
- ../data/db:/var/lib/mysql
|
|
||||||
labels:
|
|
||||||
test: traefik.enable=false
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.8
|
|
||||||
aliases:
|
|
||||||
- mysql
|
|
||||||
|
|
||||||
#######################
|
|
||||||
## Adminer container ##
|
|
||||||
#######################
|
|
||||||
adminer:
|
|
||||||
image: adminer
|
|
||||||
# restart: always
|
|
||||||
links:
|
|
||||||
- "mysql:database"
|
|
||||||
depends_on:
|
|
||||||
- mysql
|
|
||||||
labels:
|
|
||||||
# https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
|
|
||||||
- "traefik.backend=adminer"
|
|
||||||
- "traefik.docker.network=green"
|
|
||||||
- "traefik.frontend.rule=Host:adminer.YOURDOMAINHERE"
|
|
||||||
- "traefik.expose=true"
|
|
||||||
- "traefik.port=8080"
|
|
||||||
# healthcheck:
|
|
||||||
# test: ["CMD", "curl", "--fail", "http://localhost:8080/", "||", "exit", "1"]
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.9
|
|
||||||
aliases:
|
|
||||||
- adminer
|
|
||||||
|
|
||||||
#######################
|
|
||||||
## Traefik container ##
|
|
||||||
#######################
|
|
||||||
## https://www.digitalocean.com/community/tutorials/how-to-use-traefik-as-a-reverse-proxy-for-docker-containers-on-ubuntu-16-04
|
|
||||||
lbrynet
|
|
||||||
image: lbrynetalpine
|
|
||||||
# command: --api --docker --docker.domain=docker.localhost --logLevel=DEBUG
|
|
||||||
command: --api --docker --logLevel=ERROR
|
|
||||||
depends_on:
|
|
||||||
- adminer
|
|
||||||
ports:
|
|
||||||
- target: 80
|
|
||||||
published: 80
|
|
||||||
mode: host
|
|
||||||
- target: 443
|
|
||||||
published: 443
|
|
||||||
mode: host
|
|
||||||
expose:
|
|
||||||
- 8080
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- /home/persistence/traefik/traefik.toml:/traefik.toml
|
|
||||||
## This is going to be stored by default in the following host dir in staging.
|
|
||||||
# There is a rate limit for how many issuances you can request per week.
|
|
||||||
# Because of this we will store the acme.json file persistently.
|
|
||||||
# In production we are going to need to figure out how it'll work with Kubernetes or variant.
|
|
||||||
- ../data/traefik/:/opt/traefik/
|
|
||||||
labels:
|
|
||||||
# https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
|
|
||||||
- "traefik.backend=proxy"
|
|
||||||
- "traefik.docker.network=green"
|
|
||||||
- "traefik.frontend.rule=Host:monitor.YOURDOMAINHERE"
|
|
||||||
- "traefik.expose=true"
|
|
||||||
- "traefik.port=8080"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "traefik", "healthcheck"]
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.10
|
|
||||||
aliases:
|
|
||||||
- traefik
|
|
||||||
|
|
||||||
#########################
|
|
||||||
## Network Definitions ##
|
|
||||||
#########################
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
driver: bridge
|
|
||||||
ipam:
|
|
||||||
config:
|
|
||||||
- subnet: 10.5.1.0/16
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
echo "For now we're going to go with a tune in next time for a debugpaste."
|
|
|
@ -1,89 +0,0 @@
|
||||||
## This docker-compose.yml file should serve as an example to help you test out spee.ch
|
|
||||||
## If this works fine in your environment you may potentially run from this file but it may change in the future.
|
|
||||||
## Ideally if you need to modify the settings in this file you could create a docker-compose.override.yml containing only values you wish to override from this one.
|
|
||||||
## Documentation on compose overrides: https://docs.docker.com/compose/extends/
|
|
||||||
|
|
||||||
version: '3.4'
|
|
||||||
services:
|
|
||||||
############
|
|
||||||
## Speech ##
|
|
||||||
############
|
|
||||||
speech:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- 3000:3000
|
|
||||||
volumes:
|
|
||||||
- ./data/speech:/data
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.6
|
|
||||||
aliases:
|
|
||||||
- speech
|
|
||||||
|
|
||||||
#############
|
|
||||||
## Lbrynet ##
|
|
||||||
#############
|
|
||||||
lbrynet:
|
|
||||||
build:
|
|
||||||
context: ../lbrynet-daemon/
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
## These variables are stored in the .env file next to this docker-compose.yml file.
|
|
||||||
## I will include a default .env file and .gitignore the ".env" pattern so you should be able to just git pull in the future if you need to.
|
|
||||||
MYSQL_SERVER: ${MYSQL_SERVER}
|
|
||||||
MYSQL_USER: ${MYSQL_USER}
|
|
||||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
|
||||||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
|
||||||
ports:
|
|
||||||
- 4444:4444
|
|
||||||
- 50001:50001
|
|
||||||
## host volumes for persistent data such as wallet private keys.
|
|
||||||
volumes:
|
|
||||||
- ./data/traefik:/data
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.7
|
|
||||||
aliases:
|
|
||||||
- lbrynet
|
|
||||||
|
|
||||||
#############
|
|
||||||
## MariaDB ##
|
|
||||||
#############
|
|
||||||
## https://hub.docker.com/r/_/mariadb/
|
|
||||||
mysql:
|
|
||||||
image: mariadb
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
## These variables are stored in the .env file next to this docker-compose.yml file.
|
|
||||||
## I will include a default .env file and .gitignore the ".env" pattern so you should be able to just git pull in the future if you need to.
|
|
||||||
MYSQL_SERVER: ${MYSQL_SERVER}
|
|
||||||
MYSQL_USER: ${MYSQL_USER}
|
|
||||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
|
||||||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
|
||||||
# expose:
|
|
||||||
# - 3306
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
volumes:
|
|
||||||
- ./data/db:/var/lib/mysql
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
ipv4_address: 10.5.1.8
|
|
||||||
aliases:
|
|
||||||
- mysql
|
|
||||||
|
|
||||||
#########################
|
|
||||||
## Network Definitions ##
|
|
||||||
#########################
|
|
||||||
networks:
|
|
||||||
green:
|
|
||||||
driver: bridge
|
|
||||||
ipam:
|
|
||||||
config:
|
|
||||||
- subnet: 10.5.1.0/16
|
|
|
@ -1,168 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -eo pipefail
|
|
||||||
## Add -x to set if you want really explicit feedback.
|
|
||||||
## -u breaks unbound variables
|
|
||||||
## This docker-entrypoint will take a copy of the configuration and install any
|
|
||||||
## ENVVARS and then copy any required files into the /app/ directory next to any
|
|
||||||
## custom files added by the user.
|
|
||||||
|
|
||||||
# default to run whatever the user wanted like "/bin/ash"
|
|
||||||
## If user runs no need to run any more of the entrypoint script.
|
|
||||||
if [[ -z "$@" ]]; then
|
|
||||||
echof info "User did not attempt input. Now executing docker-entrypoint."
|
|
||||||
else
|
|
||||||
echof info "Running $@."
|
|
||||||
exec "$@"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ENVVARS=("MYSQL_ENV_MYSQL_USER"
|
|
||||||
"MYSQL_ENV_MYSQL_PASSWORD"
|
|
||||||
"MYSQL_ENV_MYSQL_DATABASE"
|
|
||||||
"MYSQL_ENV_MYSQL_ADDRESS"
|
|
||||||
"GOOGLE_ANALYTICS_UID"
|
|
||||||
"SITE_TITLE"
|
|
||||||
"SITE_ADDRESS"
|
|
||||||
"SITE_DESCRIPTION"
|
|
||||||
)
|
|
||||||
# MYSQL_ENV_MYSQL_USER=alphauser
|
|
||||||
# MYSQL_ENV_MYSQL_PASSWORD=alphapassword
|
|
||||||
# MYSQL_ENV_MYSQL_DATABASE=alphadatabase
|
|
||||||
# MYSQL_ENV_MYSQL_ADDRESS=alphaaddress
|
|
||||||
# GOOGLE_ANALYTICS_UID=alphauid
|
|
||||||
# SITE_TITLE=AlphaTitle
|
|
||||||
# SITE_ADDRESS=alpha.address.com
|
|
||||||
SITE_DESCRIPTION=alpha.description
|
|
||||||
|
|
||||||
|
|
||||||
## There might be a better way to do this now I'm working on something for configuring things more magically.
|
|
||||||
function set_conf() {
|
|
||||||
case $1 in
|
|
||||||
MYSQL_ENV_MYSQL_USER )
|
|
||||||
if [[ -z "$MYSQL_ENV_MYSQL_USER" ]]; then
|
|
||||||
echof info "User did not attempt to configure $MYSQL_ENV_MYSQL_USER"
|
|
||||||
else
|
|
||||||
echof info "Configuring $MYSQL_ENV_MYSQL_USER."
|
|
||||||
echof info "Setting '$MYSQL_ENV_MYSQL_USER' $MYSQL_ENV_MYSQL_USER in /app/config/mysqlConfig.json"
|
|
||||||
sed -i 's/"username": "root"/"username": "'$MYSQL_ENV_MYSQL_USER'"/' /app/config/mysqlConfig.json
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
MYSQL_ENV_MYSQL_PASSWORD )
|
|
||||||
if [[ -z "$MYSQL_ENV_MYSQL_PASSWORD" ]]; then
|
|
||||||
echof info "User did not attempt to configure $MYSQL_ENV_MYSQL_PASSWORD"
|
|
||||||
else
|
|
||||||
## This echo should be sanitized of any secrets before this is finished.
|
|
||||||
echof info "Setting '$MYSQL_ENV_MYSQL_PASSWORD' $MYSQL_ENV_MYSQL_PASSWORD in /app/config/mysqlConfig.json"
|
|
||||||
sed -i 's/"password": ""/"password": "'$MYSQL_ENV_MYSQL_PASSWORD'"/' /app/config/mysqlConfig.json
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
MYSQL_ENV_MYSQL_DATABASE )
|
|
||||||
if [[ -z "$MYSQL_ENV_MYSQL_DATABASE" ]]; then
|
|
||||||
echof info "User did not attempt to configure $MYSQL_ENV_MYSQL_DATABASE"
|
|
||||||
else
|
|
||||||
echof info "Setting '$MYSQL_ENV_MYSQL_DATABASE' $MYSQL_ENV_MYSQL_DATABASE in /app/config/mysqlConfig.json"
|
|
||||||
sed -i 's/"database": "lbry"/"database": "'$MYSQL_ENV_MYSQL_DATABASE'"/' /app/config/mysqlConfig.json
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
MYSQL_SERVER_ADDRESS )
|
|
||||||
if [[ -z "$MYSQL_SERVER_ADDRESS" ]]; then
|
|
||||||
echof info "User did not attempt to configure $MYSQL_SERVER_ADDRESS"
|
|
||||||
else
|
|
||||||
echof warn "This variable is not currently available."
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
SITE_ADDRESS )
|
|
||||||
if [[ -z "$SITE_ADDRESS" ]]; then
|
|
||||||
echof info "User did not attempt to configure $SITE_ADDRESS"
|
|
||||||
else
|
|
||||||
echof info "Setting '$SITE_ADDRESS' $SITE_ADDRESS in /app/config/siteConfig.json"
|
|
||||||
sed -i 's,"host": "https://www.example.com","host": "https://"$SITE_ADDRESS,' /app/config/siteConfig.json
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
GOOGLE_ANALYTICS_UID )
|
|
||||||
if [[ -z "$GOOGLE_ANALYTICS_UID" ]]; then
|
|
||||||
echof info "User did not attempt to configure $GOOGLE_ANALYTICS_UID"
|
|
||||||
else
|
|
||||||
echof info "Setting '$GOOGLE_ANALYTICS_UID' $GOOGLE_ANALYTICS_UID in /app/config/siteConfig.json"
|
|
||||||
sed -i 's/"googleId": null/"googleId": '$GOOGLE_ANALYTICS_UID'/' /app/config/siteConfig.json
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
SITE_TITLE )
|
|
||||||
if [[ -z "$SITE_TITLE" ]]; then
|
|
||||||
echof info "User did not attempt to configure $SITE_TITLE"
|
|
||||||
else
|
|
||||||
echof info "Setting '$SITE_TITLE' $SITE_TITLE in /app/config/siteConfig.json"
|
|
||||||
sed -i 's/"title": "My Site"/"title": "'$SITE_TITLE'"/' /app/config/siteConfig.json
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
SITE_DESCRIPTION )
|
|
||||||
if [[ -z "$SITE_DESCRIPTION" ]]; then
|
|
||||||
echof info "User did not attempt to configure $SITE_DESCRIPTION"
|
|
||||||
else
|
|
||||||
echof info "Setting '$SITE_DESCRIPTION' $SITE_DESCRIPTION in /app/config/siteConfig.json"
|
|
||||||
sed -i 's/"description": "A decentralized hosting platform built on LBRY"/"Description": "'$SITE_DESCRIPTION'"/' /app/config/siteConfig.json
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
function configure_speech() {
|
|
||||||
# install configuration changes here.
|
|
||||||
echof info "Installing configuration files into /app/config/."
|
|
||||||
mkdir -p /app/config/
|
|
||||||
cp /usr/local/src/spee.ch/cli/defaults/mysqlConfig.json /app/config/mysqlConfig.json
|
|
||||||
cp /usr/local/src/spee.ch/cli/defaults/siteConfig.json /app/config/siteConfig.json
|
|
||||||
echof info "Installing any environment variables that have been set."
|
|
||||||
for i in "${ENVVARS[@]}"; do
|
|
||||||
if [[ -z "$i" ]]; then
|
|
||||||
echof info "$i was not set, moving on."
|
|
||||||
else
|
|
||||||
set_conf $i
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function final_permset() {
|
|
||||||
# ## Finally reassert permissions in case there is user added drift.
|
|
||||||
# rddo /app "test_for_dir" '775 "speech:speech"'
|
|
||||||
# rfdo /app "test_for_file" '665 "speech:speech"'
|
|
||||||
# ## Define any permission exceptions here.
|
|
||||||
# # test_for_dir /app/config 775 "speech:speech"
|
|
||||||
# # test_for_file /app/config/siteConfig.json 665 "speech:speech"
|
|
||||||
echof info "Copied Spee.ch and set permissions"
|
|
||||||
}
|
|
||||||
|
|
||||||
###################################
|
|
||||||
## Actual installation function. ##
|
|
||||||
###################################
|
|
||||||
# if Spee.ch is not yet installed, copy it into web root.
|
|
||||||
# This could be updated to be part of an upgrade mechanism.
|
|
||||||
if [ "$(ls -A /app)" ]; then
|
|
||||||
echof warn "/app is not Empty. It contains:" 1>&2
|
|
||||||
ls -A 1>&2
|
|
||||||
## If siteConfig.json isn't installed add it and configure or ignore and proceed.
|
|
||||||
if [ ! -e '/app/config/siteConfig.json' ]; then
|
|
||||||
echof warn "Spee.ch doesn't appear to have a configuration."
|
|
||||||
echof blank "Installing config"
|
|
||||||
configure_speech
|
|
||||||
else
|
|
||||||
## If the file exists skip configuration and proceed.
|
|
||||||
echof info "Spee.ch config already installed skipping configuration step."
|
|
||||||
final_permset
|
|
||||||
fi
|
|
||||||
## Install all other files after installing siteConfig.json
|
|
||||||
echof info "Making an attempt to nicely merge files using:"
|
|
||||||
echof run "mv -fnu /usr/local/src/spee.ch/* /app/"
|
|
||||||
mv -fnu /usr/local/src/spee.ch/* /app/
|
|
||||||
final_permset
|
|
||||||
else
|
|
||||||
echof info "Speech not installed, installing fresh copy now."
|
|
||||||
configure_speech
|
|
||||||
echof run "cp -r /usr/local/src/spee.ch/* /app/"
|
|
||||||
cp -r /usr/local/src/spee.ch/* /app/
|
|
||||||
final_permset
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Superfluous permissions assertion maybe axe this later.
|
|
||||||
# echof run 'test_for_dir /app/config/siteConfig.json 775 "speech:speech"'
|
|
||||||
# test_for_file /app/config/siteConfig.json 775 "speech:speech"
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
curl --fail http://localhost:3000/ || exit 1
|
|
|
@ -1,2 +0,0 @@
|
||||||
COMPOSE_PROJECT_NAME=traefik
|
|
||||||
DOMAIN=example.com
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
echo "========================================================================="
|
|
||||||
echo "========================================================================="
|
|
||||||
echo "lbry-docker: does not maintain or support custom configuration of traefik"
|
|
||||||
echo " lbry-docker comes with a YMMV boilerplate reverse proxy for"
|
|
||||||
echo " your convenience only and changing this configuration voids"
|
|
||||||
echo " your warranty."
|
|
||||||
echo "========================================================================="
|
|
|
@ -1,48 +0,0 @@
|
||||||
version: '3.4'
|
|
||||||
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
external: true
|
|
||||||
|
|
||||||
services:
|
|
||||||
#####################
|
|
||||||
## Proxy container ##
|
|
||||||
#####################
|
|
||||||
## One of the major contributing guides here.
|
|
||||||
## https://www.digitalocean.com/community/tutorials/how-to-use-traefik-as-a-reverse-proxy-for-docker-containers-on-ubuntu-16-04
|
|
||||||
proxy:
|
|
||||||
image: traefik:alpine
|
|
||||||
command: --api --docker --docker.domain=docker.localhost --logLevel=DEBUG
|
|
||||||
networks:
|
|
||||||
lbrynet:
|
|
||||||
ipv4_address: 10.5.1.100
|
|
||||||
ports:
|
|
||||||
- target: 80
|
|
||||||
published: 80
|
|
||||||
mode: host
|
|
||||||
- target: 443
|
|
||||||
published: 443
|
|
||||||
mode: host
|
|
||||||
expose:
|
|
||||||
- 8080
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- ./traefik.toml:/traefik.toml
|
|
||||||
## This is going to be stored by default in the following host dir in staging.
|
|
||||||
# There is a rate limit for how many issuances you can request per week.
|
|
||||||
# Because of this we will store the acme.json file persistently.
|
|
||||||
# In production we are going to need to figure out how it'll work with Kubernetes or variant.
|
|
||||||
- ./traefik/:/opt/traefik/
|
|
||||||
labels:
|
|
||||||
# https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
|
|
||||||
- "traefik.backend=proxy"
|
|
||||||
- "traefik.docker.network=lbrynet"
|
|
||||||
## Make sure that you either set the .env variable included in this repository or replace the domain string below.
|
|
||||||
## Also your DNS record will need to exist pointing at the machine your Traefik Reverse Proxy will be hosted on before you launch this app cluster.
|
|
||||||
- "traefik.frontend.rule=Host:monitor.${DOMAIN}"
|
|
||||||
- "traefik.expose=true"
|
|
||||||
- "traefik.port=8080"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "traefik", "healthcheck"]
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
|
@ -1,40 +0,0 @@
|
||||||
debug = true
|
|
||||||
|
|
||||||
logLevel = "ERROR"
|
|
||||||
defaultEntryPoints = ["https","http"]
|
|
||||||
|
|
||||||
[entryPoints]
|
|
||||||
[entryPoints.http]
|
|
||||||
address = ":80"
|
|
||||||
[entryPoints.http.redirect]
|
|
||||||
entryPoint = "https"
|
|
||||||
[entryPoints.https]
|
|
||||||
address = ":443"
|
|
||||||
[entryPoints.https.tls]
|
|
||||||
|
|
||||||
[retry]
|
|
||||||
|
|
||||||
[docker]
|
|
||||||
endpoint = "unix:///var/run/docker.sock"
|
|
||||||
## Edit the domain string with your domain that you want to provision web apps to.
|
|
||||||
domain = "${DOMAIN}"
|
|
||||||
watch = true
|
|
||||||
exposedbydefault = false
|
|
||||||
|
|
||||||
[acme]
|
|
||||||
## Edit the email string with where you want to receive TLS Cert notifications.
|
|
||||||
email = "admin@${DOMAIN}"
|
|
||||||
storage = "/opt/traefik/acme.json"
|
|
||||||
entryPoint = "https"
|
|
||||||
OnHostRule = true
|
|
||||||
[acme.httpChallenge]
|
|
||||||
entryPoint = "http"
|
|
||||||
|
|
||||||
# Ping definition for enabling healthcheck
|
|
||||||
[ping]
|
|
||||||
# Name of the related entry point
|
|
||||||
#
|
|
||||||
# Optional
|
|
||||||
# Default: "traefik"
|
|
||||||
#
|
|
||||||
entryPoint = "traefik"
|
|
Loading…
Reference in a new issue