1
0

An internet relay chat robot and web-based graphical user interface, dance event, and other things mashed together

tBKwtWS 4f21f6bdcb bugfixes 6 жил өмнө
rotbot 4f21f6bdcb bugfixes 6 жил өмнө
website 67f318afcd migrations 6 жил өмнө
.gitignore 3cc6c950bf .local_settings gitignore 6 жил өмнө
README.md a4ac5389ff bugfixes 6 жил өмнө
package.json a4ac5389ff bugfixes 6 жил өмнө
requirements.txt 130ed4c209 requirements 6 жил өмнө
semantic.json 48342d35e8 a bunch of work 6 жил өмнө
uwsgi_params 5d3c043e1c webserver stuff 6 жил өмнө
website_nginx.conf 6cc6516a42 nginx ssl 6 жил өмнө
website_uwsgi.ini abed9b53fd miroring 6 жил өмнө

README.md

Scope

Django project, without virtual environment.

Hint, to create a virtualenv in the current dir: virtualenv --python=python3.7 . This probably requires you to have built python3.7 manually and have debian packages installed: python3-virtualenv python-virtualenv

Then activate the virtenv: source bin/activate To later deactive: deactivate

Get started

Prerequisites

Python 3.7.4

Older versions might work, development environ and runtime environment run Python-3.7.4 Currently newer then in the repo's, if that's still the case, you might have to compile and built it yourself.

If you notice you can' t use ssl when using pip, you should have installed libssl-dev before building python, or any of the following packages: libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

System packages needed for psycopg2

Install either postgresql-server-dev-X.Y or libpq-dev: sudo apt install...

Download the project files.

  1. git clone ssh://h0v1n8.nl/srv/git/h0v1n8-website.git

Python packages

Install required pyton packages: pip3 install -r requirements.txt

Postgres database with user.

Fill in the passwords, don't change the database name, it's hardcoded in pyRot, for now.

  1. sudo apt install postrgresql
  2. sudo su - postgresql
  3. psql
  4. `CREATE ROLE website WITH LOGIN PASSWORD '';
  5. CREATE DATABASE website WITH OWNER = website;
  6. CREATE ROLE pyrot WITH LOGIN PASSWORD '';
  7. GRANT ALL ON DATABASE website TO pyrot;
  8. Connect to database website
  9. GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO pyrot;
  10. GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO pyrot;

Configuration

  1. Set the database authentication details in the following file, for the robot: rotbot/bot.py
  2. Create file website/website/local_settings.py and fill in the key and password:

    # SECURITY WARNING: keep the secret key used in production secret!
    SECRET_KEY = ''
    
    # SECURITY WARNING: don't run with debug turned on in production!
    DEBUG = True
    
    ALLOWED_HOSTS = ['*']
    
    
    # Database
    # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
    
    DATABASES = {
    # 'default': {
    #     'ENGINE': 'django.db.backends.sqlite3',
    #     'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    # }
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'website',
        'USER': 'website',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
    }
    

Create the database tables, static files and superuser.

  1. cd website
  2. python manage.py makemigrations
  3. python manage.py migrate
  4. python manage.py collectstatic
  5. python manage.py createsuperuser

uwsgi

  1. sudo ln -s /opt/h0v1n8-website-env/website_uwsgi.ini /etc/uwsgi/vassals/website_uwsgi.ini
  2. sudo nano /etc/rc.local:

    #!/bin/sh
    
    /opt/h0v1n8-env/bin/uwsgi --emperor /etc/uwsgi/vassals/ --daemonize /var/log/uwsgi-emperor.log`
    
    exit 0
    

Test with: bin/uwsgi --emperor /etc/uwsgi/vassals/ TBD /etc/rc.local:

Nginx configuration

  1. See if you to change STATIC_ROOT in website/website/settings.py.
  2. sudo ln -s /opt/h0v1n8-website-env/website_nginx.conf /etc/nginx/sites-enabled/website_nginx.conf
  3. sudo systemctl reload nginx

Testing the project.

webgui

  1. cd website
  2. python manage.py runserver

Running the project

pyRot

The pythonic version of RotBot, there have been 5 earlier versions including winRot and javaRot.

  1. cd rotbot
  2. python bot.py 1 Where 1 is the ID of the server database record. Tip: Run it in a "screen".

h0v1n8 website

  1. sudo systemctl start rc-

Updating

  1. git pull 1.

Edeting the look of the webgui

Build Fomatic-ui 2.7.8

Requirements: NodeJS 10.15.3 & NPM 6.4.1

On debian: sudo apt install npm

chart.js

  1. cd website
  2. npm install chart.js --save