Create Docker

Kevin Morris 2021-09-05 07:20:31 +00:00
parent 367c401e03
commit b5fe6432df

54
Docker.md Normal file

@ -0,0 +1,54 @@
| Branch |
|--------|
| pu |
AURWeb's Docker infrastructure is composed of a [Dockerfile](https://gitlab.archlinux.org/archlinux/aurweb/-/tree/pu/Dockerfile) and [docker-compose.yml Services](https://gitlab.archlinux.org/archlinux/aurweb/-/tree/pu/docker-compose.yml).
| Service | Port | Purpose |
|---------------|-------|--------------------------------|
| ca | | Self-signed CA generation |
| memcached | | Live memcached service |
| redis | 16379 | Live Redis service |
| mariadb | 13306 | Live MariaDB service |
| git | 2222 | AUR Git repository |
| smartgit | | HTTP Git frontend |
| cgit-php | | CGit backend (PHP) |
| cgit-fastapi | | CGit backend (FastAPI) |
| php-fpm | 19000 | Live php-fpm service |
| fastapi | 18000 | Live $FASTAPI_BACKEND service |
| nginx | 8443 | Live nginx frontend to php-fpm |
| nginx | 8444 | Live nginx frontend to fastapi |
| sharness | | Run sharness test suites |
| pytest-mysql | | Run pytest suites with mariadb |
| pytest-sqlite | | Run pytest suites with sqlite |
| test | | Run all tests and linters |
## Getting Started
To get started, you need to build the `aurweb:latest` Docker image by issuing the following command:
$ docker build -t aurweb:latest .
You can then `docker-compose (up|run)` any one of the services.
## Development
During development, users may wish to run instances of FastAPI and PHP side by side. For this, users can depend on the `nginx` service, which hosts PHP at https://localhost:8443 and FastAPI at https://localhost:8444.
The `ca` service will generate a `ca.root.pem` file in `$aurweb_path/cache`, which can be imported into your browser as a Certificate Authority. This root is the issuer to the `nginx` service's certificates mentioned above.
Otherwise, users may also wish to run tests. Users can easily run tests by taking advantage of the `pytest-mysql`, `pytest-sqlite`, `sharness` and `test` services.
For an all in one testing strategy, the `test` service should be preferred, as it also runs linter checks which the aurweb project requires: flake8 and isort. This test is identical to GitLab CI's tests.
## Production
For production, the `fastapi` (exposed on localhost:18000) and `php-fpm` (exposed on localhost:19000) services can be used to supply back-ends to a host instance of nginx. The `git` service (exposed on localhost:2222) should be used for a Docker-contained AUR sshd.
These services will both share the `mariadb` service, which they depend on and will be started when starting higher services.
`smartgit` is not yet supported for deployment through Docker, unless using our internal services with it.
## Notes
This wiki document is not as specific and complete as it could be and it will be improved over time.