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>
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 ...
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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`.
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>
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>
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>
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>
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>
This gives developers the ability to import models without importing
them directly from their module:
from aurweb.models import Ban, AccountType
This provides more conciseness:
from aurweb import models
def some_func(ban: models.Ban):
pass
def some_other_func(user: models.User):
pass
This more aligns with a Django-style of core model bases.
NOTE: Docker images must be rebuilt with this change, as setup.cfg
has changed. Old Docker images will cause flake8 violation reports.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Usage of EXPECTATION_FAILED in these cases is totally wrong.
EXPECTATION_FAILED is a failure in terms of the HTTP protocol,
not user input. Change all usage of EXPECTATION_FAILED to BAD_REQUEST.
Signed-off-by: Kevin Morris <kevr@0cost.org>