Skip to content

Commit c1c96ee

Browse files
committed
allow to add documentation on containers
Signed-off-by: Simon L <[email protected]>
1 parent ec6448f commit c1c96ee

File tree

10 files changed

+30
-4
lines changed

10 files changed

+30
-4
lines changed

community-containers/caddy/caddy.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"container_name": "nextcloud-aio-caddy",
55
"display_name": "Caddy with geoblocking",
6+
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/caddy",
67
"image": "szaimen/aio-caddy",
78
"image_tag": "v1",
89
"internal_port": "443",

community-containers/fail2ban/fail2ban.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"container_name": "nextcloud-aio-fail2ban",
55
"display_name": "Fail2ban",
6+
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/fail2ban",
67
"image": "szaimen/aio-fail2ban",
78
"image_tag": "v1",
89
"internal_port": "host",

community-containers/pi-hole/pi-hole.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"container_name": "nextcloud-aio-pihole",
55
"display_name": "Pi-hole",
6+
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/pi-hole",
67
"image": "pihole/pihole",
78
"image_tag": "latest",
89
"internal_port": "8573",

community-containers/plex/plex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"container_name": "nextcloud-aio-plex",
55
"display_name": "Plex",
6+
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/plex",
67
"image": "plexinc/pms-docker",
78
"image_tag": "latest",
89
"internal_port": "host",

community-containers/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ All containers that are in this directory are community maintained so the respon
1010
You might want to add additional community containers to the default AIO stack. You can do so by adding `--env AIO_COMMUNITY_CONTAINERS="container1 container2"` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must match the folder names in this directory! ⚠️⚠️⚠️ Please review the folder for documentation on each of the containers before adding them! Not reviewing the documentation for each of them first might break starting the AIO containers because e.g. fail2ban only works on Linux and not on Docker Desktop!
1111

1212
## How to add containers?
13-
Simply submit a PR by creating a new folder in this directory: https://github.com/nextcloud/all-in-one/tree/main/community-containers with the name of your container. It must include a json file with the same name and with correct syntax and a readme.md with additional information. You might get inspired by fail2ban, plex, pi-hole or vaultwarden (subfolders in this directory). For a full-blown example of the json file, see https://github.com/nextcloud/all-in-one/blob/main/php/containers.json. The json-schema that it validates against can be found here: https://github.com/nextcloud/all-in-one/blob/main/php/containers-schema.json.
13+
Simply submit a PR by creating a new folder in this directory: https://github.com/nextcloud/all-in-one/tree/main/community-containers with the name of your container. It must include a json file with the same name and with correct syntax and a readme.md with additional information. You might get inspired by caddy, fail2ban, plex, pi-hole or vaultwarden (subfolders in this directory). For a full-blown example of the json file, see https://github.com/nextcloud/all-in-one/blob/main/php/containers.json. The json-schema that it validates against can be found here: https://github.com/nextcloud/all-in-one/blob/main/php/containers-schema.json.

community-containers/vaultwarden/vaultwarden.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"container_name": "nextcloud-aio-vaultwarden",
55
"display_name": "Vaultwarden",
6+
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/vaultwarden",
67
"image": "vaultwarden/server",
78
"image_tag": "alpine",
89
"internal_port": "8812",

php/containers-schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@
108108
"type": "string",
109109
"pattern": "^([a-z0-9.-]+|%AIO_CHANNEL%)$"
110110
},
111+
"documentation": {
112+
"type": "string",
113+
"pattern": "^https://.*$"
114+
},
111115
"devices": {
112116
"type": "array",
113117
"items": {

php/src/Container/Container.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Container {
3535
private bool $init;
3636
private string $imageTag;
3737
private AioVariables $aioVariables;
38+
private string $documentation;
3839
private DockerActionManager $dockerActionManager;
3940

4041
public function __construct(
@@ -60,6 +61,7 @@ public function __construct(
6061
bool $init,
6162
string $imageTag,
6263
AioVariables $aioVariables,
64+
string $documentation,
6365
DockerActionManager $dockerActionManager
6466
) {
6567
$this->identifier = $identifier;
@@ -84,6 +86,7 @@ public function __construct(
8486
$this->init = $init;
8587
$this->imageTag = $imageTag;
8688
$this->aioVariables = $aioVariables;
89+
$this->documentation = $documentation;
8790
$this->dockerActionManager = $dockerActionManager;
8891
}
8992

@@ -193,4 +196,8 @@ public function GetEnvironmentVariables() : ContainerEnvironmentVariables {
193196
public function GetAioVariables() : AioVariables {
194197
return $this->aioVariables;
195198
}
199+
200+
public function GetDocumentation() : string {
201+
return $this->documentation;
202+
}
196203
}

php/src/ContainerDefinitionFetcher.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ private function GetDefinition(): array
304304
$imageTag = $entry['image_tag'];
305305
}
306306

307+
$documentation = '';
308+
if (isset($entry['documentation'])) {
309+
$documentation = $entry['documentation'];
310+
}
311+
307312
$containers[] = new Container(
308313
$entry['container_name'],
309314
$displayName,
@@ -327,6 +332,7 @@ private function GetDefinition(): array
327332
$init,
328333
$imageTag,
329334
$aioVariables,
335+
$documentation,
330336
$this->container->get(DockerActionManager::class)
331337
);
332338
}

php/templates/containers.twig

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,19 @@
255255
{% for container in containers %}
256256
{% if container.GetDisplayName() != '' %}
257257
<li>
258+
{% set displayName = container.GetDisplayName() %}
259+
{% if container.GetDocumentation() != '' %}
260+
{% set displayName = '<a href="' ~ container.GetDocumentation() ~ '">' ~ displayName ~ '</a>' %}
261+
{% endif %}
258262
{% if class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %}
259263
<span class="status running"></span>
260-
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Starting</a>)</span>
264+
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Starting</a>)</span>
261265
{% elseif class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
262266
<span class="status success"></span>
263-
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Running</a>)</span>
267+
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Running</a>)</span>
264268
{% else %}
265269
<span class="status error"></span>
266-
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Stopped</a>)</span>
270+
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Stopped</a>)</span>
267271
{% endif %}
268272
</li>
269273
{% endif %}

0 commit comments

Comments
 (0)