You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1) Import and connect the middleware to the broker:
21
+
1. Import and connect the middleware to the broker:
22
22
23
23
```python
24
24
...
@@ -41,9 +41,10 @@ broker = (
41
41
...
42
42
```
43
43
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:
45
47
46
-
3) Replace `TASKIQ_ADMIN_API_TOKEN` with any secret enough string and run:
47
48
```bash
48
49
docker run -d --rm \
49
50
-p "3000:3000" \
@@ -53,7 +54,7 @@ docker run -d --rm \
53
54
"ghcr.io/taskiq-python/taskiq-admin:latest"
54
55
```
55
56
56
-
4) Go to `http://localhost:3000/tasks`
57
+
4. Go to `http://localhost:3000/tasks`
57
58
58
59
### Docker Compose Example
59
60
@@ -83,28 +84,51 @@ services:
83
84
- admin_data:/usr/database/
84
85
85
86
volumes:
86
-
admin_data:
87
+
admin_data:
87
88
```
88
89
89
90
### 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
93
95
94
96
Environment variables for DB setup:
97
+
95
98
- `TASKIQ_ADMIN_DB_DRIVER`: required, one of `sqlite` or `postgres`
96
99
- `TASKIQ_ADMIN_DB_FILE_PATH`: required when `TASKIQ_ADMIN_DB_DRIVER=sqlite`
97
100
- `TASKIQ_ADMIN_DB_URL`: required when `TASKIQ_ADMIN_DB_DRIVER=postgres`
98
101
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
+
99
120
### Task States
121
+
100
122
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
106
129
107
130
### 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
0 commit comments