spee.ch/fullstart.md

175 lines
3.8 KiB
Markdown
Raw Normal View History

2018-08-10 00:39:32 +02:00
# Create Your Own Spee.ch!
## 1. Prerequisites
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
### You will need the following tools installed
2019-03-18 04:13:00 +01:00
- Node (v8 LTS).
- Make sure you install from the **Node** website [link](https://nodejs.org/en/download/).
- npm (should come installed with Node).
- Git
- Curl
- Tmux
- Unzip
2018-08-10 00:39:32 +02:00
### Make sure **npm** is up-to-date.
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
```
$ npm update
```
### Setup a Webserver to serve **Spee.ch** from Port **3000**.
2019-03-18 04:13:00 +01:00
- If you are using a server provided by **lbry**, we will have **caddy** installed already.
- If you are using your own server, make sure to have a web server installed and set up to serve from port **3000**.
- Nginx instructions (recommended).
- Insert directions for certbot before installing.
- Install [Nginx](http://nginx.org/en/docs/install.html).
- 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.
2018-08-10 00:39:32 +02:00
`$ ln -s /etc/nginx/sites-available/speech /etc/nginx/sites-enabled/speech`
2019-03-18 04:13:00 +01:00
- Restart Nginx.
2018-11-12 19:53:29 +01:00
2018-08-10 00:39:32 +02:00
`$ sudo service nginx restart`
2018-11-12 19:53:29 +01:00
2019-03-18 04:13:00 +01:00
- 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**.
- You can find logs in _/var/log/nginx/_ too.
- Caddy tutorial: [https://caddyserver.com/tutorial](https://caddyserver.com/tutorial)
2018-08-10 00:39:32 +02:00
### MySql
2019-03-18 04:13:00 +01:00
- 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.
2018-11-12 19:53:29 +01:00
2019-03-18 04:13:00 +01:00
`CREATE DATABASE lbry;`
2018-11-12 19:53:29 +01:00
2019-03-18 04:13:00 +01:00
`$ USE lbry;`
2018-11-12 19:53:29 +01:00
2019-03-18 04:13:00 +01:00
`$ exit; (or press ctl + d)`
2018-08-10 00:39:32 +02:00
2019-03-18 04:13:00 +01:00
- Try logging into mysql.
2018-11-12 19:53:29 +01:00
2019-03-18 04:13:00 +01:00
`$ mysql -u username -p`
2018-11-12 19:53:29 +01:00
2019-03-18 04:13:00 +01:00
- If you are using a **LBRY** server, your **password** is the one provided for **ssh**.
- Note: If it fails, try using `sudo`.
2018-08-10 00:39:32 +02:00
2019-03-18 04:13:00 +01:00
##2. Install & Run the LBRY Daemon
2018-08-10 00:39:32 +02:00
2018-11-12 19:53:29 +01:00
### Install **lbrynet**
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
_note: if you have a server from LBRY, lbrynet is already installed, you can skip to 2.4._
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
```
2019-03-18 04:13:00 +01:00
$ wget --quiet -O ~/latest_daemon.zip https://lbry.com/get/lbrynet.linux.zip
2018-08-10 00:39:32 +02:00
$ unzip -o -u "~/latest_daemon.zip"
```
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
### Start lbrynet
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
```
$ tmux
$ ./lbrynet-daemon
```
### Detach (exit) the tmux session and leave **lbrynet** running in the background.
2018-11-12 19:53:29 +01:00
2018-08-10 00:39:32 +02:00
press `ctrl` + `b` then `d` to detach
2018-11-12 19:53:29 +01:00
2018-08-10 00:39:32 +02:00
### Get LBC!
Get a list of your wallets:
```
$ ~/lbrynet-cli wallet_list
```
Send some LBC to one of the addresses from your wallet.
Check your balance again:
```
$ ~/lbrynet-cli wallet_balance
```
2018-11-12 19:53:29 +01:00
2018-08-10 00:39:32 +02:00
You should have **LBC**!
2018-08-10 00:46:11 +02:00
### Install ffmpeg
directions: [here](https://www.ffmpeg.org/download.html)
2019-03-18 04:13:00 +01:00
## 3. Set up Spee.ch
2018-08-10 00:39:32 +02:00
### Clone the spee.ch repo
```
$ git clone https://github.com/lbryio/www.spee.ch.git
```
Change directory into your sites folder
```
$ cd <name-of-your-site>` or `$ cd www.spee.ch
```
Install dependencies
```
$ npm install
```
Run the config cli:
```
$ npm run configure
```
Check your site configs
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
```
2018-11-12 19:53:29 +01:00
$ cd /site/config/
2018-08-10 00:39:32 +02:00
$ nano siteConfig.json
```
2018-11-12 19:53:29 +01:00
2018-08-10 00:39:32 +02:00
### Build & run
Run the below command to transpile, build, and start your server.
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
```
$ npm run start
```
_**Note:** if you had to use `sudo` to login to **mysql** above, you may have issues with this step._
2018-11-12 19:53:29 +01:00
Spee.ch should now be running !
2018-08-10 00:39:32 +02:00
Visit your site in the browser. Try publishing an image!
## 4. Bonus:
2018-11-12 19:53:29 +01:00
2018-08-10 00:39:32 +02:00
### Install PM2 and run your server with PM2
2018-11-12 19:53:29 +01:00
2018-08-10 00:39:32 +02:00
Install PM2
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
```
$ sudo npm i -g pm2
```
From inside your projects folder, start your server with PM2.
2019-03-18 04:13:00 +01:00
2018-08-10 00:39:32 +02:00
```
$ pm2 start server.js
```
Visit your site and see if it is running!