mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-20 05:43:41 -05:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
afa19b826e
8 changed files with 122 additions and 7 deletions
|
@ -2,6 +2,6 @@ DB_HOST = 127.0.0.1
|
|||
DB_NAME = catask
|
||||
DB_USER =
|
||||
DB_PASS =
|
||||
DB_PORT = 3306
|
||||
DB_PORT = 5432
|
||||
ADMIN_PASSWORD =
|
||||
APP_SECRET =
|
||||
|
|
7
Dockerfile
Normal file
7
Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
|||
FROM python:3-alpine
|
||||
|
||||
WORKDIR /catask
|
||||
COPY . .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
ENTRYPOINT [ "gunicorn", "-w", "4", "app:app", "--bind", "0.0.0.0:8000" ]
|
16
README.md
16
README.md
|
@ -2,17 +2,15 @@
|
|||
|
||||
a simple & easy to use Q&A software that makes answering questions easier
|
||||
|
||||
<!-- CatAsk is alpha software, therefore bugs are expected to happen-->
|
||||
|
||||
## Prerequisites
|
||||
- PostgreSQL
|
||||
- Python 3.10+ (3.12+ recommended)
|
||||
|
||||
## Install
|
||||
Clone this repository: `git clone https://git.gay/mst/catask.git`
|
||||
Clone this repository: `git clone https://codeberg.org/catask-org/catask.git`
|
||||
|
||||
<!--### Docker
|
||||
See [docker.md](https://git.gay/mst/catask/src/branch/main/docker.md)-->
|
||||
### Docker
|
||||
See [docker.md](./docker.md) for install instructions
|
||||
|
||||
### VPS-specific
|
||||
Go into the cloned repository, create a virtual environment and activate it:
|
||||
|
@ -28,6 +26,14 @@ Go into the cloned repository, create a virtual environment and activate it:
|
|||
After that, install required packages:
|
||||
```pip install -r requirements.txt```
|
||||
|
||||
Then, create the database and the user for CatAsk:
|
||||
``` sql
|
||||
CREATE USER '<DB_USER>' WITH PASSWORD "<DB_PASS>";
|
||||
```
|
||||
``` sql
|
||||
CREATE DATABASE "<DB_NAME>" OWNER '<DB_USER>';
|
||||
```
|
||||
|
||||
### Shared hosting-specific
|
||||
If your shared hosting provider supports [WSGI](https://w.wiki/_vTN2), [FastCGI](https://w.wiki/9EeQ), or something similar, use it (technically any CGI protocol could work)
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ pgloader mysql://old_user:old_password@127.0.0.1/old_catask pgsql://new_user:new
|
|||
...
|
||||
```
|
||||
|
||||
5. modify your .env file to have new database credentials and change database port to 5432 (default for postgres)
|
||||
|
||||
## 1.7.0 -> 1.7.x
|
||||
pull the update: `git pull`
|
||||
make the following changes in your config.json file:
|
||||
|
|
45
docker-compose.yml
Normal file
45
docker-compose.yml
Normal file
|
@ -0,0 +1,45 @@
|
|||
name: catask
|
||||
|
||||
services:
|
||||
postgres:
|
||||
environment:
|
||||
POSTGRES_DB: catask
|
||||
POSTGRES_USER: catask
|
||||
POSTGRES_PASSWORD: catask
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-U", "catask"]
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
image: postgres:alpine
|
||||
networks:
|
||||
- catask
|
||||
restart: always
|
||||
volumes:
|
||||
- ./schema.sql:/docker-entrypoint-initdb.d/catask.sql
|
||||
- db-data:/var/lib/postgresql/data
|
||||
|
||||
catask:
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- catask
|
||||
ports:
|
||||
- "8000:8000"
|
||||
restart: always
|
||||
volumes:
|
||||
- catask-data:/catask/static/emojis
|
||||
- catask-data:/catask/static/icons/favicon
|
||||
- ./config.json:/catask/config.json
|
||||
- ./.env:/catask/.env
|
||||
|
||||
networks:
|
||||
catask:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
catask-data:
|
54
docker.md
Normal file
54
docker.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
# CatAsk on Docker (or Podman)
|
||||
|
||||
## Prerequisites
|
||||
- Docker + `docker-compose` (or Podman + `podman-compose`)
|
||||
|
||||
## Steps
|
||||
Before starting CatAsk, you must copy the configuration files to their proper places first:
|
||||
|
||||
```sh
|
||||
cp config.example.json config.json
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Then, paste this into the `.env` file, and replace sections that are marked with `[CHANGE THIS]`.
|
||||
|
||||
```env
|
||||
DB_HOST = postgres
|
||||
DB_NAME = catask
|
||||
DB_USER = catask
|
||||
DB_PASS = catask
|
||||
DB_PORT = 5432
|
||||
ADMIN_PASSWORD = [CHANGE THIS]
|
||||
APP_SECRET = [CHANGE THIS]
|
||||
```
|
||||
|
||||
You may now start CatAsk:
|
||||
|
||||
```sh
|
||||
docker compose up
|
||||
```
|
||||
|
||||
If you have done everything correctly, going to `http://localhost:8000` in your browser should show a question box screen. You may now log in with your admin password, and configure the instance.
|
||||
|
||||
## Updating
|
||||
|
||||
1. Stop the Docker container
|
||||
|
||||
```sh
|
||||
docker compose down
|
||||
```
|
||||
|
||||
2. Follow the [`UPDATE.md`](./UPDATE.md) file to see what to add or remove to your `config.json` or `.env`.
|
||||
|
||||
3. Remove the Docker image
|
||||
|
||||
```sh
|
||||
docker rmi catask_catask
|
||||
```
|
||||
|
||||
4. Restart CatAsk
|
||||
|
||||
```sh
|
||||
docker compose up
|
||||
```
|
|
@ -443,6 +443,7 @@ def emoji(md):
|
|||
def listEmojis() -> list:
|
||||
emojis = []
|
||||
emoji_base_path = Path.cwd() / 'static' / 'emojis'
|
||||
os.makedirs(emoji_base_path, exist_ok=True)
|
||||
|
||||
# Iterate over files that are directly in the emoji base path (not in subdirectories)
|
||||
for file in emoji_base_path.iterdir():
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
flask
|
||||
python-dotenv
|
||||
psycopg
|
||||
psycopg[binary,pool]
|
||||
humanize
|
||||
mistune
|
||||
bleach
|
||||
|
|
Loading…
Add table
Reference in a new issue