allow to add documentation on containers

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-10-03 20:30:46 +02:00
parent ec6448fe5f
commit c1c96ee08a
10 changed files with 30 additions and 4 deletions

View file

@ -3,6 +3,7 @@
{
"container_name": "nextcloud-aio-caddy",
"display_name": "Caddy with geoblocking",
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/caddy",
"image": "szaimen/aio-caddy",
"image_tag": "v1",
"internal_port": "443",

View file

@ -3,6 +3,7 @@
{
"container_name": "nextcloud-aio-fail2ban",
"display_name": "Fail2ban",
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/fail2ban",
"image": "szaimen/aio-fail2ban",
"image_tag": "v1",
"internal_port": "host",

View file

@ -3,6 +3,7 @@
{
"container_name": "nextcloud-aio-pihole",
"display_name": "Pi-hole",
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/pi-hole",
"image": "pihole/pihole",
"image_tag": "latest",
"internal_port": "8573",

View file

@ -3,6 +3,7 @@
{
"container_name": "nextcloud-aio-plex",
"display_name": "Plex",
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/plex",
"image": "plexinc/pms-docker",
"image_tag": "latest",
"internal_port": "host",

View file

@ -10,4 +10,4 @@ All containers that are in this directory are community maintained so the respon
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!
## How to add containers?
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.
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.

View file

@ -3,6 +3,7 @@
{
"container_name": "nextcloud-aio-vaultwarden",
"display_name": "Vaultwarden",
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/vaultwarden",
"image": "vaultwarden/server",
"image_tag": "alpine",
"internal_port": "8812",

View file

@ -108,6 +108,10 @@
"type": "string",
"pattern": "^([a-z0-9.-]+|%AIO_CHANNEL%)$"
},
"documentation": {
"type": "string",
"pattern": "^https://.*$"
},
"devices": {
"type": "array",
"items": {

View file

@ -35,6 +35,7 @@ class Container {
private bool $init;
private string $imageTag;
private AioVariables $aioVariables;
private string $documentation;
private DockerActionManager $dockerActionManager;
public function __construct(
@ -60,6 +61,7 @@ class Container {
bool $init,
string $imageTag,
AioVariables $aioVariables,
string $documentation,
DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
@ -84,6 +86,7 @@ class Container {
$this->init = $init;
$this->imageTag = $imageTag;
$this->aioVariables = $aioVariables;
$this->documentation = $documentation;
$this->dockerActionManager = $dockerActionManager;
}
@ -193,4 +196,8 @@ class Container {
public function GetAioVariables() : AioVariables {
return $this->aioVariables;
}
public function GetDocumentation() : string {
return $this->documentation;
}
}

View file

@ -304,6 +304,11 @@ class ContainerDefinitionFetcher
$imageTag = $entry['image_tag'];
}
$documentation = '';
if (isset($entry['documentation'])) {
$documentation = $entry['documentation'];
}
$containers[] = new Container(
$entry['container_name'],
$displayName,
@ -327,6 +332,7 @@ class ContainerDefinitionFetcher
$init,
$imageTag,
$aioVariables,
$documentation,
$this->container->get(DockerActionManager::class)
);
}

View file

@ -255,15 +255,19 @@
{% for container in containers %}
{% if container.GetDisplayName() != '' %}
<li>
{% set displayName = container.GetDisplayName() %}
{% if container.GetDocumentation() != '' %}
{% set displayName = '<a href="' ~ container.GetDocumentation() ~ '">' ~ displayName ~ '</a>' %}
{% endif %}
{% if class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %}
<span class="status running"></span>
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Starting</a>)</span>
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Starting</a>)</span>
{% elseif class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
<span class="status success"></span>
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Running</a>)</span>
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Running</a>)</span>
{% else %}
<span class="status error"></span>
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Stopped</a>)</span>
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Stopped</a>)</span>
{% endif %}
</li>
{% endif %}