Skip to content

trickstok/app

Repository files navigation

StateDEV LicenceCeCILL v2.1 Versiona+0.0 DiscordClosed

Tricks Tok

The Tiktok of Trick

This project is available at trickstok.tk

Developers

Please note that all scripts need to be executed at project root !

Self-host:

All basics scripts are in Makefile...

Warning ! For https support you need certificate.pem and privatekey.pem at project root directory

install:
Install dependencies and configure TricksTok

make install

After make install you need to refactor config.auto.ini -> config.ini and change values (config reference) !'

run:
Run TricksTok, in development mode, you can add -https for https support.

make run[-https]

deploy:
Build and run TricksTok, in a production mode, you can add -https for https support.

make deploy[-https]

install-service:
Install the service file, to make TricksTok start at boot, Execute after make install

make install-service

You can configure start script in script/start.sh, default it execute make deploy


For advanced deployment with multiple instances and a load balancer you can use script/generate_instances.

This script will create config file for each instance and load_balancer rules.

It will also create instances/start_all.sh that will start every instance and the loadbalancer at the same time. You can move this start_all.sh file in scripts/start.sh and execute make install-service to make every instance and load balancer start at boot.

options:

--number_of_instances=5 # REQUIRED, number of configurations instances wanted

--config=/path/to/sampleconfig.ini # Sample config file, with secret, db logins, mailserver... (default to config.ini)

--ports=20,10,30 # comma separated numbers, they will be used to run instance (default to auto)

--generate_load_balancer_rules=yes/no # Tell script if you want to generate load balancer rules for created instances (default to yes)

--load_balancer_port=8080 # On which port load balancer should run (default to 8080)

--start_cmd=python3 main.py # The start cmd for instance, you can add --secure or --debug options (default to python3 main.py)

Execute script:

python3 scripts/generate_instances --number_of_instances=3 [options]

Configuration file reference

Here is the required config.ini file:

config.ini

[App]
DB_USER=user
DB_PASSWORD=userpassword
DB_URL=your.mongo.server/?retryWrites=true&w=majority
SECRET=secretrandomstring
MAILSERVER=192.168.1.141
MAILING_LISTS=test,other
PORT=10000

DB_*:
DB_* field are required to connect with a mongodb database;
DB_USER: username
DB_PASSWORD: password for username
DB_URL: url to your mongodb server

Mongodb database need a database named trickstok and the following collections: comments,mailing,reports,users,videos,views

SECRET:
SECRET is a random string used as a salt to encode passwords et enforce security, put whatever you want.

MAILSERVER:
MAILSERVER is an ip where a mailserver is running (with no creds needed to send mails), you can use mailproxy.

MAILING_LIST:
MAILING_LIST is a comma separated lists of mails, not very useful for self-host, it's useful when you make a newsletter on landing page or something like that... You can keep the default configuration nothing will change...

PORT:
PORT is on which port TricksTok will run, choose the one you want.