diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b32a80..2f87682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,12 @@ - Play tweet videos from Parasitter. - Create following lists. -## [0.2.4] - 2020.09.06 +## [0.2.4] - 2020.09.07 ### Changed - [x] Remove non implemented settings from settings page. - [x] Changed video streaming chunk size. +- [x] Video streaming now has a smaller load for the server. +- [x] Video streaming is (a bit) more efficient - YoutubeDL executed on /watch instead. ### Added - [x] Add instance info on settings page. diff --git a/SELF-HOSTING.md b/SELF-HOSTING.md index 0241896..7c324bc 100644 --- a/SELF-HOSTING.md +++ b/SELF-HOSTING.md @@ -8,22 +8,28 @@ When you self-host you make internet stronger and more censorship resistant. If ## Pre-Installation -You will need a server of your own, or you can rent a VPS server on any service you like. Minimum requirements for about 15 users are 2GB of RAM and a Linux Server. It is better if the server is dedicated as whole to Yotter as it will improve performance and security. +You will need a server of your own, or you can rent a VPS server on any service you like. Minimum requirements for about 20 users are 2GB of RAM and a Linux Server. It is better if the server is dedicated as whole to Yotter as it will improve performance and security. + +Everything that appears between `` needs to be changed by you. So for example if you see `` you should change it for `weakDummyPassword` without keeping the ``. First of all, you will need to set up a new user on the server. For security reasons you should never use a `root` user to set up a service. If you already have a non-root user you can use that one and skip the following steps. We will create a user named `ubuntu` as I will be setting this up on an ubuntu machine. So, if you choose a different username make sure you replace it on future commands. We will create and login to the user as follows: ``` -$ adduser --gecos "" ubuntu -$ usermod -aG sudo ubuntu -$ su ubuntu +# adduser --gecos "" ubuntu +# usermod -aG sudo ubuntu +# su ubuntu +$ cd ``` +If you now type `pwd` and hit enter, you shuould see that the current path is `/home//` + Now you should be logged in. Make sure to set up a good password. It is recommended to use ssh keys to log-in remotelly and disable the password login on all users. ### Step 1: Base setup 1. Connect to your server via SSH or direct access. + - `ssh ubuntu@` - [x] (Recommended) Set up password-less login with ssh-keys. 2. Install base dependencies: @@ -33,9 +39,9 @@ Now you should be logged in. Make sure to set up a good password. It is recommen * `sudo apt-get -y install mysql-server supervisor nginx git` -> When installing MySQL-server it will prompt for a root password. Set up a password of your like, this will be the MySQL databases master password and will be required later, so don't forget it! +> When installing MySQL-server it will prompt for a root password. This is the password for the root user of MySQL. Set up a password of your like, this will be the MySQL databases master password and will be required later, so don't forget it! -> If after the MySQL-server installation you have not been prompted a password for the `root` user, run `sudo mysql_secure_installation` +If after the MySQL-server installation you have not been prompted to create a password for the `root` user, run `sudo mysql_secure_installation` 3. Clone this repository and acccess folder: * `git clone https://github.com/pluja/Yotter` @@ -69,13 +75,15 @@ Now you should be logged in. Make sure to set up a good password. It is recommen SECRET_KEY= DATABASE_URL=mysql+pymysql://yotter:@localhost:3306/yotter ``` -Make sure you change `` and `>db-password>`. `` should be different from the password of the database root user (the one you set up on step 1.2). This password will be needed later. +Make sure you change `` for the previously generated random string. You can paste it as is, without any `"" or ''`. Also change ``. `` should be different from the password of the database root user (the one you set up on step 1.2). This password will be needed later. #### Step 2: Setting up the MySQL Database: * Open the MySQL prompt line (Use the previously set MySQL root password!) `mysql -u root -p` -> If you have problems with the root password try running `sudo mysql` and then run this query: `ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_PASSWORD';`. This changes the password for the user `root` by `YOUR_PASSWORD` +> Note that you are being prompted for the password of the MySQL root user, the one you set up on step 1.2, not the password you wrote on the `.env` file. The password on the `.env` is the password for the MySQL Yotter database. + +> If you still have problems with the root user password try running `sudo mysql` and then run this query: `ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';`. This changes the password for the MySQL user `root` by `` Now you should be on the MySQL prompt line (`mysql>`). So let's create the databases: @@ -144,18 +152,24 @@ server { location /static { # handle static files directly, without forwarding to the application - alias /home/ubuntu/Yotter/app/static; + alias /Yotter/app/static; expires 30d; } } ``` +Make sure to replace `` by the domain you are willing to use for your instance (i.e example.com). -* Run `sudo service nginx reload` +You will also need to change the `` after `alias` to fit your system. You have to point to the Yotter folder, in this set up it would be `/home/ubuntu` as it is the location where we cloned the Yotter app. This alias is created to handle static files directly, without forwarding to the application. +Once done, you can run `sudo service nginx reload` + +Now you need to install an SSL certificate on your server so you can use HTTPS: [Follow this instructions to install certbot and generate an ssl certificate so your server can use HTTPS](https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx) +> Note that you will have to create an 'A Record' on the DNS of your domain to point to the IP of your server. + ## Updating the server -Updating the server should always be pretty easy: +Updating the server should always be pretty easy. These steps need to be run on the Yotter folder and with the python virtual env activated. ``` (venv) $ git pull