Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to add documentation on containers #3478

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions community-containers/caddy/caddy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions community-containers/fail2ban/fail2ban.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions community-containers/pi-hole/pi-hole.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions community-containers/plex/plex.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion community-containers/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions community-containers/vaultwarden/vaultwarden.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions php/containers-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
"type": "string",
"pattern": "^([a-z0-9.-]+|%AIO_CHANNEL%)$"
},
"documentation": {
"type": "string",
"pattern": "^https://.*$"
},
"devices": {
"type": "array",
"items": {
Expand Down
7 changes: 7 additions & 0 deletions php/src/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Container {
private bool $init;
private string $imageTag;
private AioVariables $aioVariables;
private string $documentation;
private DockerActionManager $dockerActionManager;

public function __construct(
Expand All @@ -60,6 +61,7 @@ public function __construct(
bool $init,
string $imageTag,
AioVariables $aioVariables,
string $documentation,
DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
Expand All @@ -84,6 +86,7 @@ public function __construct(
$this->init = $init;
$this->imageTag = $imageTag;
$this->aioVariables = $aioVariables;
$this->documentation = $documentation;
$this->dockerActionManager = $dockerActionManager;
}

Expand Down Expand Up @@ -193,4 +196,8 @@ public function GetEnvironmentVariables() : ContainerEnvironmentVariables {
public function GetAioVariables() : AioVariables {
return $this->aioVariables;
}

public function GetDocumentation() : string {
return $this->documentation;
}
}
6 changes: 6 additions & 0 deletions php/src/ContainerDefinitionFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ private function GetDefinition(): array
$imageTag = $entry['image_tag'];
}

$documentation = '';
if (isset($entry['documentation'])) {
$documentation = $entry['documentation'];
}

$containers[] = new Container(
$entry['container_name'],
$displayName,
Expand All @@ -327,6 +332,7 @@ private function GetDefinition(): array
$init,
$imageTag,
$aioVariables,
$documentation,
$this->container->get(DockerActionManager::class)
);
}
Expand Down
10 changes: 7 additions & 3 deletions php/templates/containers.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down