Add initial project structure and configuration files
This commit is contained in:
parent
bc40d93d37
commit
988d131c49
13 changed files with 688 additions and 20 deletions
94
README.md
94
README.md
|
|
@ -1,3 +1,95 @@
|
|||
# panso.se
|
||||
|
||||
Price tracker for Swedish stores
|
||||
Price tracker for Swedish stores
|
||||
|
||||
# panso
|
||||
|
||||
Get notified when a new drop is available on Twitch
|
||||
|
||||
## TL;DR (Arch Linux + PostgreSQL)
|
||||
|
||||
Install and initialize Postgres, then start the service:
|
||||
|
||||
```bash
|
||||
sudo pacman -S postgresql
|
||||
sudo -u postgres initdb -D /var/lib/postgres/data
|
||||
sudo systemctl enable --now postgresql
|
||||
```
|
||||
|
||||
Create a local role and database:
|
||||
|
||||
```bash
|
||||
sudo -u postgres createuser -P panso
|
||||
sudo -u postgres createdb -O panso panso
|
||||
```
|
||||
|
||||
Point Django at the unix socket used by Arch (`/run/postgresql`):
|
||||
|
||||
```bash
|
||||
POSTGRES_USER=panso
|
||||
POSTGRES_PASSWORD=your_password
|
||||
POSTGRES_DB=panso
|
||||
POSTGRES_HOST=/run/postgresql
|
||||
POSTGRES_PORT=5432
|
||||
```
|
||||
|
||||
### Linux (Systemd)
|
||||
|
||||
```bash
|
||||
sudo useradd --create-home --home-dir /home/panso --shell /bin/fish panso
|
||||
sudo passwd panso
|
||||
# sudo usermod -aG wheel panso
|
||||
su - panso
|
||||
git clone https://git.lovinator.space/TheLovinator/panso.se.git
|
||||
cd panso
|
||||
uv sync --no-dev
|
||||
|
||||
# Modify .env with the correct database credentials and other settings, then run migrations:
|
||||
uv run python manage.py migrate
|
||||
```
|
||||
|
||||
Install the systemd service from the repo:
|
||||
|
||||
```bash
|
||||
sudo install -m 0644 tools/systemd/panso.socket /etc/systemd/system/panso.socket
|
||||
sudo install -m 0644 tools/systemd/panso.service /etc/systemd/system/panso.service
|
||||
```
|
||||
|
||||
Enable and start the service:
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now panso.socket
|
||||
sudo systemctl enable --now panso.service
|
||||
|
||||
curl --unix-socket /run/panso/panso.sock https://panso.se
|
||||
```
|
||||
|
||||
Install and enable timers:
|
||||
|
||||
```bash
|
||||
sudo install -m 0644 tools/systemd/panso-backup.{service,timer} /etc/systemd/system/
|
||||
sudo install -m 0644 tools/systemd/panso-import-drops.{service,timer} /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now panso-backup.timer panso-import-drops.timer
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
uv run python manage.py createsuperuser
|
||||
uv run python manage.py makemigrations
|
||||
uv run python manage.py migrate
|
||||
uv run python manage.py collectstatic
|
||||
uv run python manage.py runserver
|
||||
uv run pytest
|
||||
```
|
||||
|
||||
## Celery
|
||||
|
||||
Start a worker:
|
||||
|
||||
```bash
|
||||
uv run celery -A config worker --loglevel=info
|
||||
uv run celery -A config beat --loglevel=info --scheduler django_celery_beat.schedulers:DatabaseScheduler
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue