doc: update CONTRIBUTING.md

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-03-14 05:55:19 -07:00
parent c149afb1f1
commit 7ddce6bb2d
No known key found for this signature in database
GPG key ID: F7E46DED420788F3

View file

@ -9,7 +9,7 @@ You can add a git hook to do this by installing `python-pre-commit` and running
`pre-commit install`. `pre-commit install`.
[1]: https://lists.archlinux.org/listinfo/aur-dev [1]: https://lists.archlinux.org/listinfo/aur-dev
[2]: https://gitlab.archlinunx.org/archlinux/aurweb [2]: https://gitlab.archlinux.org/archlinux/aurweb
### Coding Guidelines ### Coding Guidelines
@ -23,6 +23,76 @@ development.
3. Use four space indentation 3. Use four space indentation
4. Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) 4. Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
5. DRY: Don't Repeat Yourself 5. DRY: Don't Repeat Yourself
6. All code should be tested for good _and_ bad cases 6. All code should be tested for good _and_ bad cases (see [test/README.md][3])
[3]: https://gitlab.archlinux.org/archlinux/aurweb/-/blob/master/test/README.md
Test patches that increase coverage in the codebase are always welcome. Test patches that increase coverage in the codebase are always welcome.
### Coding Style
We use the `flake8` and `isort` tools to manage PEP-8 coherenace and
import ordering in this project.
There are plugins for editors or IDEs which automate this process. Some
example plugins:
- [tell-k/vim-autopep8](https://github.com/tell-k/vim-autopep8)
- [fisadev/vim-isort](https://github.com/fisadev/vim-isort)
- [prabirshrestha/vim-lsp](https://github.com/prabirshrestha/vim-lsp)
See `setup.cfg` for flake8 and isort specific rules.
Note: We are planning on switching to [psf/black](https://github.com/psf/black).
For now, developers should ensure that flake8 and isort passes when submitting
merge requests or patch sets.
### Development Environment
To get started with local development, an instance of aurweb must be
brought up. This can be done using the following sections:
- [Using Docker](#using-docker)
- [Using INSTALL](#using-install)
There are a number of services aurweb employs to run the application
in its entirety:
- ssh
- cron jobs
- starlette/fastapi asgi server
Project structure:
- `./aurweb`: `aurweb` Python package
- `./templates`: Jinja2 templates
- `./docker`: Docker scripts and configuration files
#### Using Docker
Using Docker, we can run the entire infrastructure in two steps:
# Build the aurweb:latest image
$ docker-compose build
# Start all services in the background
$ docker-compose up -d nginx
`docker-compose` services will generate a locally signed root certificate
at `./data/root_ca.crt`. Users can import this into ca-certificates or their
browser if desired.
Accessible services (on the host):
- https://localhost:8444 (python via nginx)
- https://localhost:8443 (php via nginx)
- localhost:13306 (mariadb)
- localhost:16379 (redis)
Docker services, by default, are setup to be hot reloaded when source code
is changed.
#### Using INSTALL
The [INSTALL](INSTALL) file describes steps to install the application on
bare-metal systems.