Add scripts for production, README
This commit is contained in:
5
Makefile
5
Makefile
@@ -2,11 +2,14 @@ PYTHON = python3
|
||||
FLASK = flask
|
||||
SQLITE = sqlite3
|
||||
|
||||
default: test
|
||||
default: install
|
||||
|
||||
test::
|
||||
test/all.sh
|
||||
|
||||
install:: venv
|
||||
. ./venv/bin/activate && pip3 install -r requirements.txt
|
||||
|
||||
venv:
|
||||
$(PYTHON) -m venv $@
|
||||
|
||||
|
||||
26
README.md
Normal file
26
README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Agreper - minimal, no-JS forum software
|
||||
|
||||
Agreper is a forum board with a focus on being easy to set up and manage.
|
||||
|
||||
## Features
|
||||
|
||||
## Install & running
|
||||
|
||||
### Linux
|
||||
|
||||
First clone or [download the latest release](todo).
|
||||
|
||||
Then setup with:
|
||||
|
||||
```
|
||||
make
|
||||
./init_sqlite.sh forum.db
|
||||
```
|
||||
|
||||
Lastly, run with:
|
||||
|
||||
```
|
||||
./run_sqlite.sh forum.db forum.pid
|
||||
```
|
||||
|
||||
You will need a proxy such as nginx to access the forum on the public internet.
|
||||
@@ -5,9 +5,9 @@ PYTHON=python3
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# != 1 ]
|
||||
if [ $# -le 1 ]
|
||||
then
|
||||
echo "Usage: $0 <file>" >&2
|
||||
echo "Usage: $0 <file> [--no-admin]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -17,8 +17,11 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" != --no-admin ]
|
||||
then
|
||||
read -p 'Admin username: ' username
|
||||
read -sp 'Admin password: ' password
|
||||
fi
|
||||
|
||||
password=$($PYTHON tool.py password "$password")
|
||||
time=$($PYTHON -c 'import time; print(time.time_ns())')
|
||||
|
||||
14
requirements.txt
Normal file
14
requirements.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
argon2-cffi==21.3.0
|
||||
argon2-cffi-bindings==21.2.0
|
||||
cffi==1.15.1
|
||||
click==8.1.3
|
||||
Flask==2.2.2
|
||||
gunicorn==20.1.0
|
||||
importlib-metadata==5.0.0
|
||||
itsdangerous==2.1.2
|
||||
Jinja2==3.1.2
|
||||
MarkupSafe==2.1.1
|
||||
passlib==1.7.4
|
||||
pycparser==2.21
|
||||
Werkzeug==2.2.2
|
||||
zipp==3.8.1
|
||||
25
restart.sh
25
restart.sh
@@ -1,4 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script is intended for dev environments only.
|
||||
set -e
|
||||
|
||||
if [ -z "$SERVER" ]
|
||||
then
|
||||
echo "SERVER is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$SERVER" in
|
||||
dev)
|
||||
touch main.py
|
||||
;;
|
||||
gunicorn)
|
||||
if [ -z "$PID" ]
|
||||
then
|
||||
echo "PID is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
kill -hup $(cat "$PID")
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported $SERVER" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
20
run_sqlite.sh
Executable file
20
run_sqlite.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -e venv ]
|
||||
then
|
||||
echo "venv not found, did you run make?" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# != 2 ]
|
||||
then
|
||||
echo "Usage: $0 <file.db> <pid file>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export DB="$1"
|
||||
export SERVER=gunicorn
|
||||
export PID="$2"
|
||||
exec gunicorn -w 4 'main:app' --pid="$PID" -b 0.0.0.0:8000
|
||||
@@ -15,8 +15,10 @@ db=$tmp/forum.db
|
||||
. $base/../venv/bin/activate
|
||||
|
||||
# initialize db
|
||||
$base/../init_sqlite.sh $db
|
||||
$base/../init_sqlite.sh $db --no-admin
|
||||
$SQLITE $db < $base/init_db.txt
|
||||
cd $base/..
|
||||
|
||||
DB=$db $FLASK --app main --debug run
|
||||
export DB=$db
|
||||
export SERVER=dev
|
||||
$FLASK --app main --debug run
|
||||
|
||||
Reference in New Issue
Block a user