Commit graph

3401 commits

Author SHA1 Message Date
Kevin Morris
c6c04f4952
fix(docker): add missing version for docker-compose.override.yml
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-23 18:47:59 -07:00
Kevin Morris
60bffa4fb6
feat(FastAPI): add /packages (post) action: 'delete'
Improvements:

- Package deletion now creates a PackageRequest on behalf of
  the deleter if one does not yet exist.
- All package deletions are now logged to keep track of who did what.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-23 18:23:15 -07:00
Kevin Morris
81417ea8b2
change(docker): merge production git repo bind mount
This merge requires production users to specify an host
directory to bind as the git repository within Docker containers.

This means that a repository can be shared between host
and container, so that the repository does not need to be
managed within Docker alone.

New environment variables:

- GIT_DATA_DIR: Path to aur.git repository that is bind mounted

Do note, this variable only takes affect when users run
production Docker services, by supplying:

    $ docker-compose -f docker-compose.yml -f docker-compose.prod.yml ...
2021-10-22 21:34:58 -07:00
Kevin Morris
13b344d238
feat(FastAPI): add /packages (post) action: 'disown'
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-22 19:38:14 -07:00
Kevin Morris
f1ad1b9aed
feat(FastAPI): add /packages (post) action: 'adopt'
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-22 19:01:13 -07:00
Kevin Morris
9b5eeb7652
fix(pytest): ignore asyncio.base_events deprecation warnings
This deprecation warning is not fixed in a tagged release yet.
Ignoring it for now; it has nothing to do with user code.

Upstream bug at https://bugs.python.org/issue45097

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-22 18:52:10 -07:00
Kevin Morris
4ae3fbd5d1
change(docker): depend on provided poetry.lock for dep resolution
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-22 17:43:00 -07:00
Kevin Morris
d4210c53cf
fix: update poetry dependencies
There were some test failures caused by problematic
dependency versioning, most likely to to the seriously
braindead pyproject.toml config for deps that previously
existed.

This commit defines python version >=3.9<3.10 for our working
Python version and provides updated deps (to latest).

I believe the bug was originally caused by the fact that
we had no python dependency defined, allowing poetry to
resolve dependencies incorrectly for what we intended.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-22 17:39:59 -07:00
Kevin Morris
d5520c9ed2
feat(FastAPI): add /packages (post) action: 'unnotify'
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 17:38:44 -07:00
Kevin Morris
b277d94e0b
feat(FastAPI): add /packages (post) action: 'notify'
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 16:52:04 -07:00
Steven Guikal
e9fc27a33b feat(docker): make git data directory host-configurable
Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-21 14:37:06 -04:00
Kevin Morris
fb85cb60a0
feat(FastAPI): add /packages (post) action: 'unflag'
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 11:29:55 -07:00
Kevin Morris
0b1c3ea539
feat(docker): expose cgit-{php,fastapi} on {13000,13001}
This change exposes the uwsgi daemon we use for cgit on:

- PHP: docker-host:13000
- FastAPI: docker-host:13001

These ports can then be used to take advantage of cgit on
a production server that hosts nginx in front of Docker.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 11:11:01 -07:00
Kevin Morris
db730ad8cb
fix(docker): fix cgit clone-prefix
Additionally, clone-prefix is now configurable via environment variables:

- CGIT_CLONE_PREFIX_PHP
- CGIT_CLONE_PREFIX_FASTAPI

These vars can be used by production to customize the clone prefix.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 11:11:01 -07:00
Kevin Morris
c4163547f6
fix(docker): swap package cgit -> cgit-aurweb
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 11:10:55 -07:00
Kevin Morris
65240c8343
feat(rpc): enforce ratelimiting
New configuration options:

- `[ratelimit] cache`
    - A boolean indicating whether we should use configured cache (1)
      or database (0) for ratelimiting.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 11:07:36 -07:00
Kevin Morris
6662975005
change(rpc): handle 'version' and 'type' arguments in constructor
Additionally, added RPC.error, which produces an RPC-compatible
error based on the version passed during construction.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 11:01:24 -07:00
Kevin Morris
a06f4ec19c
fix(fastapi): centralize logging initialization
With this change, we provide a wrapper to `logging.getLogger`
in the `aurweb.logging` module. Modules wishing to log using
logging.conf should get their module-local loggers by calling
`aurweb.logging.getLogger(__name__)`, similar to `logging.getLogger`,
this way initialization with logging.conf is guaranteed.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-21 10:40:52 -07:00
Kevin Morris
5ae9d09e98
fix: remove unused "Merge into" input from /packages
When using this input on `live` as a TU, the field is not
taken into account. Tried with no action and with the
Delete Packages action, which ended up deleting the packages
but not merging into the given target.

So, this commit removes that input from the page.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-20 23:27:07 -07:00
Kevin Morris
f5e38e9979
Merge branch 'pu_pkgbase_auth_redirects' into pu 2021-10-20 22:30:26 -07:00
Kevin Morris
7c4fb539d8
change(fastapi): rework /rpc (get)
This reworks the base implementation of the RPC to use a
class called RPC for handling of requests. Took a bit of
a different approach than PHP in terms of exposed methods,
but it does end up achieving the same goal, with one additional
error: "Request type '{type}' is not yet implemented."

For FastAPI development, we'll stick with:

- If the supplied 'type' argument has an alias mapping in
  RPC.ALIASES, we convert the type argument over to its alias
  before doing anything. Example: 'info' is aliased to 'multiinfo',
  so when a user requests type=info, it is converted to type=multiinfo.
- If the type does not exist in RPC.EXPOSED_TYPES, the following
  error is produced: "No request type/data specified."
- If the type **does** exist in RPC.EXPOSED_TYPES, but does not
  have an implemented `RPC._handle_{type}_type` function, the
  following error is produced: "Request type '{type}' is not yet
  implemented."

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-20 22:17:05 -07:00
Kevin Morris
30ab45f459
fix(fastapi): add backref cascade to Package{Keyword,License}
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-20 20:59:42 -07:00
Kevin Morris
2b9840149e
feat(fastapi): add /pkgbase/{name}/merge (get)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-20 20:31:44 -07:00
Kevin Morris
990f4d182b
feat(rpc): add 'suggest-pkgbase' type
This feature of RPC is required to take advantage of
javascript typeahead.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-20 20:31:42 -07:00
Kevin Morris
c8f3ea2eba
fix(fastapi): fix various pkgbase-wise auth redirects
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-20 20:20:59 -07:00
Kevin Morris
fb0f252b39
Merge branch 'fix-tuple-return-style' into pu 2021-10-20 19:41:17 -07:00
Kevin Morris
ddc51dd5eb
Merge branch 'fix-trailing-slashes' into pu 2021-10-20 17:46:12 -07:00
Steven Guikal
fd58e4df04 fix(FastAPI): unify tuple return style
Closes #134

Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-19 19:04:08 -04:00
Kevin Morris
4cb0994fee
fix(fastapi): correct unauthorized request creation redirect
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-19 15:16:29 -07:00
Kevin Morris
beed64e001
fix(fastapi): persist package request form inputs
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-19 15:16:26 -07:00
Kevin Morris
b4092fe77d
fix(fastapi): pass request type's name to Request*Notification
Previously, we passed the straight up request type instance from
SQLAlchemy and had a .title() function that was transparently
treating the instance the same as the instance's Name in terms
of notify.py's use of it.

This commit removes that transparent behavior; it was not actually
intended.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-19 15:06:16 -07:00
Kevin Morris
3b28be1741
Merge branch 'pu_pkgbase_flag_comment' into pu 2021-10-19 14:56:05 -07:00
Kevin Morris
f4cfc7c5ca
Merge branch 'feat-host-maridb-cfg' into pu 2021-10-19 14:33:05 -07:00
Kevin Morris
4f505ca6c1
feat(docker): support for host-mounted mariadb socket
A new configurable env var has been introduced to production Docker:
MARIADB_SOCKET_DIR, which should contain a path to a directory
containing `mysqld.sock` on the Docker host.

Note: The database name, user and password can be configured by
modifying `conf/config.dev` before building the Docker image.

This feature only works in production mode, when specifying:

    $ export MARIADB_SOCKET_DIR=/var/run/mysqld
    $ docker-compose -f docker-compose.yml -f docker-compose.prod.yml ...

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-19 14:31:51 -07:00
Steven Guikal
1cb1ce0d99 feat(docker): allow production docker setup to use dedicated mariadb
Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-19 17:21:03 -04:00
Kevin Morris
37f0c352f6
feat(FastAPI): add /pkgbase/{name}/flag-comment (get)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-19 13:39:00 -07:00
Kevin Morris
210d92e382
Merge branch 'pu_packages_action_post' into pu 2021-10-19 13:38:02 -07:00
Steven Guikal
4e3cc1dfe2 feat(docker): only use mariadb socket for connections 2021-10-19 15:35:34 -04:00
Bert Peters via aur-dev
36c1ee35a7
Send request notifications to co-maintainers
This is in addition to the current recipients. Co-maintainers should
also be made aware when their package has pending requests.

NOTE: This commit was slightly modified to resolve cherry-pick
conflicts in `pu`.
2021-10-19 12:18:40 -07:00
Bert Peters via aur-dev
be64ca7b0e
Send request notifications to co-maintainers
This is in addition to the current recipients. Co-maintainers should
also be made aware when their package has pending requests.
2021-10-19 11:55:59 -07:00
Kevin Morris
37232f71ee
feat: add git-cliff configuration
git-cliff is a tool which allows us to generate changelog
based off of conventional commits in the repository.

This commit provides an initial cliff.toml configuration
file which formats changelog output with tables and branch
state metadata.

Upstream: https://github.com/orhun/git-cliff

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-19 09:28:14 -07:00
Kevin Morris
d22580fa74
fix(docker): add aurweb-image service
The new `aurweb-image` service does not perform any purpose
other than providing a build definition for 'aurweb:latest'.
With this, `docker-compose build` now just runs once for the
`aurweb-image` service, which builds the image used by all
other services.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-19 07:40:59 -07:00
Kevin Morris
267f2cb2c4
fix(fastapi): remove trailing slashes from fastapi-driven links
With our FastAPI server, trailing slashes causes a 307 redirect
which ends up redirecting users to routes which do not contain
trailing slashes. This removes trailing slashes from our templates
where FastAPI is concerned to avoid unnecessary redirects.

There may still be links or usages around which have unnecessary
usages of a trailing slash; please keep a look out for these and
remove them where possible.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-18 22:42:40 -07:00
Kevin Morris
e05cfc3375
Merge branch 'fix-missing-tags' into pu 2021-10-18 22:17:29 -07:00
Kevin Morris
c588a4e82e
feat(FastAPI): add /packages (post)
The POST /packages route takes an `action`, `merge_into` and `confirm`
form data arguments. It then routes over to `action`'s callback provided
by `PACKAGE_ACTIONS`. This commit does not implement actions, but
mocks out the flow we would expect from the POST route.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-18 17:43:27 -07:00
Steven Guikal
db67e83bb8 fix(FastAPI): use elif statements where appropriate
Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-18 15:07:25 -04:00
Steven Guikal
7f72d78dcc fix(FastAPI): correct HTML tags and indentation
Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-18 14:51:01 -04:00
Kevin Morris
927f5e8567
feat(docker): add gunicorn support & production default
Supply FASTAPI_BACKEND=gunicorn and FASTAPI_WORKERS=<threads_num> to
docker-compose up to use the gunicorn backend.

This is defaulted in production to gunicorn, but FASTAPI_WORKERS
should definitely be configured by any production deployment.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-16 22:53:46 -07:00
Kevin Morris
28c4e9697b
change(fastapi): simplify model imports across code-base
Closes: #133

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-16 19:40:00 -07:00
Kevin Morris
bfdc85d7d6
change(rpc): use simplified models package
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-16 19:35:51 -07:00