There are two installation guides, development and production. Both guides were tested on Ubuntu Server 18.04.
- Install system dependencies:
sudo apt install python3 python3-dev python3-venv git build-essential - Install latest LTS version of NodeJS:
- Download and extract archive
cd ~wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xztar -xJf node-v10.15.3-linux-x64.tar.xzmv node-v10.15.3-linux-x64 node
- Create and apply symlinks to Node commands
mkdir ~/bincd binln -s ~/node/bin/nodeln -s ~/node/bin/npm
- Apply profile config and check Node and NPM versions
cd ~source .profilenode -vnpm -v
- Download and extract archive
- Create Python virtual environment and install project requirements:
cd ~/hexchan-enginepython3 -m venv python_modulessource python_modules/bin/activatepip install --upgrade pippip install -r requirements.txt
- Install project's NodeJS dependencies:
cd ~/hexchan-enginenpm install
- Create development storage directories:
cd ~/hexchan-engine/generatorspython dirmaker.py
- Create SQLite database and apply migrations:
cd ~/hexchan-engine/src./manage.py migrate
- Create superuser
cd ~/hexchan-engine/src./manage.py createsuperuser
- Generate a pool of 100 CAPTCHAs:
cd ~/hexchan-engine/src./manage.py makecaptchas 100
- Build frontend:
cd ~/hexchan-engine./build_frontend.sh
- This step is optional, take it if you want to prepopulate your installation with some fake content:
cd ~/hexchan-engine/generators- You'll need a directory with some images.
If you don't have one, you can install
ubuntu-wallpaperssystem package. This script will collect images' data into JSON file and generate thumbnails for them. Image data will be used later to generate fake threads and posts.python imagemaker.py /usr/share/backrounds
- Generate fake posts with random Latin text and images. It can take a while.
python partymaker.py
-
cd ~/hexchan-engine/src./manage.py loaddata boards threads posts images
- Run dev server:
cd ~/hexchan-engine/src./manage.py runserverOpen http://localhost:8000 in your browser. You can login as superuser at http://localhost:8000/admin
There is no production-ready installation package yet, you're expected to know about configuring Django applications. Manual assembly is required, batteries are not encluded.
This guide describes configuring Hexchan Engine with Apache and PostgreSQL. Other combinations of web server and database are supported by Django framework.
Useful links:
- https://docs.djangoproject.com/en/2.2/topics/settings/
- https://docs.djangoproject.com/en/2.2/howto/deployment/
- https://docs.djangoproject.com/en/2.2/ref/databases/
- Repeat steps 1-5 from the development guide, you may change install directories accordingly. Creating new system user and installing project into it's home directory is recommended.
- Install Apache with mod_wsgi and PostgreSQL:
sudo apt install apache2 libapache2-mod-wsgi-py3 postgresql - Create new Postgres user and database:
sudo -u postgres psqlcreate database hexchan;create user hexuser with password 'password';alter role hexuser set client_encoding to 'utf8';alter role hexuser set default_transaction_isolation to 'read committed';alter role hexuser set timezone to 'utc';grant all privileges on database hexchan to hexuser;\q
- Create storage dirs and move them to new location:
cd ~/hexchan-engine/generatorspython dirmaker.pycd ~mv ~/hexchan-engine/dev ~/hexchan-storage
- Create copies of config file and WSGI script:
cd ~/hexchan-engine/src/hexchancp settings.py settings_prod.pycp wsgi.py wsgi_prod.py
- Edit
settings.py:- Change
STORAGE_DIRto the relative path of your storage dir - Set
DEBUGtoFalse - Set
SECRET_KEYto a large random sting - Add your domain to
ALLOWED_HOSTS - Set WSGI_APPLICATION to 'hexchan.wsgi_prod.application'
- Setup database:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'hexchan', 'USER': 'hexuser', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': '', } }
- Change