aurweb/doc/docker.md
Kevin Morris 5e52bafb5c
add doc/docker.md & update README.md
Changes to README.md:
- Added Documentation links to various documents in the repository.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-01-19 08:13:35 -08:00

4.7 KiB

Table of Contents

Getting Started Profiles Services

Note: The docker-compose infrastructure is experimental and in need of improvements.

Getting Started

See Profiles for details about using the different profiles setup for aurweb. The following examples use the default profile.

Begin by building aurweb:latest off the current revision:

$ docker-compose build

You can run tests:

$ docker-compose run test

Or, start the development server:

$ docker-compose up -d nginx

See nginx for details on connecting to the local instance.

Profiles

Name Options
default docker-compose ...
aur-dev docker-compose -f docker-compose.yml -f docker-compose.aur-dev.yml ...

default

Default development profile intended to be used on local systems.

aur-dev

Production profile used for deployments to aur-dev.archlinux.org.

Services

Service Host Binding
ca
cron
mariadb 127.0.0.1:13306
git 127.0.0.1:2222
redis 127.0.0.1:16379
php-fpm 127.0.0.1:19000
cgit-php
fastapi 127.0.0.1:18000
cgit-fastapi
nginx (fastapi) 127.0.0.1:8444
nginx (php) 127.0.0.1:8443

There are more services which have not been referred to here; the services listed above encompass all notable services. Some services have their own section, defined below, which lie down specifics.

ca

The ca service provides a certificate authority driven by step-ca. When no certificates can be found, the ca services self-signs a new root ca certificate and a localhost certificate to be used by nginx.

The generated root ca certificate, after generation, will be located at ./data/root_ca.crt and can be imported into ca_certificates anchors or browsers for SSL verification.

cron

The cron service includes all scripts recommended in doc/maintenance.txt.

mariadb

  • When used with the default profile, a Docker-driven mariadb service is used.
  • When used with the aur-dev profile, MARIADB_SOCKET_DIR (defaulted to /var/run/mysqld/) can be defined to bind-mount a host-driven mariadb socket to the container.

git

The git service provides an ssh interface to a repository configured to be used for the AUR.

  • When used with the default profile, a Docker-driven volume is used to manage the repository.
  • When used with the aur-dev profile, GIT_DATA_DIR should be set to a directory found on the host to be used for a bind-mounted repository.

This service will perform setup in either case if the repository is not yet initialized.

php-fpm

When running any services which use the php-fpm backend or other php-related services, users should define:

  • AURWEB_PHP_PREFIX
    • Default: https://localhost:8443
  • AURWEB_SSHD_PREFIX
    • Default: ssh://aur@localhost:2222

fastapi

The fastapi service hosts a gunicorn, uvicorn or hypercorn asgi server. The backend and worker count can be configured using the following variables:

  • FASTAPI_BACKEND
    • Default: uvicorn
    • Valid: gunicorn, uvicorn, hypercorn
  • FASTAPI_WORKERS
    • Default: 2

Additionally, when running any services which use the fastapi backend or other fastapi-related services, users should define:

  • AURWEB_FASTAPI_PREFIX
    • Default: https://localhost:8444
  • AURWEB_SSHD_PREFIX
    • Default: ssh://aur@localhost:2222

nginx

The nginx service binds to two host endpoints: 127.0.0.1:8444 (fastapi) and 127.0.0.1:8443 (php). Each instance is available over the https protocol as noted in the table below.

Impl Host Binding URL
Python 127.0.0.1:8444 https://localhost:8444
PHP 127.0.0.1:8443 https://localhost:8443

When running this service, the following variables should be defined:

  • AURWEB_FASTAPI_PREFIX
    • Default: https://localhost:8444
  • AURWEB_PHP_PREFIX
    • Default: https://localhost:8443
  • AURWEB_SSHD_PREFIX
    • Default: ssh://aur@localhost:2222