Merge branch 'dev-indep' of https://github.com/pluja/Parasitter into dev-indep

This commit is contained in:
pluja 2020-09-05 10:39:24 +02:00
commit 0ddf19534a
2 changed files with 58 additions and 28 deletions

View File

@ -11,7 +11,7 @@ Yotter allows you to follow and gather all the content from your favorite Twitte
Yotter is possible thanks to several open-source projects that are listed on the [Powered by](#powered-by) section. Make sure to check out those awesome projects! Yotter is possible thanks to several open-source projects that are listed on the [Powered by](#powered-by) section. Make sure to check out those awesome projects!
## Index: # Index:
* [Why](#why) * [Why](#why)
* [Features](#features) * [Features](#features)
* [Screenshots](#screenshots) * [Screenshots](#screenshots)
@ -27,12 +27,12 @@ Yotter is possible thanks to several open-source projects that are listed on the
* [Powered by](#powered-by) * [Powered by](#powered-by)
* [Donate](#donate) * [Donate](#donate)
## Why # Why
At first I started working on this project as a solution for following Twitter accounts (a thing that can't be done with Nitter) and getting a Twitter-like feed. Weeks later the leader of Invidious, Omar Roth, announced that he was stepping away from the project. As an Invidious active user, this made me think that a new alternative was needed for the community and also an alternative with an easier language for most people (as Invidious is written in Crystal). So I started developing a 'written-in-python Invidious alternative' and it went quite well. At first I started working on this project as a solution for following Twitter accounts (a thing that can't be done with Nitter) and getting a Twitter-like feed. Weeks later the leader of Invidious, Omar Roth, announced that he was stepping away from the project. As an Invidious active user, this made me think that a new alternative was needed for the community and also an alternative with an easier language for most people (as Invidious is written in Crystal). So I started developing a 'written-in-python Invidious alternative' and it went quite well.
I hope that this project can prosperate, gain contributors, new instances and create a good community around it. I hope that this project can prosperate, gain contributors, new instances and create a good community around it.
## Features: # Features:
- [x] No Ads. - [x] No Ads.
- [x] No JavaScript. - [x] No JavaScript.
- [x] Minimalist. - [x] Minimalist.
@ -40,13 +40,14 @@ I hope that this project can prosperate, gain contributors, new instances and cr
- [x] Zero connections to Google/Twitter on the client. - [x] Zero connections to Google/Twitter on the client.
- [x] Follow Twitter accounts. - [x] Follow Twitter accounts.
- [x] Follow Youtube accounts. - [x] Follow Youtube accounts.
- [x] Play Youtube videos on background on Android.
- [x] Save your favourite Tweets. - [x] Save your favourite Tweets.
- [x] Tor-friendly. - [x] Tor-friendly.
- [x] Terminal-browser friendly. - [x] Terminal-browser friendly.
> And many more to come! > And many more to come!
## Privacy # Privacy
#### Connections #### Connections
Yotter cares about your privacy, and for this it will never make any connection to Twitter or Youtube on the client. Every request is proxied through the Yotter server; video streaming, photos, data gathering, scrapping, etc. Yotter cares about your privacy, and for this it will never make any connection to Twitter or Youtube on the client. Every request is proxied through the Yotter server; video streaming, photos, data gathering, scrapping, etc.
@ -71,20 +72,16 @@ I always recommend self-hosting, as you will be the only person with access to t
> Important note: The **client** never connects to Google / Youtube however, the server does in order to gather all the necessary things! > Important note: The **client** never connects to Google / Youtube however, the server does in order to gather all the necessary things!
#### Others # Public Instances
If you want to use a specific Nitter instance you can replace it on the file `app/routes.py`.
## Public Instances
| name |server location|registrations?| | name |server location|registrations?|
| ------------ | ------------ | ------------ | | ------------ | ------------ | ------------ |
| [yotter.xyz](https://yotter.xyz/) |Germany|Open| | - |Germany|Open|
## Self hosting # Self hosting
### Test ## Local
You can test this new version.
##### IMPORTANT: Connections to googlevideo will be made to stream the videos. It is recommended to use a VPS server or a VPN to preserve your privacy. This version is intended for a remote server. ##### IMPORTANT: Connections from the server to googlevideo will be made to stream the videos. It is recommended to use a VPN to preserve your privacy. Understand that the best way of using Yotter is [running on a remote server](#hosting-on-a-server).
1. Install `python3`, `pip3`, `python3-venv` (optional) and `git`. 1. Install `python3`, `pip3`, `python3-venv` (optional) and `git`.
@ -119,7 +116,7 @@ You can test this new version.
9. Go to "http://localhost:5000/" and enjoy. 9. Go to "http://localhost:5000/" and enjoy.
### Using Docker: ## Using Docker:
##### Building using the Dockerfile ##### Building using the Dockerfile
> (May not work on Windows) > (May not work on Windows)
@ -149,11 +146,11 @@ You can test this new version.
3. Go to "http://localhost:5000/" and enjoy. 3. Go to "http://localhost:5000/" and enjoy.
### 🔗 Hosting on a server: ## Hosting on a server:
#### [VISIT THIS FILE FOR INSTRUCTIONS](https://github.com/pluja/Yotter/blob/dev-indep/SELF-HOSTING.md) #### [VISIT THIS FILE FOR INSTRUCTIONS](https://github.com/pluja/Yotter/blob/dev-indep/SELF-HOSTING.md)
### Updating to newer versions: ## Updating to newer versions:
**IMPORTANT: Before updating to newer versions, always export your data on `Settings>Export Data`. A major version update could have changes on the whole database and you may be forced to remove and reset the database (only when running locally)!** **IMPORTANT: Before updating to newer versions, always export your data on `Settings>Export Data`. A major version update could have changes on the whole database and you may be forced to remove and reset the database (only when running locally)!**
1. Navigate to the git repository (the one you cloned when installing). 1. Navigate to the git repository (the one you cloned when installing).
@ -173,14 +170,14 @@ You can test this new version.
6. Done! You are on latest version. 6. Done! You are on latest version.
> **See [CHANGELOG](CHANGELOG.md) for a list of changes.** > **See [CHANGELOG](CHANGELOG.md) for a list of changes.**
### Configure the server ## Configure the server
You will find in the root folder of the project a file named `yotter-config.json`. This is the global config file for the Yotter server. You will find in the root folder of the project a file named `yotter-config.json`. This is the global config file for the Yotter server.
Currently available config is: Currently available config is:
* **nitterInstance**: Nitter instance that will be used when fetching Twitter content. Format must be `**https://**<NitterInstance.tld>**/**` * **nitterInstance**: Nitter instance that will be used when fetching Twitter content. Format must be `**https://**<NitterInstance.tld>**/**`
* **maxInstanceUsers**: Max users on the instance. When set to `0` it closes registrations. * **maxInstanceUsers**: Max users on the instance. When set to `0` it closes registrations.
## Powered by: # Powered by:
* [Nitter](https://nitter.net/) * [Nitter](https://nitter.net/)
* [youtube-dl](https://github.com/ytdl-org/youtube-dl) * [youtube-dl](https://github.com/ytdl-org/youtube-dl)
* [Flask](https://flask.palletsprojects.com/) * [Flask](https://flask.palletsprojects.com/)
@ -191,7 +188,7 @@ Currently available config is:
* [Video.js](https://videojs.com/) * [Video.js](https://videojs.com/)
* [My fork of youtube_search](https://github.com/pluja/youtube_search-fork) * [My fork of youtube_search](https://github.com/pluja/youtube_search-fork)
## Donate # Donate
This project is completely free and Open Source and will always be. This project is completely free and Open Source and will always be.
Funding will be used 100% for opening and mantaining an online public instance of Yotter, this will be hosted on Netcup and will (at first) be the *VPS 500 G8*. I mention all of this in case you want to check the prices. Funding will be used 100% for opening and mantaining an online public instance of Yotter, this will be hosted on Netcup and will (at first) be the *VPS 500 G8*. I mention all of this in case you want to check the prices.

View File

@ -1,11 +1,30 @@
<a href="https://github.com/pluja/Yotter"><img alt="Installation Working" src="https://img.shields.io/badge/Status-Working 2020.09.05-green.svg"></img></a> <a href="https://github.com/pluja/Yotter"><img alt="Installation Working" src="https://img.shields.io/badge/Status-Working 2020.09.05-green.svg"></img></a>
<a href="https://github.com/pluja/Yotter"><img alt="Tested on Ubuntu" src="https://img.shields.io/badge/Tested On-Ubuntu Server 20.04LTS-blue.svg"></img></a> <a href="https://github.com/pluja/Yotter"><img alt="Tested on Ubuntu" src="https://img.shields.io/badge/Tested On-Ubuntu Server 20.04LTS-blue.svg"></img></a>
> Using the `root` user is not recommended for this installation. # Why should I self host?
Self-hosting gives you the whole power over the service and the data. You can set up a server for your own personal use or share it with friends and family. Or, why not go further and share it with the whole world?
#### Step 1: Base setup When you self-host you make internet stronger and more censorship resistant. If one Yotter instance goes down for any reason, there will be all other instances online and ready to host new users.
## 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 up to 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.
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 server 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
```
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. 1. Connect to your server via SSH or direct access.
* (Recommended) Set up password-less login with ssh-keys. - [x] (Recommended) Set up password-less login with ssh-keys.
2. Install base dependencies: 2. Install base dependencies:
* `sudo apt-get -y update` * `sudo apt-get -y update`
@ -31,7 +50,7 @@
* `pip install cryptography` * `pip install cryptography`
* `pip install -r requirements.txt` * `pip install -r requirements.txt`
> You can edit the `yotter-config` file > You can edit the `yotter-config.json` file
5. Install gunicorn (production web server for Python apps) and pymysql: 5. Install gunicorn (production web server for Python apps) and pymysql:
`pip install gunicorn pymysql` `pip install gunicorn pymysql`
@ -42,14 +61,15 @@
* `flask db upgrade` * `flask db upgrade`
7. Set up `.env` 7. Set up `.env`
1. (PRE) Generate a random string and copy it to clipboard: 1. (PRE) Generate a **random string** and copy it to clipboard:
`python3 -c "import uuid; print(uuid.uuid4().hex)"` `python3 -c "import uuid; print(uuid.uuid4().hex)"`
2. Create a `.env` file on the root folder of the project (`/home/ubuntu/Yotter/.env`): 2. Create a `.env` file on the root folder of the project (`/home/ubuntu/Yotter/.env`):
``` ```
SECRET_KEY=<RandomStringHere!> SECRET_KEY=<RandomString>
DATABASE_URL=mysql+pymysql://yotter:<db-password>@localhost:3306/yotter DATABASE_URL=mysql+pymysql://yotter:<db-password>@localhost:3306/yotter
``` ```
Make sure you change `<RandomString>` and `>db-password>`. `<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.
#### Step 2: Setting up the MySQL Database: #### Step 2: Setting up the MySQL Database:
* Open the MySQL prompt line (Use the previously set MySQL root password!) * Open the MySQL prompt line (Use the previously set MySQL root password!)
@ -61,7 +81,7 @@ Now you should be on the MySQL prompt line (`mysql>`). So let's create the datab
> Change `<db-password>` for a password of your like. It will be the password for the dabase user `yotter`. Don't choose the same password as the root user of MySQL for security. > Change `<db-password>` for a password of your like. It will be the password for the dabase user `yotter`. Don't choose the same password as the root user of MySQL for security.
> The password `<db-password` for the **yotter** user needs to match the password that you included in the `DATABASE_URL` variable in the `.env` file. If you didn't change it, you can change it now. > The password `<db-password>` for the **yotter** user needs to match the password that you included in the `DATABASE_URL` variable in the `.env` file. If you want to change it, you can change it now.
``` ```
mysql> create database yotter character set utf8 collate utf8_bin; mysql> create database yotter character set utf8 collate utf8_bin;
@ -78,10 +98,12 @@ If your set up was correct, you should now be able to run:
#### Step 3: Setting up Gunicorn and Supervisor #### Step 3: Setting up Gunicorn and Supervisor
When you run the server with flask run, you are using a web server that comes with Flask. This server is very useful during development, but it isn't a good choice to use for a production server because it wasn't built with performance and robustness in mind. Instead of the Flask development server, for this deployment I decided to use gunicorn, which is also a pure Python web server, but unlike Flask's, it is a robust production server that is used by a lot of people, while at the same time it is very easy to use. [ref](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvii-deployment-on-linux) When you run the server with flask run, you are using a web server that comes with Flask. This server is very useful during development, but it isn't a good choice to use for a production server because it wasn't built with performance and robustness in mind. Instead of the Flask development server, for this deployment I decided to use gunicorn, which is also a pure Python web server, but unlike Flask's, it is a robust production server that is used by a lot of people, while at the same time it is very easy to use. [ref](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvii-deployment-on-linux)
* Start yotter under Gunicorn: * Start yotter under Gunicorn and check it has no errors:
`gunicorn -b localhost:8000 -w 4 yotter:app` `gunicorn -b localhost:8000 -w 4 yotter:app`
Once you see that no errors appear, you can stop gunicorn by pressing `Ctrl+C`.
The supervisor utility uses configuration files that tell it what programs to monitor and how to restart them when necessary. Configuration files must be stored in /etc/supervisor/conf.d. Here is a configuration file for Yotter, which I'm going to call yotter.conf [ref](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvii-deployment-on-linux). The supervisor utility uses configuration files that tell it what programs to monitor and how to restart them when necessary. Configuration files must be stored in /etc/supervisor/conf.d. Here is a configuration file for Yotter, which I'm going to call yotter.conf [ref](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvii-deployment-on-linux).
* Create a yotter.conf file on `/etc/supervisor/conf.d/`: * Create a yotter.conf file on `/etc/supervisor/conf.d/`:
@ -130,4 +152,15 @@ server {
* Run `sudo service nginx reload` * Run `sudo service nginx reload`
[Follow this instructions to install certbot and generate an ssl certificate](https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx) [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)
## Updating the server
Updating the server should always be pretty easy:
```
(venv) $ git pull
(venv) $ sudo supervisorctl stop yotter
(venv) $ flask db upgrade
(venv) $ pip install -r requirements.txt
(venv) $ sudo supervisorctl start yotter
```