From d922cdf420bee4c00fdaf956a58918ed90f224ee Mon Sep 17 00:00:00 2001 From: Jessop Breth Date: Mon, 12 Nov 2018 13:53:29 -0500 Subject: [PATCH] updates docs --- README.md | 16 +-- docs/ubuntu16vpspersonal.md | 261 ------------------------------------ docs/ubuntuinstall.md | 41 +++--- fullstart.md | 47 +++---- 4 files changed, 41 insertions(+), 324 deletions(-) delete mode 100644 docs/ubuntu16vpspersonal.md diff --git a/README.md b/README.md index 8f9d2b86..28429352 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Spee.ch is a react web app that depends on MySQL for local content, and on two o * [FFmpeg](https://www.ffmpeg.org/download.html) * [Spee.ch] (below) * [pm2] (optional) process manager such as pm2 to run speech server.js - * [http proxy server] caddy, nginx, traefik, etc to forward 443 to speech port 3000 + * [http proxy server] caddy, nginx, traefik, etc to forward 80/443 to speech port 3000 #### Clone this repo @@ -67,22 +67,12 @@ $ npm install #### Create the config files using the built-in CLI _note: make sure lbrynet is running in the background before proceeding_ +_note: If you are opt to run a local chainquery, such as from [lbry-docker/chainquery](https://github.com/lbryio/lbry-docker/tree/master/chainquery) you will need to specify connection details at this time in:_ ~/spee.ch/docs/setup/conf/speech/chainqueryConfig.json + ``` $ npm run configure ``` - * _note: At the moment, you will have to copy chainqueryConfig.json from:_ - ``` - ~/spee.ch/docs/setup/conf/speech/chainqueryConfig.json - ``` - - _to:_ - ``` - ~/spee.ch/site/config/chainqueryConfig.json - ``` - - * _note: The domain name in this part must be prefixed with http:// or https://_ - #### Build & start the app _note: make sure lbrynet is running in the background before proceeding_ diff --git a/docs/ubuntu16vpspersonal.md b/docs/ubuntu16vpspersonal.md deleted file mode 100644 index 7f2f793a..00000000 --- a/docs/ubuntu16vpspersonal.md +++ /dev/null @@ -1,261 +0,0 @@ -# Create Your Own Spee.ch on Ubuntu 16.x 18.x VPS - -# Overview - -## Prerequisites - * UBUNTU 16+ VPS with root access - * Your login info ready - * Domain name with @ and www pointed at your VPS IP - * Email Address - * Ability to send 5+ LBRY credits to an address - * Noncommercial use (highly suggested, but you still _could_) - * We recommend that you fork Spee.ch so that you can customize the site. - -## You'll be installing: - * MYSQL DB - * Default Port - * NODE v8+ - * HTTPS PROXY SERVER - * Caddy for personal use - * Exposed ports: 22, 80, 443, 3333, 4444 - * Reverse proxies to App on 3000 - * SPEE.CH - * LBRYNET DAEMON - - -# 1. Update OS and install packages -## OS - `sudo apt-get update -y` - - `ulimit -n 8192` - -## Git - - `sudo apt-get install git -y` - -## NODE v8 - - `wget -qO- https://deb.nodesource.com/setup_8.x | sudo -E bash -` - - `sudo apt-get install -y nodejs` - -## Curl, Tmux, Unzip, ffmpeg - - `sudo apt-get install curl tmux unzip ffmpeg -y` - -## Grab config files - - `git clone https://github.com/jessopb/speechconfigs.git` - - `chmod 640 -R ~/speechconfigs` - -# 2 Secure the UFW firewall -## UFW - - `sudo ufw status` - - `sudo ufw allow 80` - - `sudo ufw allow 443` - - `sudo ufw allow 22` - - `sudo ufw allow 3333` - - `sudo ufw allow 4444` - - `sudo ufw default allow outgoing` - - `sudo ufw default deny incoming` - - `sudo ufw show added` - - `sudo ufw enable` (yes, you've allowed ssh 22) - - `sudo ufw status` - -# 3 Install Caddy to handle https and reverse proxy -## Get Caddy - - `curl https://getcaddy.com | bash -s personal` - -## Set up Caddy - - `mkdir -p /opt/caddy/logs/` - - `mkdir -p /opt/caddy/store/` - - `cp ~/speechconfigs/caddy/Caddyfile.speechsample ~/speechconfigs/caddy/Caddyfile` - - `nano ~/speechconfigs/caddy/Caddyfile` - ( Change {{EXAMPLE.COM}} to YOURDOMAIN.COM ) - - `cp ~/speechconfigs/caddy/Caddyfile /opt/caddy/` - -## Set up Caddy to run as systemd service - - `cp ~/speechconfigs/caddy/caddy.service /etc/systemd/system/caddy.service` - - `chmod 644 /etc/systemd/system/caddy.service` - - `chown -R www-data:www-data /opt/caddy/` - - `setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy` - - `systemctl daemon-reload` - - `systemctl start caddy` - - `systemctl status caddy` - - At this point, navigating to yourdomain.com should give you a 502 bad gateway error. That's good! - -# 4 Set up MySql - -## Install MySql - - `sudo apt-get install mysql-server -y` - ( enter blank password each time ) - `sudo systemctl status mysql` (q to exit) - -## Secure Setup - - `sudo mysql_secure_installation` - * No to password validation - * Y to all other options - * password abcd1234 - -## Login to mysql from root to complete setup: - - `mysql` to enter mysql> console - - mysql> `ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'abcd1234';` - - mysql> `FLUSH PRIVILEGES;` - - Control+D to exit - - Verify: - - `mysql -u root -p` and then entering your password abcd1234 should give you the mysql> shell - -# 5 Get Lbrynet Daemon - -### TODO: Enable something like sudo systemctl start lbrynet so it runs as www-data - -## Enter tmux - - `tmux` - * Ctrl+b, d detaches leaving session running. - * ~# `tmux`, Ctrl+b, ( goes back to that session. - -## Get the daemon - `wget -O ~/latest_daemon.zip https://lbry.io/get/lbrynet.linux.zip` - - `unzip -o -u ~/latest_daemon.zip` - -## Start the daemon - ~# `./lbrynet start` -## Detatch tmux session - `Control+b, then d` to leave lbrynet daemon running and exit the session - - `tmux` if you want to get back into tmux - - `Control+b, then ) in tmux` to cycle back to your lbrynet session to see output - -## Display wallet address to which to send 5+ LBC. -### These commands work when `lbrynet start` is already running in another tmux - - `./lbrynet commands` to check out the current commands - - `./lbrynet address_list` to get your wallet address - - `Ctrl + Shift + C` after highlighting an address to copy. - - Use a LBRY app or daemon to send LBC to the address. Sending LBC may take a few seconds or longer. - - `./lbrynet account_balance` to check your balance after you've sent LBC. - -# 6 Set up spee.ch -## Clone speech either from your own fork, or from the lbryio/spee.ch repo. - -### Developers - - SSH? - - `git clone git@github.com:{{youraccount}}/spee.ch` - - HTTPS? - - `git clone https://github.com/{{youraccount}}/spee.ch.git` - -### Publishers - - `git clone -b release https://github.com/lbryio/spee.ch` - -## Build it - `cd spee.ch` - - ~/spee.ch# `npm install` - - `cp ~/speechconfigs/speech/chainqueryConfig.json ~/spee.ch/site/config/chainqueryConfig.json` - - ~/spee.ch# `npm run configure` (once your wallet balance has cleared) - * DATABASE: lbry - * USER NAME: root - * PASSWORD: abcd1234 - * PORT: 3000 - * Site Title: Your Site Name - * Enter your site's domain name: https://freezepeach.fun (this must include https://) - * Enter a directory where uploads should be stored: (/home/lbry/Uploads) - - ~/spee.ch/# `npm run start` - -## Try it - - Navigate to yourdomain.fun! - - -### 7 Maintenance Proceedures -* Change wallet - * TODO -* Change daemon - * wget daemon from https://github.com/lbryio/lbry/releases - * wget --quiet -O ~/your_name_daemon.zip https://your_copied_file_path.zip - * rm ./lbrynet - * unzip -o -u ~/your_name_daemon.zip - -### 7 TODO -* Don't run as root -* Use Dockerized Spee.ch and Lbrynet - * https://github.com/lbryio/lbry-docker/tree/master/www.spee.ch - * https://github.com/lbryio/lbry-docker/tree/master/lbrynet-daemon - * https://blog.hasura.io/an-exhaustive-guide-to-writing-dockerfiles-for-node-js-web-apps-bbee6bd2f3c4 - * https://docs.traefik.io/user-guide/docker-and-lets-encrypt/ - * https://docs.traefik.io/configuration/acme/ -* Systemd unit files - * https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/ - * Spee.ch - * sudo nano /lib/systemd/system/speech.service - * Lbrynet - * sudo nano /lib/systemd/system/lbrynet.service - ``` - [Unit] - Description=hello_env.js - making your environment variables read - Documentation=https://example.com - After=network.target - - [Service] - Environment=NODE_PORT=3001 - Type=simple - User=ubuntu - ExecStart=node path/server.js - Restart=on-failure - - [Install] - WantedBy=multi-user.target - ``` -* Provide spee.ch build releases? -* Provide system to configure chainqueryConfig.json -* Clone speech to stripped version, streamline customization -* Automate for testing diff --git a/docs/ubuntuinstall.md b/docs/ubuntuinstall.md index a072d43d..4d4abd58 100644 --- a/docs/ubuntuinstall.md +++ b/docs/ubuntuinstall.md @@ -19,12 +19,12 @@ * Https proxy server * Caddy for personal use * Exposed ports: 22, 80, 443, 3333, 4444 - * Reverse proxies 443 to App on 3000 + * Reverse proxies 80 redirected to 443 to App on 3000 * Spee.ch started on port 3000 * Lbrynet DAEMON started on ports 3333 and 4444 -# 1. Update OS and install packages +# 1. Setup OS and install dependencies ## OS ### Secure your server by creating a non-root sudoer. @@ -59,25 +59,21 @@ Log in as username@domainname or username@ip_address ## Clone speech either from your own fork, or from the lbryio/spee.ch repo. -### For Developers or those with their own forked repo + * For Developers - our master branch + `git clone https://github.com/lbryio/spee.ch` - `git clone -b master https://github.com/lbryio/spee.ch` - - SSH: - - `git clone git@github.com:{{youraccount}}/spee.ch` - - HTTPS: + * For Developers - your fork `git clone https://github.com/{{youraccount}}/spee.ch.git` -### For Publishers and Content creators + `git clone git@github.com:{{youraccount}}/spee.ch` + * For Publishers and Content creators - stable release `git clone -b release https://github.com/lbryio/spee.ch` -### Prepare the scripts +## Prepare the scripts `chmod 750 -R ~/spee.ch/docs/setup` @@ -181,9 +177,9 @@ This just allows you to run multiple things in different sessions. Useful for ma ## Detatch tmux session * `Control + b`, then `d` to leave lbrynet daemon running and exit the session - `tmux` if you want to get back into tmux + * `tmux` if you want to get back into tmux - `Control+b`, then `)` while in tmux session to cycle back to your lbrynet session to see output + * `Control+b`, then `)` while in tmux session to cycle back to your lbrynet session to see output ## Display wallet address to which to send 5+ LBC. @@ -206,28 +202,31 @@ This just allows you to run multiple things in different sessions. Useful for ma # 6 Set up spee.ch ## Build it - `cd spee.ch` + `cd spee.ch` - ~/spee.ch: + ~/spee.ch: - `npm install` + `npm install` - `cp ~/spee.ch/docs/setup/conf/speech/chainqueryConfig.json ~/spee.ch/site/config/chainqueryConfig.json` + _note: if you have installed your own local chainquery instance, you will need to specify it in your own /site/config/chainqueryConfig.json_ + + Once your wallet has a balance, run this: + + `npm run configure` - `npm run configure` (once your wallet balance has cleared) * Database: lbry * Username: root * Password: abcd1234 * Port: 3000 * Site Title: Your Site Name - * Enter your site's domain name: https://freezepeach.fun (this must include 'https://') + * Enter your site's domain name: https://example.com or http://localhost * Enter a directory where uploads should be stored: (/home/lbry/Uploads) `npm run start` ## Try it - Navigate to yourdomain.fun! + Navigate to example.com! # 7 Production diff --git a/fullstart.md b/fullstart.md index fdb96d1c..f6e11758 100644 --- a/fullstart.md +++ b/fullstart.md @@ -25,14 +25,14 @@ $ npm update * Create a config file called `spee.ch` in */etc/nginx/sites-available* * see example: [config file](https://github.com/lbryio/spee.ch/blob/master/nginx_example_config). * Rename all mentions of *sub.domain.com* with your subdomain name. - * Run this command to link the sites-available. + * Run this command to link the sites-available. `$ ln -s /etc/nginx/sites-available/speech /etc/nginx/sites-enabled/speech` * Restart Nginx. - + `$ sudo service nginx restart` - + * Try visiting your website. * If Nginx is working, you should get a **502** error because there is nothing running on **3000** yet. * If you get the default Nginx greeting, you have not properly configured it to serve from port **3000**. @@ -40,29 +40,29 @@ $ npm update * Caddy tutorial: [https://caddyserver.com/tutorial](https://caddyserver.com/tutorial) ### MySql -* Install MySql +* Install MySql * [Instructions](https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en) * Create user **root**. * Note: We are going to access **mysql** as **root** for this setup, but you may want to create a separate user in the future. * Keep your password somewhere handy! * Create a database called **lbry** and make sure you can use it. - + `CREATE DATABASE lbry;` - + `$ USE lbry;` - + `$ exit; (or press ‘ctl + d’)` * Try logging into mysql. - + `$ mysql -u username -p` - + * If you are using a **LBRY** server, your **password** is the one provided for **ssh**. * Note: If it fails, try using `sudo`. ##2. Install & Run the LBRY Daemon -### Install **lbrynet** +### Install **lbrynet** _note: if you have a server from LBRY, lbrynet is already installed, you can skip to 2.4._ ``` $ wget --quiet -O ~/latest_daemon.zip https://lbry.io/get/lbrynet.linux.zip @@ -75,9 +75,9 @@ $ ./lbrynet-daemon ``` ### Detach (exit) the tmux session and leave **lbrynet** running in the background. - + press `ctrl` + `b` then `d` to detach - + ### Get LBC! Get a list of your wallets: @@ -93,7 +93,7 @@ Check your balance again: ``` $ ~/lbrynet-cli wallet_balance ``` - + You should have **LBC**! ### Install ffmpeg @@ -128,10 +128,10 @@ $ npm run configure Check your site configs ``` -$ cd config/ +$ cd /site/config/ $ nano siteConfig.json ``` - + ### Build & run Run the below command to transpile, build, and start your server. @@ -141,15 +141,15 @@ $ npm run start _**Note:** if you had to use `sudo` to login to **mysql** above, you may have issues with this step._ -Spee.ch should now be running ! +Spee.ch should now be running ! Visit your site in the browser. Try publishing an image! ## 4. Bonus: - + ### Install PM2 and run your server with PM2 - + Install PM2 ``` $ sudo npm i -g pm2 @@ -161,14 +161,3 @@ $ pm2 start server.js ``` Visit your site and see if it is running! - -### Sync Your Spee.ch Instance with the full **Blockchain** - -Install **lbrycrdd** - -Install **lbry-decoder** - -Start **lbry-decoder** - -Install & run [spee.ch-sync](https://github.com/billbitt/spee.ch-sync) - -- 2.45.3