Skip to content

Commit 145be0d

Browse files
committed
Improve documentation
1 parent 131a04d commit 145be0d

15 files changed

+377
-107
lines changed

contributing.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributing to Dirigent
2+
3+
Dirigent is an open-source project, contributions of all kind are welcome, including
4+
[financial contributions][codedmonkey-sponsor].
5+
6+
## Running Dirigent locally
7+
8+
To run Dirigent locally, follow the [Running from source code][dirigent-docs-install-source] guide in the documentation,
9+
up to the *Configure services* section.
10+
11+
Additional requirements:
12+
13+
- Symfony binary
14+
- Docker
15+
16+
```shell
17+
# Optionally, copy the example Docker Compose configuration override file
18+
cp compose.override.example.yaml composer.override.yaml
19+
20+
# Start Docker services
21+
docker compose up -d
22+
23+
# Start Symfony local server
24+
symfony server:start -d
25+
```
26+
27+
## Lint & test your code
28+
29+
### Running PHPUnit tests
30+
31+
Before running the tests, make sure the testing database is ready:
32+
33+
```shell
34+
symfony console --env=test doctrine:database:create --if-not-exists
35+
symfony console --env=test doctrine:schema:update --force
36+
symfony console --env=test doctrine:fixtures:load --no-interaction
37+
```
38+
39+
Run the PHPUnit tests:
40+
41+
```shell
42+
symfony run bin/phpunit
43+
```
44+
45+
[codedmonkey-sponsor]: https://www.codedmonkey.com/sponsor?project=dirigent
46+
[dirigent-docs-install-source]: https://dirigent.dev/docs/installation/source

docs/automatic-package-updates.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
---
2-
sidebar_position: 4
2+
sidebar_position: 30
33
---
44

5-
# Automatic Package Updates
5+
# Automatic package updates
6+
7+
:::note
8+
9+
This page is a stub.
10+
11+
:::
612

713
There are currently two ways to automatically update the packages in Dirigent:
814

docs/configuration-reference.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
11
---
2+
sidebar_label: Configuration reference
23
sidebar_position: 99
34
---
45

5-
# Dirigent Configuration Reference
6+
# Dirigent configuration reference
7+
8+
Dirigent uses the [Symfony][symfony] framework under the hood. Refer to the [Symfony documentation][symfony-docs-config]
9+
to learn how the configuration system works.
10+
11+
When using the standalone image, any JSON or YAML file located directly in the `/srv/config` directory will be loaded
12+
as a Symfony configuration file.
13+
14+
## Example configuration
15+
16+
```yaml
17+
# dirigent.yaml
18+
dirigent:
19+
title: 'My Dirigent'
20+
slug: null
21+
security:
22+
public: false
23+
registration: false
24+
# not supported by the standalone image
25+
#storage:
26+
# path: '%kernel.project_dir%/storage'
27+
packages:
28+
dynamic_updates: true
29+
dynamic_update_delay: 'PT4H'
30+
periodic_updates: true
31+
periodic_update_interval: 'P1W'
32+
dist_mirroring:
33+
enabled: false
34+
preferred: true
35+
dev_packages: false
36+
```
637
738
## dirigent (root)
839
@@ -88,26 +119,6 @@ Whether to enable or disable distribution mirroring
88119

89120
### dev_packages
90121

91-
## Example configuration
92-
93-
```yaml
94-
dirigent:
95-
title: My Dirigent
96-
slug: my-dirigent
97-
security:
98-
public: false
99-
registration: false
100-
storage:
101-
path: '%kernel.project_dir%/storage'
102-
packages:
103-
dynamic_updates: true
104-
dynamic_update_delay: true
105-
periodic_updates: true
106-
periodic_update_interval: true
107-
dist_mirroring:
108-
enabled: true
109-
preferred: true
110-
dev_packages: false
111-
```
112-
113122
[iso-8601-durations]: https://en.wikipedia.org/wiki/ISO_8601#Durations
123+
[symfony]: https://symfony.com
124+
[symfony-docs-config]: https://symfony.com/doc/current/configuration.html

docs/dist-mirroring.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
---
2-
sidebar_position: 5
2+
sidebar_position: 31
33
---
44

5-
# Dist Mirroring
5+
# Dist mirroring
6+
7+
:::note
8+
9+
This page is a stub.
10+
11+
:::
612

713
It's possible to mirror distributions of packages in Dirigent.
814

docs/getting-started.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
2-
sidebar_position: 3
2+
sidebar_label: Getting started
3+
sidebar_position: 20
34
---
45

5-
# Getting Started with Dirigent
6+
# Getting started with Dirigent
67

78
Make sure you've followed the [installation][docs-install] guide before continuing.
89

@@ -11,17 +12,19 @@ Make sure you've followed the [installation][docs-install] guide before continui
1112
When accessing the login page of Dirigent for the first time, you'll be redirected to the registration page (even if
1213
registration is disabled). The first account created automatically gets an Owner role in the application.
1314

14-
## Mirror public packages
15+
## Mirror public packages (packagist.org)
1516

1617
After installing Dirigent, the [Packagist registry][packagist] is added as an external registry which makes it possible
1718
to mirror public packages. Dirigent is initially configured to only mirror packages explicitly added by an
1819
administrator.
1920

20-
To enable mirroring of public packages on request, (as an administrator) open the "Registries" page, locate the
21+
To enable mirroring of public packages on request, open the "Registries" page (as an administrator), locate the
2122
Packagist registry, click the three dots and click "Edit". Find the "Package Mirroring" option and select "Automatically
2223
mirror packages on request". Save the registry for the changes to take effect.
2324

24-
## Add packages
25+
## Read the documentation
2526

26-
[docs-install]: install.md
27+
The usage and administration documentation is included in the application.
28+
29+
[docs-install]: installation/readme.md
2730
[packagist]: https://packagist.org

docs/install.md

Lines changed: 0 additions & 70 deletions
This file was deleted.

docs/installation/_category_.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
label: Installation
2+
position: 10
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
sidebar_label: Docker Compose
3+
sidebar_position: 2
4+
---
5+
6+
# Install Dirigent using Docker Compose
7+
8+
:::note
9+
10+
This page is a stub.
11+
12+
:::
13+
14+
## Example configuration file
15+
16+
```yaml
17+
services:
18+
database:
19+
image: postgres:${POSTGRES_VERSION:-16}-alpine
20+
environment:
21+
POSTGRES_DB: ${POSTGRES_DB:-dirigent}
22+
# You should definitely change the password
23+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
24+
POSTGRES_USER: ${POSTGRES_USER:-dirigent}
25+
healthcheck:
26+
test: ["CMD", "pg_isready"]
27+
timeout: 5s
28+
retries: 5
29+
start_period: 60s
30+
volumes:
31+
- ./postgres-data:/var/lib/postgresql/data:rw
32+
```
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
sidebar_label: Standalone Docker image
3+
sidebar_position: 1
4+
---
5+
6+
# Install Dirigent using the standalone Docker image
7+
8+
The easiest way to install Dirigent is by using our standalone Docker images, which bundle all services required for
9+
Dirigent into one, including a web server, database and a background worker. The standalone Docker images are available
10+
[on GitHub][github-docker-images].
11+
12+
## Examples
13+
14+
### Docker command
15+
16+
```bash
17+
docker volume create dirigent-data
18+
19+
docker container run -d \
20+
--name dirigent \
21+
-p "7015:7015" \
22+
-v /path/to/dirigent/config:/srv/config \
23+
-v dirigent-data:/srv/data \
24+
ghcr.io/codedmonkey/dirigent:0.3
25+
```
26+
27+
### Docker Compose configuration
28+
29+
```yaml
30+
services:
31+
dirigent:
32+
image: ghcr.io/codedmonkey/dirigent:0.3
33+
ports:
34+
- "7015:7015"
35+
volumes:
36+
- ./config:/srv/config
37+
- data:/srv/data
38+
39+
volumes:
40+
data:
41+
```
42+
43+
## Volumes
44+
45+
Both the `/srv/config` and `/srv/data` directories are configured as volumes, both need to be retained as the config
46+
directory contains encryption keys for sensitive data so make sure to mount it. It's recommend to store the
47+
configuration and data in separate locations, see our [security guide](../security.md) for more information.
48+
49+
## Configuring Dirigent in the image
50+
51+
When booting from the Docker image, Dirigent will look for custom configuration in the `/srv/config` directory. Make
52+
sure to mount it in the container as a volume, in the example Docker Compose configuration it's mounted from the
53+
`config/` directory located in your Docker Compose project.
54+
55+
Create a file in the config directory called `dirigent.yaml` and add the following contents:
56+
57+
```yaml
58+
dirigent:
59+
title: My Dirigent
60+
slug: my-dirigent
61+
security:
62+
public: false # Only enable public access if your instance is located behind a firewall
63+
registration: false # Only enable registration if your instance is located behind a firewall
64+
```
65+
66+
For a complete list of configuration options, see the [Configuration Reference][docs-configuration-reference].
67+
68+
## Running the image
69+
70+
After following the steps above you're ready to boot the image, so run the Docker command to start your
71+
container.
72+
73+
By default, Dirigent is exposed on port `7015` so go to `http://localhost:7015` in your browser to access your
74+
Dirigent installation.
75+
76+
_Note that Composer requires registries to use https by default._
77+
78+
Now that you've installed Dirigent on your system, it's time to [get started][docs-getting-started]!
79+
80+
## Building the standalone Docker image
81+
82+
To build the standalone Docker image, clone [the Dirigent repository][github] and checkout the version or
83+
commit you want to build. Simply run the `docker build` command inside the repository to build the image.
84+
85+
```shell
86+
git clone https://github.com/codedmonkey/dirigent.git
87+
cd dirigent
88+
git checkout v0.3.1
89+
docker build -t dirigent-standalone .
90+
```
91+
92+
### Change UID and GID
93+
94+
The standalone Docker image runs as user `1000:1000`. To run the image with a different UID or GID, you can pass both
95+
a `UID` and `GID` build argument to the `docker build` command.
96+
97+
```shell
98+
docker build -t dirigent-standalone --build-arg UID=1011 --build-arg GID=1110 .
99+
```
100+
101+
[docs-configuration-reference]: ../configuration-reference.md
102+
[docs-getting-started]: ../getting-started.md
103+
[github]: https://github.com/codedmonkey/dirigent
104+
[github-docker-images]: https://github.com/codedmonkey/dirigent/pkgs/container/dirigent

0 commit comments

Comments
 (0)