fix plzidx issues, include bulma and systemd unit

This commit is contained in:
Sven Koehler 2024-01-18 14:55:20 +01:00
parent 9d406e5f92
commit bab90fe4d1
4 changed files with 89 additions and 2 deletions

View File

@ -0,0 +1,58 @@
From 2ab6f47039d4bd8c35794e388cc862c3bccb6bc5 Mon Sep 17 00:00:00 2001
From: Sven Koehler <git@svenkoehler.de>
Date: Tue, 16 Jan 2024 23:45:17 +0100
Subject: [PATCH 34/34] Drop mapped_columns (sqlachemy 2.0 feature)
---
plzidx/db.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/plzidx/db.py b/plzidx/db.py
index 8fe86e2..22c084e 100644
--- a/plzidx/db.py
+++ b/plzidx/db.py
@@ -1,7 +1,7 @@
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Table, ForeignKeyConstraint, func
from typing import List
-from sqlalchemy.orm import declarative_base, mapped_column, relationship, Mapped
+from sqlalchemy.orm import declarative_base, relationship
import datetime
@@ -29,10 +29,10 @@ association_table = Table(
class Tag(db.Model):
__tablename__ = 'tag'
- id: Mapped[int] = mapped_column(Integer, primary_key=True)
- text: Mapped[str] = mapped_column(String, unique=True, nullable=False)
+ id = Column(Integer, primary_key=True)
+ text = Column(String, unique=True, nullable=False)
- pads: Mapped[List['Pad']] = relationship('Pad', secondary=association_table, back_populates='tags')
+ pads = relationship('Pad', secondary=association_table, back_populates='tags')
def __repr__(self):
return f'<Tag text={self.text}>'
@@ -85,13 +85,13 @@ class Tag(db.Model):
class Pad(db.Model):
__tablename__ = 'pad'
- uuid: Mapped[str] = mapped_column(String, primary_key=True, nullable=False)
- updatedAt: Mapped[datetime.datetime] = mapped_column(DateTime, nullable=False)
+ uuid = Column(String, primary_key=True, nullable=False)
+ updatedAt = Column(DateTime, nullable=False)
- title: Mapped[str] = mapped_column(String)
- url: Mapped[str] = mapped_column(String, nullable=False)
+ title = Column(String)
+ url = Column(String, nullable=False)
- tags: Mapped[List['Tag']] = relationship('Tag', secondary=association_table, back_populates='pads')
+ tags = relationship('Tag', secondary=association_table, back_populates='pads')
def __repr__(self):
return f'<Pad uuid={self.uuid}, updatedAt={self.updatedAt}>'
--
2.37.1 (Apple Git-137.1)

View File

@ -2,16 +2,27 @@ pkgname=hedgedoc-tag-searcher
pkgver=0.01
pkgrel=1
pkgdesc="Global search for Hedgedoc pads by tags"
source=('hedgedoc-tag-searcher::git+https://github.com/Chaostreff-Potsdam/hedgedoc-tag-searcher.git#tag=v0.01')
md5sums=('SKIP')
source=('hedgedoc-tag-searcher::git+https://github.com/Chaostreff-Potsdam/hedgedoc-tag-searcher.git#tag=v0.01' '0001-downgrade-to-sqlalchmy-1.4.patch' 'bulma.min.css' 'plzidx.service')
sha512sums=('SKIP'
'84bcc457d18d9a6bc4178dbfaf267f9ef931ca753698648439db5776815c17dcb8daa363064842d305afbebd4639a93ecc094bf0427450affe598d1c8981576f'
'1eac4752424cd1261c6efc54c393fad12cdd393cbf415c00d4926bbda5c9bf8abb9666c36429996aacf4d543ce690bdea317d846fd6d1e8cd618f31cb9306ebd'
'2dacde841246faff873c8beac4c34a88d7385dba61aec8deae43ab23e6a4124780140c6cbf686ad250bf925f90cd53481f1a4da3fb1fb50389d5c3de213ca89e'
)
arch=("any")
license=("MIT")
makedepends=("git" "python-build" "python-installer" "python-wheel")
depends=("python>=3" "python-flask" "python-flask-sqlalchemy" "python-pyaml" "python-dotenv" "python-psycopg2")
prepare() {
cd "$srcdir/$pkgname/"
patch --forward --strip=1 --input="${srcdir}/0001-downgrade-to-sqlalchmy-1.4.patch"
cp "${srcdir}/bulma.min.css" "plzidx/static/css/bulma.min.css"
}
build() {
cd "$srcdir/$pkgname/"
python -m build --wheel --no-isolation
}
@ -20,4 +31,8 @@ package() {
python -m installer --destdir="$pkgdir" dist/*.whl
mkdir -p "$pkgdir/etc/webapps/$pkgname/"
mkdir -p "$pkgdir/usr/var/plzidx-instance/"
ln -s "/etc/webapps/$pkgname/config.py" "$pkgdir/usr/var/plzidx-instance/config.py"
install -Dm644 "${srcdir}/plzidx.service" "${pkgdir}/usr/lib/systemd/system/plzidx.service"
}

1
hedgedoc-tag-searcher/bulma.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
[Unit]
Description=Gunicorn instance to serve hedgedoc-tag-searcher
After=network.target
[Service]
RuntimeDirectory=plzidx
RuntimeDirectoryMode=755
User=plzidx
Group=plzidx
ExecStart=/usr/bin/gunicorn --workers 1 --bind unix:/run/plzidx/plzidx.sock -u plzidx -g plzidx 'plzidx:create_app()'
[Install]
WantedBy=multi-user.target