Merge pull request #3140 from nextcloud/enh/3052/add-init

add init flag to all containers
This commit is contained in:
Simon L 2023-08-17 09:39:05 +02:00 committed by GitHub
commit 5621a456f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 0 deletions

View file

@ -1,6 +1,7 @@
services:
nextcloud-aio-mastercontainer:
image: nextcloud/all-in-one:latest
init: true
restart: always
container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
volumes:

View file

@ -2,6 +2,7 @@
If you want to switch to the develop channel, you simply stop and delete the mastercontainer and create a new one with a changed tag to develop:
```shell
sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \

View file

@ -137,6 +137,9 @@
"read_only": {
"type": "boolean"
},
"init": {
"type": "boolean"
},
"tmpfs": {
"type": "array",
"items": {

View file

@ -11,6 +11,7 @@
],
"display_name": "Apache",
"image": "nextcloud/aio-apache",
"init": true,
"ports": [
{
"ip_binding": "%APACHE_IP_BINDING%",
@ -69,6 +70,7 @@
"container_name": "nextcloud-aio-database",
"display_name": "Database",
"image": "nextcloud/aio-postgresql",
"init": true,
"expose": [
"5432"
],
@ -122,6 +124,7 @@
],
"display_name": "Nextcloud",
"image": "nextcloud/aio-nextcloud",
"init": true,
"expose": [
"9000"
],
@ -218,6 +221,7 @@
"container_name": "nextcloud-aio-notify-push",
"display_name": "Notify Push",
"image": "nextcloud/aio-notify-push",
"init": true,
"expose": [
"7867"
],
@ -253,6 +257,7 @@
"container_name": "nextcloud-aio-redis",
"display_name": "Redis",
"image": "nextcloud/aio-redis",
"init": true,
"expose": [
"6379"
],
@ -283,6 +288,7 @@
"container_name": "nextcloud-aio-collabora",
"display_name": "Collabora",
"image": "nextcloud/aio-collabora",
"init": true,
"expose": [
"9980"
],
@ -311,6 +317,7 @@
"container_name": "nextcloud-aio-talk",
"display_name": "Talk",
"image": "nextcloud/aio-talk",
"init": true,
"ports": [
{
"ip_binding": "",
@ -361,6 +368,7 @@
"container_name": "nextcloud-aio-talk-recording",
"display_name": "Talk Recording",
"image": "nextcloud/aio-talk-recording",
"init": true,
"expose": [
"1234"
],
@ -392,6 +400,7 @@
{
"container_name": "nextcloud-aio-borgbackup",
"image": "nextcloud/aio-borgbackup",
"init": true,
"environment": [
"BORG_PASSWORD=%BORGBACKUP_PASSWORD%",
"BORG_MODE=%BORGBACKUP_MODE%",
@ -453,6 +462,7 @@
{
"container_name": "nextcloud-aio-watchtower",
"image": "nextcloud/aio-watchtower",
"init": true,
"environment": [
"CONTAINER_TO_UPDATE=nextcloud-aio-mastercontainer"
],
@ -468,6 +478,7 @@
{
"container_name": "nextcloud-aio-domaincheck",
"image": "nextcloud/aio-domaincheck",
"init": true,
"ports": [
{
"ip_binding": "%APACHE_IP_BINDING%",
@ -494,6 +505,7 @@
"container_name": "nextcloud-aio-clamav",
"display_name": "ClamAV",
"image": "nextcloud/aio-clamav",
"init": true,
"expose": [
"3310"
],
@ -527,6 +539,7 @@
"container_name": "nextcloud-aio-onlyoffice",
"display_name": "OnlyOffice",
"image": "nextcloud/aio-onlyoffice",
"init": true,
"expose": [
"80"
],
@ -559,6 +572,7 @@
"container_name": "nextcloud-aio-imaginary",
"display_name": "Imaginary",
"image": "nextcloud/aio-imaginary",
"init": true,
"expose": [
"9000"
],
@ -585,6 +599,7 @@
"container_name": "nextcloud-aio-fulltextsearch",
"display_name": "Fulltextsearch",
"image": "nextcloud/aio-fulltextsearch",
"init": false,
"expose": [
"9200"
],

View file

@ -32,6 +32,7 @@ class Container {
private array $nextcloudExecCommands;
private bool $readOnlyRootFs;
private array $tmpfs;
private bool $init;
private DockerActionManager $dockerActionManager;
public function __construct(
@ -54,6 +55,7 @@ class Container {
array $nextcloudExecCommands,
bool $readOnlyRootFs,
array $tmpfs,
bool $init,
DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
@ -75,6 +77,7 @@ class Container {
$this->nextcloudExecCommands = $nextcloudExecCommands;
$this->readOnlyRootFs = $readOnlyRootFs;
$this->tmpfs = $tmpfs;
$this->init = $init;
$this->dockerActionManager = $dockerActionManager;
}
@ -98,6 +101,10 @@ class Container {
return $this->readOnlyRootFs;
}
public function GetInit() : bool {
return $this->init;
}
public function GetShmSize() : int {
return $this->shmSize;
}

View file

@ -272,6 +272,11 @@ class ContainerDefinitionFetcher
$tmpfs = $entry['tmpfs'];
}
$init = true;
if (isset($entry['init'])) {
$init = $entry['init'];
}
$containers[] = new Container(
$entry['container_name'],
$displayName,
@ -292,6 +297,7 @@ class ContainerDefinitionFetcher
$nextcloudExecCommands,
$readOnlyRootFs,
$tmpfs,
$init,
$this->container->get(DockerActionManager::class)
);
}

View file

@ -450,6 +450,8 @@ class DockerActionManager
$requestBody['HostConfig']['Tmpfs'] = $tmpfs;
}
$requestBody['HostConfig']['Init'] = $container->GetInit();
$capAdds = $container->GetCapAdds();
if (count($capAdds) > 0) {
$requestBody['HostConfig']['CapAdd'] = $capAdds;

View file

@ -87,6 +87,7 @@ The following instructions are meant for installations without a web server or r
```
# For Linux and without a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else) already in place:
sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
@ -101,6 +102,7 @@ The following instructions are meant for installations without a web server or r
<summary>Explanation of the command</summary>
- `sudo docker run` This command spins up a new docker container. Docker commands can optionally be used without `sudo` if the user is added to the docker group (this is not the same as docker rootless, see FAQ below).
- `--init` This option makes sure that no zombie-processes are created, ever. See https://docs.docker.com/engine/reference/run/#specify-an-init-process
- `--sig-proxy=false` This option allows to exit the container shell that gets attached automatically when using `docker run` by using `[CTRL] + [C]` without shutting down the container.
- `--name nextcloud-aio-mastercontainer` This is the name of the container. This line is not allowed to be changed, since mastercontainer updates would fail.
- `--restart always` This is the "restart policy". `always` means that the container should always get started with the Docker daemon. See the Docker documentation for further detail about restart policies: https://docs.docker.com/config/containers/start-containers-automatically/
@ -157,6 +159,7 @@ On Windows, install [Docker Desktop](https://www.docker.com/products/docker-desk
```
docker run ^
--init ^
--sig-proxy=false ^
--name nextcloud-aio-mastercontainer ^
--restart always ^

View file

@ -604,6 +604,7 @@ After adjusting your reverse proxy config, use the following command to start AI
```
# For Linux:
sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
@ -629,6 +630,7 @@ On Windows, install [Docker Desktop](https://www.docker.com/products/docker-desk
```
docker run ^
--init ^
--sig-proxy=false ^
--name nextcloud-aio-mastercontainer ^
--restart always ^