Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Latest commit

 

History

History
113 lines (92 loc) · 4.09 KB

README.md

File metadata and controls

113 lines (92 loc) · 4.09 KB

Warning!

This project is no longer mainteined and updated. Please refer to the updated project by clicking on this link.

🇮🇹 Erre2: Raccoglitore (di) Riassunti

Erre2 è un webserver scritto in python che si pone come obiettivo quello di creare una piattaforma gradevole da usare per l'universitario medio sulla quale è possibile caricare e aggiornare riassunti, piuttosto che ritrovarseli sparpagliati nel gruppo universitario. Con Erre2, inoltre, è possibile ricevere notifiche mediante Telegram di aggiornamenti e nuovi arrivi sulla piattaforma, per essere sempre aggiornati e pronti agli esami.

🇬🇧 Erre2: a simple Summary Binder

Erre2 is a webserver written in python that aims to become a comfortable platform to be used by the average university student to gather summaries in a more methodic and organized way than scattered in a Whatsapp group. Erre2 also supports telegram integration: provide your university group chat-id, and Erre2 will tell everyone if a new summary gets uploaded or updated.
If you need a full website translation, please open an issue. I will be more than happy to provide one.


Installation

  1. Clone this repository using git:
    git clone git@github.com:Fermitech-Softworks/Erre2.git
    

For development

  1. Install dependencies using poetry:

    poetry install
  2. Use export to set the required environment variables:

    export COOKIE_SECRET_KEY='qwerty'  # A random string of characters
    # The token for the Telegram notifier bot, get one at https://t.me/BotFather
    export TELEGRAM_BOT_TOKEN='1234567890:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
    # The Telegram chat id where the notifications should be sent, remember that the id of supergroups is prefixed by -100
    export TARGET_CHAT_ID='-100XXXXXXXXXX'
    # The folder where files should be stored
    export UPLOAD_FOLDER='/opt/erre2'
    # The uri of the database to use
    export SQLALCHEMY_DATABASE_URI='postgresql://erre2@/erre2'
  3. Run the flask development server:

    poetry run python -m erre2
    

For production

Assuming you are using a Linux distribution which supports systemd and has apache2 installed.

  1. Create a new venv:

    python -m venv venv
    
  2. activate the venv you just created:

    source venv/bin/activate
  3. Install the package from pip:

    pip install erre2
    
  4. Create the file /etc/systemd/system/web-erre2.service with the following contents:

    [Unit]
    Name=web-erre2
    Description=Erre2 Gunicorn Server
    Wants=network-online.target
    After=network-online.target nss-lookup.target
    
    [Service]
    Type=exec
    User=erre2
    Group=erre2
    # Replace with the directory where you cloned the repository
    WorkingDirectory=/opt/erre2
    # Replace with the directory where you cloned the repository
    ExecStart=/opt/erre2/venv/bin/gunicorn -b 127.0.0.1:30002 erre2.__main__:reverse_proxy_app
    
    [Install]
    WantedBy=multi-user.target
  5. Create the file /etc/systemd/system/web-erre2.service.d/override.conf with the following contents:

    [Service]
    # A random string of characters
    Environment=COOKIE_SECRET_KEY=qwerty
    # The token for the Telegram notifier bot, get one at https://t.me/BotFather
    Environment=TELEGRAM_BOT_TOKEN=1234567890:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    # The Telegram chat id where the notifications should be sent, remember that the id of supergroups is prefixed by -100
    Environment=TARGET_CHAT_ID=-100XXXXXXXXXX
    # The folder where files should be stored
    Environment=UPLOAD_FOLDER=/opt/erre2
    # The uri of the database to use
    Environment=SQLALCHEMY_DATABASE_URI=postgresql://erre2@/erre2
  6. Reload all systemd daemon files:

    systemctl daemon-reload
    
  7. start (and optionally enable to run at boot) the web-erre2 systemd service:

    systemctl start web-erre2
    systemctl enable web-erre2
    
  8. Configure a reverse proxy (apache2, nginx, ...) to proxy requests to and from 127.0.0.1:30002.