Skip to content

Commit ed6bc26

Browse files
authored
Merge pull request #19 from taskiq-python/feat/version-1.11.0
feat: add full-text search
2 parents aa0bd3e + 2d1b881 commit ed6bc26

15 files changed

Lines changed: 1249 additions & 176 deletions

README.md

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
Standalone admin panel with task results storage in SQLite or Postgres database
44

5-
65
- [Broker-agnostic admin panel for Taskiq](#broker-agnostic-admin-panel-for-taskiq)
76
- [Previews](#previews)
87
- [Usage](#usage)
@@ -12,13 +11,14 @@ Standalone admin panel with task results storage in SQLite or Postgres database
1211
- [Development](#development)
1312

1413
### Previews
15-
Tasks Page | Task Details Page
16-
:-------------------------:|:-------------------------:
17-
![Alt text](./docs/images/preview1.png) | ![Alt text](./docs/images/preview2.png)
14+
15+
| Tasks Page | Task Details Page |
16+
| :-------------------------------------: | :-------------------------------------: |
17+
| ![Alt text](./docs/images/preview1.png) | ![Alt text](./docs/images/preview2.png) |
1818

1919
### Usage
2020

21-
1) Import and connect the middleware to the broker:
21+
1. Import and connect the middleware to the broker:
2222

2323
```python
2424
...
@@ -41,9 +41,10 @@ broker = (
4141
...
4242
```
4343

44-
2) Pull the image from GitHub Container Registry: `docker pull ghcr.io/taskiq-python/taskiq-admin:latest`
44+
2. Pull the image from GitHub Container Registry: `docker pull ghcr.io/taskiq-python/taskiq-admin:latest`
45+
46+
3. Replace `TASKIQ_ADMIN_API_TOKEN` with any secret enough string and run:
4547

46-
3) Replace `TASKIQ_ADMIN_API_TOKEN` with any secret enough string and run:
4748
```bash
4849
docker run -d --rm \
4950
-p "3000:3000" \
@@ -53,7 +54,7 @@ docker run -d --rm \
5354
"ghcr.io/taskiq-python/taskiq-admin:latest"
5455
```
5556

56-
4) Go to `http://localhost:3000/tasks`
57+
4. Go to `http://localhost:3000/tasks`
5758

5859
### Docker Compose Example
5960

@@ -83,28 +84,51 @@ services:
8384
- admin_data:/usr/database/
8485

8586
volumes:
86-
admin_data:
87+
admin_data:
8788
```
8889
8990
### Running without Docker
90-
1) `cp env-example .env`, enter `.env` file and fill in all needed variables
91-
2) run `make dev` to run it locally in dev mode
92-
3) run `make prod` to run it locally in prod mode
91+
92+
1. `cp env-example .env`, enter `.env` file and fill in all needed variables
93+
2. run `make dev` to run it locally in dev mode
94+
3. run `make prod` to run it locally in prod mode
9395

9496
Environment variables for DB setup:
97+
9598
- `TASKIQ_ADMIN_DB_DRIVER`: required, one of `sqlite` or `postgres`
9699
- `TASKIQ_ADMIN_DB_FILE_PATH`: required when `TASKIQ_ADMIN_DB_DRIVER=sqlite`
97100
- `TASKIQ_ADMIN_DB_URL`: required when `TASKIQ_ADMIN_DB_DRIVER=postgres`
98101

102+
#### Postgres and `pg_trgm` (optional)
103+
104+
Task name search uses a case-insensitive substring match. On postgres it is backed by a
105+
`pg_trgm` GIN index, which taskiq-admin creates on startup.
106+
107+
This is a performance optimization, not a requirement: if the extension cannot be created,
108+
search keeps returning the same results, it just does a sequential scan over the tasks table.
109+
A warning is logged once at startup when that happens.
110+
111+
`pg_trgm` ships with the standard `postgresql-contrib` package (included in the official
112+
postgres Docker images) and is a trusted extension since postgres 13, so the database owner
113+
can create it without superuser rights. If the role in `TASKIQ_ADMIN_DB_URL` is neither owner
114+
nor superuser, create it once by hand:
115+
116+
```sql
117+
CREATE EXTENSION IF NOT EXISTS pg_trgm;
118+
```
119+
99120
### Task States
121+
100122
Let's assume we have a task 'do_smth', there are all states it can embrace:
101-
1) `queued` - the task has been sent to the queue without an error
102-
2) `running` - the task is grabbed by a worker and is being processed
103-
3) `success` - the task is fully processed without any errors
104-
4) `failure` - an error occured during the task processing
105-
5) `abandoned` - taskiq-admin sets all 'running' tasks as 'abandoned' if there was a downtime between the time these tasks were in 'running' state and the time of next startup of taskiq-admin
123+
124+
1. `queued` - the task has been sent to the queue without an error
125+
2. `running` - the task is grabbed by a worker and is being processed
126+
3. `success` - the task is fully processed without any errors
127+
4. `failure` - an error occured during the task processing
128+
5. `abandoned` - taskiq-admin sets all 'running' tasks as 'abandoned' if there was a downtime between the time these tasks were in 'running' state and the time of next startup of taskiq-admin
106129

107130
### Development
108-
1) Run `pnpm install` to install all dependencies
109-
2) Run `pnpm db:push` to create the sqlite database if needed
110-
3) Run `pnpm dev` to run the project
131+
132+
1. Run `pnpm install` to install all dependencies
133+
2. Run `pnpm db:push` to create the sqlite database if needed
134+
3. Run `pnpm dev` to run the project

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"@tailwindcss/vite": "^4.1.17",
2222
"@tanstack/vue-table": "^8.21.3",
2323
"@vueuse/core": "^14.1.0",
24-
"better-sqlite3": "^12.6.2",
24+
"better-sqlite3": "^12.11.1",
2525
"class-variance-authority": "^0.7.1",
2626
"clsx": "^2.1.1",
27-
"dayjs": "^1.11.19",
27+
"dayjs": "^1.11.23",
2828
"dotenv": "^17.2.3",
2929
"drizzle-orm": "^0.45.1",
3030
"lucide-vue-next": "^0.524.0",
3131
"nuxt": "^4.2.2",
32-
"pg": "^8.16.3",
32+
"pg": "^8.23.0",
3333
"reka-ui": "^2.6.1",
3434
"tailwind-merge": "^3.4.0",
3535
"tailwindcss": "^4.1.17",
@@ -44,7 +44,8 @@
4444
"@iconify-json/radix-icons": "^1.2.5",
4545
"@iconify/vue": "^5.0.0",
4646
"@nuxt/test-utils": "^3.23.0",
47-
"@types/better-sqlite3": "^7.6.12",
47+
"@types/better-sqlite3": "^7.6.13",
48+
"@types/pg": "^8.23.1",
4849
"@vue/test-utils": "^2.4.6",
4950
"drizzle-kit": "^0.31.8",
5051
"happy-dom": "^18.0.1",

0 commit comments

Comments
 (0)