Commit graph

3649 commits

Author SHA1 Message Date
Kevin Morris
7aa959150e
feat(fastapi): add id="conflicts" to package details conflicts
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 19:54:30 -08:00
Kevin Morris
e8e9edbb21
change(fastapi): simplify package details database queries
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 19:30:21 -08:00
Kevin Morris
a33e9bd571
feat(fastapi): add Replaces field to package details
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 19:15:29 -08:00
Kevin Morris
50a9690c2d
feat(fastapi): add Provides field in package details
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 19:15:03 -08:00
Kevin Morris
2016b80ea9
fix(fastapi): hide conflicts when there are none
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 18:14:50 -08:00
Kevin Morris
2dc6cfec23
fix(fastapi): reorganize licenses display
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 18:14:15 -08:00
Kevin Morris
20f5519b99
fix(fastapi): hide keywords when there are none or they can't be edited
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 18:13:21 -08:00
Kevin Morris
363afff332
feat(fastapi): add /pkgbase/{name}/keywords (post)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 17:36:08 -08:00
Kevin Morris
5f5fa44d0d
fix(fastapi): fix licenses check
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 17:12:13 -08:00
Kevin Morris
cef217388a
add labels to gitlab issue templates
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 16:50:16 -08:00
Kevin Morris
0da11f068b
fix(fastapi): check for prometheus info.response
When this is unchecked, exceptions cause the resulting stack
trace to be oblivious to the original exception thrown.

This commit changes that behavior so that metrics are created
only when info.response exists.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 16:24:10 -08:00
Kevin Morris
567090547d
add labels to gitlab issue templates
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-11 13:12:23 -08:00
Kevin Morris
66978e40a4
fix(mkpkglists): fix isort order (master)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 13:57:33 -08:00
Kevin Morris
8788f99005
fix(mkpkglists): restore isort order
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 13:54:18 -08:00
Kevin Morris
6e344ce9da
fix(mkpkglists): default keys to result[1]
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 13:41:53 -08:00
Kevin Morris
52110b7db5
fix(mkpkglists): default keys to result[1]
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 13:41:34 -08:00
Kevin Morris
daef98080e
fix(fastapi): fix broken official package query
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 13:05:19 -08:00
Kevin Morris
4b2be7fff8
feat(docker): add poetry caching
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 13:00:01 -08:00
Kevin Morris
0c57c53da1
fix(sharness): fix AUR_CONFIG generation for mkpkglists test
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 07:39:23 -08:00
Kevin Morris
4f7aeafa8d
feat(docker): host gzip archive downloads
- added config option [mkpkglists] archivedir
    - created by mkpkglists

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 07:39:23 -08:00
Kevin Morris
abbecf5194
change(mkpkglists): remove header comments
These comments change every time mkpkglists is run; which
would invalidate the ETag headers disbursed by the gzip
host. This commit removes those changing headers.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-10 07:39:17 -08:00
Kevin Morris
107367f958
feat(docker): use mkpkglists --extended flag
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 02:29:39 -08:00
Kevin Morris
068b067e14
feat(docker): log cron executions
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 02:28:52 -08:00
Kevin Morris
0403b89f53
feat: add packagesmeta[ext]file option to conf/config.dev
Better defaults for Docker here.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 02:08:03 -08:00
Kevin Morris
0155f4ea84
fix(mkpkglists): remove caching
We really need caching for this; however, our current caching
method will cause the script to bypass changes to columns
if they have nothing to do with IDs.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 02:07:13 -08:00
Kevin Morris
d62af4ceb5
feat(mkpkglists): added metadata archives
Two new archives are available:

- packages-meta-v1.json.gz
    - RPC search formatted data for all packages
    - ~2.1MB at the time of writing.
- packages-meta-ext-v1.json.gz (via --extended)
    - RPC multiinfo formatted data for all packages.
    - ~9.8MB at the time of writing.

New dependencies are required for this update:

- `python-orjson`

All archives served out by aur.archlinux.org distribute the Last-Modified
header and support the If-Modified-Since header, which should be
populated with Last-Modified's value. These should be used by clients
to avoid redownloading the archive when unnecessary.

Additionally, the new meta archives contain a format suitable for
streaming the data as the file is retrieved. It is still in JSON
format, however, users can parse package objects line by line after
the first '[' found in the file, until the last ']'; both contained
on their own lines.

Note: This commit is a documentation change and commit body.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 02:07:04 -08:00
Kevin Morris
f3f662c696
fix(mkpkglists): improve package meta archive
The SQL logic in this file for package metadata now exactly
reflects RPC's search logic, without searching for specific
packages.

Two command line arguments are available:

    --extended | Include License, Keywords, Groups, relations
                 and dependencies.

When --extended is passed, the script will create a
packages-meta-ext-v1.json.gz, configured via packagesmetaextfile.

Archive JSON is in the following format: line-separated package objects
enclosed in a list:

    [
    {...},
    {...},
    {...}
    ]

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 02:06:50 -08:00
Kristian Klausen
f606140050
feat(PHP): Add packages dump file with more metadata 2021-11-09 02:04:58 -08:00
Kevin Morris
10fcf93991
fix(fastapi): use correct official pkg base url
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 01:51:23 -08:00
Kevin Morris
4b8963b7ba
feat(docker): add cron service (aurblup + mkpkglists)
Normally, these scripts are used to update official providers
in the aurweb database along with archives that can be retrieved.

Run both of these scripts in a 5 minute cron job, to both reflect
the live instance database and production load.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 00:29:19 -08:00
Kevin Morris
338a44839f
fix: override aurblup's db-path option in config.dev
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 00:18:54 -08:00
Kevin Morris
b8d7619dbc
change: add mkpkglists options to config.dev
Here, we default to using root as the storage directory. Primarily
because it makes sense in Docker; config.dev can always be fixed up
by developers to reflect local system changes.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 00:17:52 -08:00
Kevin Morris
464540c9a9
fix: use https for aurblup's default mirror instead of ftp
It seems the ftp mirror from kernel.org cannot be used anymore,
but the https mirror can. So, the default config has been updated
to reflect this; otherwise, aurblup bugs out.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-09 00:14:24 -08:00
Kevin Morris
e9cc133005
Merge branch 'starlette-0.17.0' into pu 2021-11-08 19:12:11 -08:00
Kevin Morris
85ebc72e8a
fix(fastapi): only elevated users are allowed to suspend accounts
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-08 18:51:39 -08:00
Kevin Morris
3517862ecd
change(poetry): use kevr@upgrade-starlette-0.17.0 as fastapi source
Starlette 0.16.0 has a pretty bad bug in terms of logging which
has been fixed in the 0.17.0 release. That being said, FastAPI has
not yet merged a request at https://github.com/tiangolo/fastapi/pull/4145
which resolves this dependency resolution so we can use the updated
starlette package.

kevr has forked the pull request in question and we are using it
for now in our poetry dependencies to get ahead of the game.

When FastAPI upstream is updated to support 0.17.0, we'll need
to switch this back to using upstream's source.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-08 18:46:21 -08:00
Kevin Morris
446a082352
change(fastapi): refactor database ORM model definitions
We don't want to depend on the database to load up data
about the models we define. We now leverage the existing
`aurweb.schema` module for table definitions and set
__table_args__["autoload"] to False.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-07 17:31:34 -08:00
Kevin Morris
9f1f399957
fix(mkpkglists): remove caching
We really need caching for this; however, our current caching
method will cause the script to bypass changes to columns
if they have nothing to do with IDs.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-06 17:13:16 -07:00
Kevin Morris
cdca8bd295
feat(mkpkglists): added metadata archives
Two new archives are available:

- packages-meta-v1.json.gz
    - RPC search formatted data for all packages
    - ~2.1MB at the time of writing.
- packages-meta-ext-v1.json.gz (via --extended)
    - RPC multiinfo formatted data for all packages.
    - ~9.8MB at the time of writing.

New dependencies are required for this update:

- `python-orjson`

All archives served out by aur.archlinux.org distribute the Last-Modified
header and support the If-Modified-Since header, which should be
populated with Last-Modified's value. These should be used by clients
to avoid redownloading the archive when unnecessary.

Additionally, the new meta archives contain a format suitable for
streaming the data as the file is retrieved. It is still in JSON
format, however, users can parse package objects line by line after
the first '[' found in the file, until the last ']'; both contained
on their own lines.

Note: This commit is a documentation change and commit body.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-06 16:42:12 -07:00
Kevin Morris
51fb24ab73
fix(mkpkglists): improve package meta archive
The SQL logic in this file for package metadata now exactly
reflects RPC's search logic, without searching for specific
packages.

Two command line arguments are available:

    --extended | Include License, Keywords, Groups, relations
                 and dependencies.

When --extended is passed, the script will create a
packages-meta-ext-v1.json.gz, configured via packagesmetaextfile.

Archive JSON is in the following format: line-separated package objects
enclosed in a list:

    [
    {...},
    {...},
    {...}
    ]

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-06 16:19:34 -07:00
Kristian Klausen
69773a5b58
feat(PHP): Add packages dump file with more metadata 2021-11-06 16:15:55 -07:00
Steven Guikal
020409ef46 fix(FastAPI): prevent CSRF forging login requests
Signed-off-by: Steven Guikal <void@fluix.one>
2021-11-04 14:34:14 -04:00
Kevin Morris
e4a5b7fae9
fix(docker): use 3s intervals for all healthchecks
This'll speed up the docker development and deployment
processes significantly.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-03 05:40:30 -07:00
Kevin Morris
16e6fa2cdd
fix(fastapi): fix prometheus parsing of HTTPStatus
This wasn't actually casting to int. We shouldn't be providing
HTTPStatus.CONSTANTS directly anyway, but, in case we do, we now
just convert the status to an int before converting it to a string.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-01 14:23:15 -07:00
Kevin Morris
9aa8decf40
fix(fastapi): use metrics in cases where PROMETHEUS_MULTIPROC_DIR is defined
Previously, we restricted this to gunicorn to get it working on aur-dev.
This change makes it usable through any backend, and also no-op if
PROMETHEUS_MULTIPROC_DIR is not defined.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-01 14:18:19 -07:00
Kevin Morris
cdb854259a
fix(docker): share FASTAPI_BACKEND with the server
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-01 13:54:58 -07:00
Kevin Morris
dc397f6bd8
fix(fastapi): utilize PROMETHEUS_MULTIPROC_DIR in our own /metrics
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-01 13:23:48 -07:00
Kevin Morris
1be4ac2fde
feat(docker): use PROMETHEUS_MULTIPROC_DIR
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-01 12:27:33 -07:00
Kevin Morris
f21765bfe4
feat(fastapi): add prometheus /metrics
This commit provides custom metrics, so we can group requests
into their route paths and not by the arguments given, e.g.
/pkgbase/some-package -> /pkgbase/{name}. We also count RPC
requests as `http_api_requests_total`, split by the RPC
query "type" argument.

- `http_api_requests_total`
    - Labels: ["type", "status"]
- `http_requests_total`
    - Number of HTTP requests in total.
    - Labels: ["method", "path", "status"]

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-01 11:41:39 -07:00
Kevin Morris
cc45290ec2
feat(poetry): add prometheus-fastapi-instrumentator
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-01 11:41:38 -07:00