Compare commits

..

181 Commits

Author SHA1 Message Date
Simon L
85b445d576 Merge pull request #327 from nextcloud/enh/271/add-docs-for-datadir
add docs for changing the datadir
2022-03-09 15:29:16 +01:00
szaimen
52651559de don't allow to change the password if apache is starting
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 14:28:03 +01:00
szaimen
36fd28da6f fix styling for password change
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 14:18:51 +01:00
Simon L
77979aaa4a Merge pull request #334 from nextcloud/enh/noid/revert-migrating-borg-to-alpine
revert migrating borg to alpine
2022-03-09 13:52:42 +01:00
szaimen
5f753665ac revert migrating borg to alpine
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 13:49:09 +01:00
szaimen
e7ec998913 fix backup container build
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 13:23:44 +01:00
Simon L
91c7f13171 Merge pull request #332 from nextcloud/enh/noid/0.7.0
increase version to 0.7.0
2022-03-09 12:42:12 +01:00
Simon L
d170feb1e7 Merge pull request #326 from nextcloud/enh/271/allow-to-change-datadir
allow to change the location of Nextclouds datadir
2022-03-09 12:41:58 +01:00
Simon L
1a55b94b93 Merge pull request #330 from nextcloud/enh/noid/add-optional-section
add optional section
2022-03-09 12:41:38 +01:00
Simon L
a0656364b1 Merge pull request #329 from nextcloud/enh/272/allow-to-change-the-password
allow to change the password
2022-03-09 12:41:18 +01:00
Simon L
20c46a3809 Merge pull request #328 from nextcloud/enh/noid/check-startup-command
check if the startup command was executed successfully
2022-03-09 12:40:44 +01:00
Simon L
866519be88 Merge pull request #331 from nextcloud/enh/310/improve-domain-check
improve domain check
2022-03-09 12:40:22 +01:00
szaimen
cfc157f672 increase version to 0.7.0
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 12:39:51 +01:00
szaimen
8b813fe950 fix backup restore
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 12:37:43 +01:00
szaimen
c1a5262769 fix collabora
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 12:21:37 +01:00
szaimen
5b8de658c7 improve domain check
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-09 11:59:44 +01:00
szaimen
0b51eab553 add optional section
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-08 22:09:12 +01:00
szaimen
c8854ab1e3 allow to change the password
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-08 21:23:55 +01:00
szaimen
7a18cf766d check if the startup command was executed successfully
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-08 18:36:08 +01:00
szaimen
213de472a6 add docs for changing the datadir
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-08 17:53:03 +01:00
szaimen
c9be73601d catch the case that datadir and mount are equal
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-08 17:20:28 +01:00
szaimen
e2a6231257 allow to change the location of Nextclouds datadir
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-08 17:20:27 +01:00
Simon L
b929d57a77 Merge pull request #325 from nextcloud/enh/noid/correctly-delete-old-sessions
correctly delete sessions older than 24h
2022-03-08 15:50:56 +01:00
Simon L
0168b29882 Merge pull request #313 from nextcloud/enh/noid/database-safeguard
don't update database container if it failed before
2022-03-08 15:47:38 +01:00
Simon L
8836a884fb Merge pull request #306 from nextcloud/enh/205/migrate-borg-to-alpine
migrate borgbackup to alpine
2022-03-08 15:44:22 +01:00
Simon L
6adae6db3e Merge pull request #307 from nextcloud/enh/276/channel-and-changelog
show the current channel and add links to the changelogs
2022-03-08 15:43:37 +01:00
Simon L
0071703a24 Merge pull request #311 from nextcloud/aio-dependency-update
Dependency updates
2022-03-08 15:42:40 +01:00
Simon L
3af23d5a5c Merge pull request #312 from nextcloud/dependabot/docker/Containers/talk/ubuntu-focal-20220302
Bump ubuntu from focal-20220113 to focal-20220302 in /Containers/talk
2022-03-08 15:41:41 +01:00
szaimen
17eb732a89 correctly delete sessions older than 24h
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-08 15:32:09 +01:00
szaimen
68ddc72e9b don't update database container if it failed before
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-04 15:36:08 +01:00
dependabot[bot]
a03478c5d0 Bump ubuntu from focal-20220113 to focal-20220302 in /Containers/talk
Bumps ubuntu from focal-20220113 to focal-20220302.

---
updated-dependencies:
- dependency-name: ubuntu
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-04 13:00:16 +00:00
szaimen
6e8aea3aeb dependency updates
Signed-off-by: GitHub <noreply@github.com>
2022-03-04 12:14:44 +00:00
dependabot[bot]
2caa883453 Merge pull request #309 from nextcloud/dependabot/docker/Containers/collabora/collabora/code-21.11.2.4.1 2022-03-03 12:38:25 +00:00
dependabot[bot]
1edcc4ef5f Bump collabora/code in /Containers/collabora
Bumps collabora/code from 21.11.2.3.1 to 21.11.2.4.1.

---
updated-dependencies:
- dependency-name: collabora/code
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-03 12:27:42 +00:00
Simon L
10f62ac401 Merge pull request #301 from nextcloud/enh/noid/improve-update-check
also show up-to-date if the checks return null
2022-03-02 18:28:47 +01:00
Simon L
f8f50e9186 Merge pull request #305 from nextcloud/enh/299/sync-to-other-drive
add docs for additional backup sync to another drive
2022-03-02 18:28:32 +01:00
Simon L
a3e3dd4534 Merge pull request #297 from nextcloud/dependabot/docker/Containers/apache/debian-bullseye-20220228-slim
Bump debian from bullseye-20220125-slim to bullseye-20220228-slim in /Containers/apache
2022-03-02 18:27:27 +01:00
Simon L
a6286a291f Merge pull request #298 from nextcloud/dependabot/docker/Containers/collabora/collabora/code-21.11.2.3.1
Bump collabora/code from 21.11.2.2.1 to 21.11.2.3.1 in /Containers/collabora
2022-03-02 18:25:54 +01:00
Simon L
2dbd3a5f71 Merge pull request #252 from nextcloud/enh/1902/customize-collabora
customize collabora a bit
2022-03-02 17:23:31 +01:00
szaimen
c1e2446d22 customize collabora a bit
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-02 17:15:00 +01:00
szaimen
6232000e31 show the current channel and add links to the changelogs
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-02 15:49:34 +01:00
szaimen
7c20d54dd0 add docs for additional backup sync to another drive
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-02 15:30:02 +01:00
szaimen
8ce55a1334 migrate borgbackup to alpine
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-02 15:21:34 +01:00
Simon L
853a880c9d Merge pull request #286 from nextcloud/enh/noid/reverse-proxy-docs
add reverse proxy docs
2022-03-01 15:12:58 +01:00
Simon L
0ecd2c8f78 Merge pull request #289 from nextcloud/enh/273/lxc-docs
Add docs on backup container inside LXC containers
2022-03-01 15:12:38 +01:00
Simon L
24d1451325 Merge pull request #294 from nextcloud/automated/noid/psalm-baseline-update-1646132431
[Automated] Update psalm-baseline.xml
2022-03-01 15:12:27 +01:00
szaimen
8149c0de75 also show up-to-date if the checks return null
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-01 15:11:46 +01:00
dependabot[bot]
34660f3d17 Bump debian in /Containers/apache
Bumps debian from bullseye-20220125-slim to bullseye-20220228-slim.

---
updated-dependencies:
- dependency-name: debian
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 12:29:23 +00:00
dependabot[bot]
d360031f12 Bump collabora/code in /Containers/collabora
Bumps collabora/code from 21.11.2.2.1 to 21.11.2.3.1.

---
updated-dependencies:
- dependency-name: collabora/code
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 12:29:23 +00:00
Simon L
efde2ab41a Merge pull request #295 from nextcloud/enh/noid/increase-version
increase version to v0.6.0
2022-03-01 12:06:26 +01:00
szaimen
a89c183508 increase version to v0.6.0
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-01 12:05:54 +01:00
nextcloud-command
301b6e6297 Update psalm baseline
Signed-off-by: GitHub <noreply@github.com>
2022-03-01 11:00:30 +00:00
Simon L
6e839f5baf Merge pull request #293 from nextcloud/enh/noid/fix-some-psalm-issues
fix some psalm issues
2022-03-01 11:57:24 +01:00
szaimen
edb8bd228b fix some psalm issues
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-01 11:44:59 +01:00
Simon L
23429f3e59 Merge pull request #291 from nextcloud/enh/265/upgrade-postgres
update postgres to 14.2
2022-03-01 11:20:19 +01:00
Simon L
f4130a8475 Merge pull request #290 from nextcloud/enh/278/delete-backup-archives
add docs on how to delete backup archives manually
2022-03-01 11:10:30 +01:00
szaimen
e5aa3757d5 add docs on how to delete backup archives manually
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-01 11:07:38 +01:00
szaimen
12f1549221 update postgres to 14.2
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-01 10:16:32 +01:00
szaimen
d34167b30f Add docs on backup container inside LXC containers
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-01 09:38:51 +01:00
Simon L
5e0118a3b5 Merge pull request #287 from nextcloud/automated/noid/psalm-baseline-update-1646108969
[Automated] Update psalm-baseline.xml
2022-03-01 09:11:37 +01:00
nextcloud-command
220194b409 Update psalm baseline
Signed-off-by: GitHub <noreply@github.com>
2022-03-01 04:29:29 +00:00
szaimen
2943c6cf08 add reverse proxy docs
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-03-01 00:25:03 +01:00
szaimen
2040553822 fix the access rights
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 19:36:19 +01:00
Simon L
d1656a0fcb Merge pull request #70 from nextcloud/enh/noid/allow-reverse-proxies
allow to run this behind a reverse proxy
2022-02-28 18:55:03 +01:00
szaimen
6e9261f306 allow to run this behind a reverse proxy
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 18:44:35 +01:00
szaimen
269f62615f update psalm container regularly
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 18:13:26 +01:00
szaimen
704c4ad331 fix sarif upload
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 17:49:42 +01:00
Simon L
9afec142f3 Merge pull request #285 from nextcloud/automated/noid/psalm-baseline-update-1646065523
[Automated] Update psalm-baseline.xml
2022-02-28 17:45:16 +01:00
nextcloud-command
9fbcaae567 Update psalm baseline
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 17:42:45 +01:00
szaimen
82c371b519 fix the update-baseline-workflow
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 17:30:45 +01:00
Simon L
2afc711983 Merge pull request #283 from nextcloud/enh/noid/update-baseline
add workflow that updates psalm baseline regularly
2022-02-28 17:02:52 +01:00
szaimen
a42f21555a add workflow that updates psalm baseline regularly
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 17:01:12 +01:00
Simon L
d6ece6cad8 Merge pull request #210 from nextcloud/enh/207/set-up-psalm
set up psalm
2022-02-28 16:58:21 +01:00
szaimen
6f1da5fc5d set up psalm
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 16:55:06 +01:00
szaimen
2024cb8f26 add apcu into the psalm container
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 15:45:02 +01:00
Simon L
1c01e9e21f Merge pull request #282 from nextcloud/enh/noid/create-psalm-container
create our own psalm container
2022-02-28 15:30:30 +01:00
szaimen
628e55f076 create our own psalm container
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-28 15:27:02 +01:00
Simon L
5b49faf3b7 Merge pull request #274 from nextcloud/aio-dependency-update
Dependency updates
2022-02-28 14:43:12 +01:00
szaimen
33a73a7b95 dependency updates
Signed-off-by: GitHub <noreply@github.com>
2022-02-27 12:15:24 +00:00
szaimen
e2086ada2b make clear that the external storage app is not covered by the built-in backup solution
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-24 01:27:14 +01:00
szaimen
c15bc86e06 make clear that the external mount point will not be covered by the built-in backup solution
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-24 01:10:25 +01:00
Simon L
ccc80c44cc Merge pull request #255 from nextcloud/enh/76/add-docs
add some docs on how to allow the Nextcloud container to access direc…
2022-02-23 19:32:50 +01:00
Simon L
d12df52864 Merge pull request #269 from nextcloud/increase-to-0.5.0
increase version to v0.5.0
2022-02-23 18:48:24 +01:00
szaimen
5ed19687e2 increase version to v0.5.0
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-23 18:47:29 +01:00
Simon L
af93aeebd7 Merge pull request #254 from nextcloud/enh/76/allow-to-define-a-nextcloud-mountpoint
allow nextcloud to access outside directories
2022-02-23 18:11:35 +01:00
Simon L
aa366556f5 Merge pull request #266 from nextcloud/enh/263/move-trusted-proxies
move trusted_proxies to entrypoint
2022-02-23 18:09:42 +01:00
Simon L
a88000095a Merge pull request #253 from nextcloud/enh/244/enforce-startup-order
enforce startup order
2022-02-23 18:09:27 +01:00
Simon L
15e914e3f4 Merge pull request #267 from nextcloud/aio-dependency-update
Dependency updates
2022-02-23 18:08:38 +01:00
Simon L
472334948c Merge pull request #256 from nextcloud/dependabot/docker/Containers/collabora/collabora/code-21.11.2.2.1
Bump collabora/code from 21.11.1.4.1 to 21.11.2.2.1 in /Containers/collabora
2022-02-23 18:08:02 +01:00
Simon L
663901cacd Merge pull request #260 from nextcloud/dependabot/docker/Containers/mastercontainer/php-8.0.16-apache-bullseye
Bump php from 8.0.15-apache-bullseye to 8.0.16-apache-bullseye in /Containers/mastercontainer
2022-02-23 18:07:49 +01:00
Simon L
6f0e4dc175 Merge pull request #261 from nextcloud/dependabot/docker/Containers/nextcloud/php-8.0.16-fpm-alpine3.15
Bump php from 8.0.15-fpm-alpine3.15 to 8.0.16-fpm-alpine3.15 in /Containers/nextcloud
2022-02-23 18:07:35 +01:00
Simon L
b0894992b4 Merge pull request #262 from nextcloud/dependabot/docker/Containers/postgresql/postgres-13.6-alpine3.15
Bump postgres from 13.5-alpine3.15 to 13.6-alpine3.15 in /Containers/postgresql
2022-02-23 18:07:18 +01:00
Simon L
748dcea39e Merge pull request #246 from nextcloud/enh/219/do-not-disconnect-from-network
Do not disconnect containers from network
2022-02-23 18:05:02 +01:00
Simon L
5b278ca261 Merge pull request #268 from nextcloud/fix/241/validate-ip-address
ip-addresses are not supported as domain
2022-02-23 18:04:10 +01:00
szaimen
d988706ae0 ip-addresses are not supported as domain
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-23 18:01:56 +01:00
szaimen
73193ee2d5 dependency updates
Signed-off-by: GitHub <noreply@github.com>
2022-02-23 12:16:38 +00:00
szaimen
e955b0a96f move trusted_proxies to entrypoint
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-22 13:26:48 +01:00
Simon L
11edcfe142 Merge pull request #250 from nextcloud/enh/234/skeleton-dir-docs
add documentation for skeleton directory
2022-02-22 11:30:07 +01:00
szaimen
c779c91ef6 enforce startup order
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 20:00:35 +01:00
dependabot[bot]
3b177a5f55 Bump php in /Containers/nextcloud
Bumps php from 8.0.15-fpm-alpine3.15 to 8.0.16-fpm-alpine3.15.

---
updated-dependencies:
- dependency-name: php
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-21 17:59:20 +00:00
dependabot[bot]
72f7106911 Bump php in /Containers/mastercontainer
Bumps php from 8.0.15-apache-bullseye to 8.0.16-apache-bullseye.

---
updated-dependencies:
- dependency-name: php
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-21 17:59:14 +00:00
dependabot[bot]
cbfe9c1907 Bump postgres in /Containers/postgresql
Bumps postgres from 13.5-alpine3.15 to 13.6-alpine3.15.

---
updated-dependencies:
- dependency-name: postgres
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-21 17:54:31 +00:00
szaimen
db12a9a90b ignore major version updates for specific containers
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 18:53:51 +01:00
dependabot[bot]
c777971906 Bump collabora/code in /Containers/collabora
Bumps collabora/code from 21.11.1.4.1 to 21.11.2.2.1.

---
updated-dependencies:
- dependency-name: collabora/code
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-21 17:26:52 +00:00
szaimen
0b8caa8cea fix dependabot formatting
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 18:26:00 +01:00
szaimen
eafe011ae9 add some docs on how to allow the Nextcloud container to access directories on the host
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 18:08:31 +01:00
szaimen
bc50b0cc4f allow nextcloud to access outside directories
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 17:31:05 +01:00
Simon L
a2f60ba765 Merge pull request #248 from nextcloud/fix/2200/fix-dependabot
fix dependabot
2022-02-21 15:54:16 +01:00
szaimen
487688d000 add documentation for skeleton directory
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 14:33:14 +01:00
szaimen
30e2c6be25 fix typo in readme
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 14:18:46 +01:00
szaimen
777666cf11 fix dependabot
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 14:09:22 +01:00
szaimen
221ab2515d Do not disconnect containers from network
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 14:01:27 +01:00
Simon L
ac3b8bc963 Merge pull request #238 from nextcloud/enh/noid/add-backup-pro-tip
Add instructions how to open the backup archives on the host
2022-02-21 13:32:53 +01:00
szaimen
1df46bb805 Add instructions how to open the backup archives on the host
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-21 13:32:18 +01:00
Simon L
89830a1b81 Merge pull request #237 from nextcloud/fix/235/fix-database-import
fix database import by waiting for the database to start
2022-02-18 11:44:12 +01:00
szaimen
48e60872b3 fix database import by waiting for the database to start
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-18 11:41:52 +01:00
Simon L
9d9da9e47c Merge pull request #230 from nextcloud/enh/noid/update-version
update version to 0.4.0
2022-02-16 16:30:44 +01:00
szaimen
3a9c305758 update version to 0.4.0
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-16 16:29:47 +01:00
szaimen
8f1fcde006 fix selecting a backup container
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-16 16:26:35 +01:00
Simon L
8a6de8f63c Merge pull request #65 from nextcloud/enh/39/allow-to-select-archive
allow to select the archive to restore from
2022-02-16 14:43:10 +01:00
szaimen
0880aff7ea adress review
Signed-off-by: szaimen <szaimen@e.mail.de>
Co-Authored-By: Carl Schwan <carl@carlschwan.eu>
2022-02-16 14:34:21 +01:00
Simon L
2c3db2fd40 Merge pull request #229 from nextcloud/nextcloud-container-update
Nextcloud update
2022-02-16 13:39:37 +01:00
szaimen
e357fc8bb9 nextcloud-update automated change
Signed-off-by: GitHub <noreply@github.com>
2022-02-16 12:33:48 +00:00
Simon L
a82b86b915 Merge pull request #222 from nextcloud/aio-dependency-update
Dependency updates
2022-02-16 13:28:10 +01:00
szaimen
67705134cf dependency updates
Signed-off-by: GitHub <noreply@github.com>
2022-02-16 12:13:04 +00:00
Simon L
ce15c64cd9 Merge pull request #228 from nextcloud/enh/noid/update-nextcloud
update nextcloud to 23.0.2
2022-02-16 12:19:41 +01:00
szaimen
92492affe4 update nextcloud to 23.0.2
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-16 12:18:46 +01:00
szaimen
63e0849215 allow to select the archive to restore from
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-16 12:00:54 +01:00
szaimen
1515d0c210 another attempt to fix the database import
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-15 18:57:39 +01:00
Simon L
4359792a48 Merge pull request #226 from nextcloud/enh/noid/fix-database-import
fix database import
2022-02-15 17:44:36 +01:00
szaimen
3887275808 fix database import
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-15 17:44:00 +01:00
szaimen
badd8d02a9 update to 0.3.1
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-15 12:56:44 +01:00
Simon L
5bc10a56ed Merge pull request #218 from nextcloud/enh/noid/fix-database-connection
fix the database connection
2022-02-15 12:15:39 +01:00
Simon L
222dcd3317 Merge pull request #221 from nextcloud/aio-dependency-update
Dependency updates
2022-02-13 13:43:13 +01:00
szaimen
cec86aa825 dependency updates
Signed-off-by: GitHub <noreply@github.com>
2022-02-13 12:11:36 +00:00
szaimen
e7dfb2514b fix the database connection
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-13 11:44:59 +01:00
szaimen
b0e570176b fix redis build
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-12 14:24:11 +01:00
szaimen
7756826eb3 revert the removal for now since it would break all instances
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-12 01:02:39 +01:00
szaimen
836552e1a7 verbose output
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-12 00:26:12 +01:00
szaimen
6e22b364ae postgresql - delete the datadir once
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 23:53:50 +01:00
Simon L
4979d1d90e Merge pull request #214 from nextcloud/enh/131/use-dependabot-to-update-containers
use dependabot to update containers
2022-02-11 18:42:45 +01:00
Simon L
46d898e196 Merge pull request #215 from nextcloud/enh/noid/update-version
update version to 0.3.0
2022-02-11 17:14:03 +01:00
szaimen
7f034e5109 update version to 0.3.0
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 17:03:56 +01:00
szaimen
3029b277f1 use dependabot to update containers
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 15:47:49 +01:00
Simon L
46c754759e Merge pull request #213 from nextcloud/enh/noid/fix-spellcheck-warnings
fix spellcheck warnings
2022-02-11 13:02:52 +01:00
szaimen
1339be5045 error if reviewdog found something
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 12:58:19 +01:00
szaimen
53f5b4ae11 fix spellcheck warnings
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 12:48:27 +01:00
Simon L
de7f47e973 Merge pull request #211 from nextcloud/enh/208/set-up-shellcheck
set up shellcheck
2022-02-11 11:46:26 +01:00
szaimen
b08a06573d fix shellcheck
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 11:44:59 +01:00
szaimen
44d491cc5b set bash as shell
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 11:30:22 +01:00
Simon L
96b381bcab Merge pull request #212 from nextcloud/enh/209/set-up-spellcheck
set up spellcheck
2022-02-11 11:14:55 +01:00
szaimen
7b40e6b733 set up spellcheck
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 11:10:51 +01:00
szaimen
ed56f37c4c set up shellcheck
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-11 11:05:59 +01:00
szaimen
baa5f5635b fix talk container build
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-10 20:38:35 +01:00
Simon L
ff59c30604 Merge pull request #206 from nextcloud/fix/fix-postgresql
fix postgresql container
2022-02-09 22:01:32 +01:00
szaimen
1a6253ee4c fix postgresql container
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 21:59:51 +01:00
Simon L
8af877f048 Merge pull request #204 from nextcloud/enh/185/migrate-nextcloud-to-alpine
migrate nextcloud container to alpine
2022-02-09 21:07:08 +01:00
Simon L
02c8b57d4e Merge pull request #194 from nextcloud/aio-dependency-update
Dependency updates
2022-02-09 21:06:49 +01:00
Simon L
0052582003 Merge pull request #189 from nextcloud/fix/188/fix-collabora-connection-issues
fix connection issues with collabora
2022-02-09 21:06:15 +01:00
Simon L
7bb0c3b164 Merge pull request #190 from nextcloud/enh/noid/install-some-apps-by-default
Install some apps by default
2022-02-09 21:06:09 +01:00
Simon L
ddd01be82f Merge pull request #203 from nextcloud/enh/185/migrate-redis-to-alpine
migrate redis container to alpine
2022-02-09 21:06:00 +01:00
Simon L
c585548c07 Merge pull request #198 from nextcloud/enh/193/container-logrotate
add some docs on huge container logs
2022-02-09 21:05:23 +01:00
Simon L
3de828034a Merge pull request #200 from nextcloud/enh/switch-to-debian-slim
switch apache and borgbackup to slim image for reduced size
2022-02-09 21:05:13 +01:00
Simon L
bb3bcad752 Merge pull request #201 from nextcloud/enh/185/migrate-watchtower-to-alpine
migrate watchtower container to alpine
2022-02-09 21:05:00 +01:00
Simon L
0748ee9fbf Merge pull request #202 from nextcloud/enh/185/migrate-postgres-to-alpine
migrate postgres container to alpine
2022-02-09 21:04:51 +01:00
szaimen
a2f01c2fcf migrate nextcloud container to alpine
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 21:00:01 +01:00
szaimen
4b28a6a7d7 migrate watchtower container to alpine
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 20:43:09 +01:00
szaimen
0bf050a51f migrate postgres container to alpine
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 20:38:02 +01:00
szaimen
b9ab319357 migrate redis container to alppine
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 19:46:31 +01:00
szaimen
46c5c59e5b switch apache and borgbackup to slim image for reduced size
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 19:08:37 +01:00
Simon L
ad5e3c3f51 Merge pull request #199 from nextcloud/enh/192/update-opcache-settings
update opcache settings
2022-02-09 18:38:48 +01:00
szaimen
98cb4e9494 update opcache settings
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 18:37:21 +01:00
szaimen
37f219300b add some docs on huge container logs
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 18:21:16 +01:00
szaimen
d934629889 improve the migration docs by putting in the password directly
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-09 18:17:12 +01:00
szaimen
285e093e57 dependency updates
Signed-off-by: GitHub <noreply@github.com>
2022-02-05 12:10:03 +00:00
szaimen
2be5cb255b Install some apps by default
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-03 10:28:33 +01:00
szaimen
7159cd387a fix connection issues with collabora
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-03 10:24:46 +01:00
szaimen
3041e51b04 hopefully fix the workflow
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-02-03 10:11:16 +01:00
szaimen
4e852761d9 try to fix the workflow if there is no outdated dependency
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-01-31 13:24:57 +01:00
szaimen
20d631b600 fix removing the updatenotification app for old instances
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-01-29 22:29:15 +01:00
szaimen
b4c58941ed dependency updates - make all steps visible for better debugging
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-01-29 13:26:23 +01:00
50 changed files with 1350 additions and 330 deletions

105
.github/dependabot.yml vendored
View File

@@ -3,10 +3,107 @@ updates:
- package-ecosystem: composer
directory: "/php/"
schedule:
interval: weekly
day: saturday
time: "03:00"
timezone: Europe/Paris
interval: daily
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/apache"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/borgbackup"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/collabora"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/domaincheck"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/mastercontainer"
schedule:
interval: "daily"
time: "12:00"
ignore:
- dependency-name: "php"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/nextcloud"
schedule:
interval: "daily"
time: "12:00"
ignore:
- dependency-name: "php"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/postgresql"
schedule:
interval: "daily"
time: "12:00"
ignore:
- dependency-name: "postgres"
update-types: ["version-update:semver-major"]
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/redis"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/talk"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/watchtower"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review

View File

@@ -0,0 +1,54 @@
name: Create Psalm Container
on:
workflow_dispatch:
schedule:
- cron: '5 4 * * *'
jobs:
push_to_registry:
runs-on: ubuntu-latest
name: Create Psalm Container
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
run: |
git clone https://github.com/psalm/psalm-github-actions.git
- name: Modify the Dockerfile
run: |
set -x
sed -i 's|FROM php:7.4-alpine|FROM php:8.0-alpine|' "psalm-github-actions/Dockerfile"
cat << APCU >> "psalm-github-actions/Dockerfile"
RUN mkdir -p /usr/src/php/ext/apcu && \
curl -fsSL https://pecl.php.net/get/apcu | tar xvz -C "/usr/src/php/ext/apcu" --strip 1 && \
docker-php-ext-install apcu
APCU
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image
uses: docker/build-push-action@v2
with:
push: true
context: 'psalm-github-actions'
file: 'psalm-github-actions/Dockerfile'
tags: |
ghcr.io/nextcloud/all-in-one-psalm:latest

View File

@@ -15,12 +15,15 @@ jobs:
php-version: '8.0'
- name: Run dependency update script
run: |
set -x
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer
cd ./php
composer update
set +e
ALL_LINES="$(composer outdated | grep -v "psr/container")"
set -e
while [ -n "$ALL_LINES" ]; do
CURRENT_LINE="$(echo "$ALL_LINES" | head -1)"
composer require "$(echo "$CURRENT_LINE" | awk '{print $1}')" "^$(echo "$CURRENT_LINE" | awk '{print $4}')"

18
.github/workflows/psalm-analysis.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Psalm Analysis
on:
pull_request:
push:
jobs:
psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Psalm
uses: docker://ghcr.io/nextcloud/all-in-one-psalm
with:
composer_ignore_platform_reqs: false
relative_dir: php

25
.github/workflows/psalm-security.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Psalm Security Analysis
on:
push:
branches:
- main
jobs:
psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Psalm
uses: docker://ghcr.io/nextcloud/all-in-one-psalm
with:
relative_dir: php
security_analysis: true
composer_ignore_platform_reqs: false
report_file: results.sarif
- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: php/results.sarif

View File

@@ -0,0 +1,48 @@
name: Update Psalm baseline
on:
workflow_dispatch:
schedule:
- cron: '5 4 * * *'
jobs:
update-psalm-baseline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up php8.0
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: apcu
coverage: none
- name: Run script
run: |
set -x
cd php
composer global require vimeo/psalm --prefer-dist --no-progress --dev
composer install
composer run psalm -- --monochrome --no-progress --output-format=text --update-baseline
git clean -f lib/composer
git checkout composer.json composer.lock lib/composer
continue-on-error: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.COMMAND_BOT_PAT }}
commit-message: Update psalm baseline
committer: GitHub <noreply@github.com>
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
signoff: true
branch: automated/noid/psalm-baseline-update
# Make sure we can open multiple PRs
branch-suffix: timestamp
title: '[Automated] Update psalm-baseline.xml'
body: |
Auto-generated update psalm-baseline.xml with fixed psalm warnings
labels: |
3. to review

18
.github/workflows/shellcheck.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Shellcheck
on:
pull_request:
push:
jobs:
shellcheck:
name: Github Actions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Shellcheck
uses: ludeeus/action-shellcheck@master
with:
check_together: 'yes'
env:
SHELLCHECK_OPTS: --shell bash

19
.github/workflows/spellcheck.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: 'Spellcheck'
on:
pull_request:
push:
jobs:
spellcheck:
name: Check spelling
runs-on: ubuntu-latest
steps:
- name: spelling or typos
uses: actions/checkout@v2
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
locale: "US"
fail_on_error: true

View File

@@ -6,7 +6,7 @@
}
}
https://{$NC_DOMAIN}:443 {
{$PROTOCOL}://{$NC_DOMAIN}:{$APACHE_PORT} {
# Notify Push
route /push/* {
@@ -22,25 +22,13 @@ https://{$NC_DOMAIN}:443 {
# Collabora
route /browser/* {
reverse_proxy https://{$COLLABORA_HOST}:9980 {
transport http {
tls_insecure_skip_verify
}
}
reverse_proxy {$COLLABORA_HOST}:9980
}
route /hosting/* {
reverse_proxy https://{$COLLABORA_HOST}:9980 {
transport http {
tls_insecure_skip_verify
}
}
reverse_proxy {$COLLABORA_HOST}:9980
}
route /cool/* {
reverse_proxy https://{$COLLABORA_HOST}:9980 {
transport http {
tls_insecure_skip_verify
}
}
reverse_proxy {$COLLABORA_HOST}:9980
}
# Nextcloud

View File

@@ -1,4 +1,4 @@
FROM debian:bullseye
FROM debian:bullseye-20220228-slim
EXPOSE 80
@@ -59,7 +59,8 @@ COPY start.sh /usr/bin/
COPY supervisord.conf /
RUN chmod +x /usr/bin/start.sh; \
chmod +r /supervisord.conf; \
chmod +r /Caddyfile;
chmod a+w /Caddyfile; \
chmod a+w /
# Give root a random password
RUN echo "root:$(openssl rand -base64 12)" | chpasswd

View File

@@ -23,6 +23,19 @@ while ! nc -z "$COLLABORA_HOST" 9980; do
sleep 5
done
if [ -z "$APACHE_PORT" ]; then
export APACHE_PORT="443"
fi
if [ "$APACHE_PORT" != '443' ]; then
export PROTOCOL="http"
export NC_DOMAIN=""
sed -i 's|auto_https.*|auto_https off|' /Caddyfile
else
export PROTOCOL="https"
sed -i 's|auto_https.*|auto_https disable_redirects|' /Caddyfile
fi
# Add caddy path
mkdir -p /mnt/data/caddy/

View File

@@ -1,4 +1,4 @@
FROM debian:bullseye
FROM debian:bullseye-20220125-slim
RUN set -ex; \
\

View File

@@ -1,13 +1,9 @@
#!/bin/bash
# Variables
BORG_BACKUP_DIRECTORY="/mnt/borgbackup/borg"
# Functions
get_start_time(){
START_TIME=$(date +%s)
CURRENT_DATE=$(date --date @"$START_TIME" +"%Y%m%d_%H%M%S")
CURRENT_DATE_READABLE=$(date --date @"$START_TIME" +"%d.%m.%Y - %H:%M:%S")
}
get_expiration_time() {
END_TIME=$(date +%s)
@@ -19,11 +15,6 @@ get_expiration_time() {
DURATION_READABLE=$(printf "%02d hours %02d minutes %02d seconds" $DURATION_HOUR $DURATION_MIN $DURATION_SEC)
}
# Export defaults
export BORG_PASSPHRASE="$BORG_PASSWORD"
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
# Test if all volumes aren't empty
VOLUME_DIRS="$(find /nextcloud_aio_volumes -mindepth 1 -maxdepth 1 -type d)"
mapfile -t VOLUME_DIRS <<< "$VOLUME_DIRS"
@@ -150,9 +141,6 @@ if [ "$BORG_MODE" = backup ]; then
# Remove the update skip file because the backup was successful
rm -f "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/skip.update"
echo "$CURRENT_DATE,$CURRENT_DATE_READABLE" >> "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
chmod +r "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
# Prune options
BORG_PRUNE_OPTS=(--stats --progress --keep-within=7d --keep-weekly=4 --keep-monthly=6 "$BORG_BACKUP_DIRECTORY")
@@ -172,17 +160,20 @@ fi
# Do the restore
if [ "$BORG_MODE" = restore ]; then
get_start_time
echo "Restoring the last backup..."
# Perform the restore
FIRST_ARCHIVE="$(borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | awk -F " " '{print $1}' | sort -r | head -1)"
if [ -n "$SELECTED_RESTORE_TIME" ]; then
SELECTED_ARCHIVE="$(borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | grep "$SELECTED_RESTORE_TIME" | awk -F " " '{print $1}' | head -1)"
else
SELECTED_ARCHIVE="$(borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | awk -F " " '{print $1}' | sort -r | head -1)"
fi
echo "Restoring '$SELECTED_ARCHIVE'..."
mkdir -p /tmp/borg
if ! borg mount "$BORG_BACKUP_DIRECTORY::$FIRST_ARCHIVE" /tmp/borg; then
if ! borg mount "$BORG_BACKUP_DIRECTORY::$SELECTED_ARCHIVE" /tmp/borg; then
echo "Could not mount the backup!"
exit 1
fi
if ! rsync --stats --archive --human-readable -vv --delete \
--exclude "nextcloud_aio_mastercontainer/data/backup_archives.list" \
--exclude "nextcloud_aio_mastercontainer/session/"** \
--exclude "nextcloud_aio_mastercontainer/certs/"** \
/tmp/borg/nextcloud_aio_volumes/ /nextcloud_aio_volumes; then

View File

@@ -1,12 +1,18 @@
#!/bin/bash
# Variables
export BORG_BACKUP_DIRECTORY="/mnt/borgbackup/borg"
# Validate BORG_PASSWORD
if [ -z "$BORG_PASSWORD" ]; then
echo "BORG_PASSWORD is not allowed to be empty."
exit 1
fi
export BORG_PASSWORD
# Export defaults
export BORG_PASSPHRASE="$BORG_PASSWORD"
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
# Validate BORG_MODE
if [ "$BORG_MODE" != backup ] && [ "$BORG_MODE" != restore ] && [ "$BORG_MODE" != check ]; then
@@ -24,6 +30,12 @@ fi
# Remove lockfile
rm -f "/nextcloud_aio_volumes/nextcloud_aio_database_dump/backup-is-running"
# Get a list of all available borg archives
set -x
borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | awk -F " " '{print $1","$3,$4}' > "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
chmod +r "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
set +x
if [ -n "$FAILED" ]; then
if [ "$BORG_MODE" = backup ]; then
# Add file to Nextcloud container so that it skips any update the next time

View File

@@ -1,2 +1,2 @@
# From a file located probably somewhere here: https://github.com/CollaboraOnline/online/tree/master/docker
FROM collabora/code:latest
FROM collabora/code:21.11.2.4.1

View File

@@ -1,4 +1,4 @@
FROM alpine
FROM alpine:3.15.0
RUN apk add --update --no-cache lighttpd bash
RUN adduser -S www-data -G www-data

View File

@@ -1,6 +1,6 @@
server.document-root = "/var/www/domaincheck/"
server.port = 443
server.port = env.APACHE_PORT
server.username = "www-data"
server.groupname = "www-data"

View File

@@ -7,6 +7,10 @@ fi
echo "$INSTANCE_ID" > /var/www/domaincheck/index.html
if [ -z "$APACHE_PORT" ]; then
export APACHE_PORT="443"
fi
# Check config file
lighttpd -tt -f /etc/lighttpd/lighttpd.conf

View File

@@ -1,5 +1,8 @@
# Docker CLI is a requirement
FROM docker:20.10.12-dind-alpine3.15 as dind
# From https://github.com/docker-library/php/blob/master/8.0/bullseye/apache/Dockerfile
FROM php:8.0-apache-bullseye
FROM php:8.0.16-apache-bullseye
EXPOSE 80
EXPOSE 8080
@@ -28,7 +31,7 @@ RUN set -ex; \
&& chmod +x /usr/bin/caddy \
&& /usr/bin/caddy version
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
COPY --from=dind /usr/local/bin/docker /usr/local/bin/
RUN chmod +x /usr/local/bin/docker
RUN mkdir -p /usr/src/php/ext/apcu && \

View File

@@ -6,5 +6,7 @@ while true; do
sudo -u www-data php /var/www/docker-aio/php/src/Cron/cron.php
# Remove dangling images
sudo -u www-data docker image prune -f
# Remove sessions older than 24h
find "/mnt/docker-aio-config/session/" -mindepth 1 -mmin +1440 -delete
sleep 1d
done

View File

@@ -6,6 +6,14 @@ print_green() {
printf "%b%s%b\n" "\e[0;92m" "$TEXT" "\e[0m"
}
# Function to check if number was provided
check_if_number() {
case "${1}" in
''|*[!0-9]*) return 1 ;;
*) return 0 ;;
esac
}
# Check if socket is available and readable
if ! [ -a "/var/run/docker.sock" ]; then
echo "Docker socket is not available. Cannot continue."
@@ -40,9 +48,10 @@ if ! docker info &>/dev/null; then
exit 1
fi
API_VERSION_FILE="$(find ./ -name DockerActionManager.php | head -1)"
API_VERSION="$(grep -oP 'const API_VERSION.*\;' "$API_VERSION_FILE" | grep -oP [0-9]+.[0-9]+ | head -1)"
API_VERSION="$(grep -oP 'const API_VERSION.*\;' "$API_VERSION_FILE" | grep -oP '[0-9]+.[0-9]+' | head -1)"
# shellcheck disable=SC2001
API_VERSION_NUMB="$(echo "$API_VERSION" | sed 's/\.//')"
LOCAL_API_VERSION_NUMB="$(docker version | grep -i "api version" | grep -oP [0-9]+.[0-9]+ | head -1 | sed 's/\.//')"
LOCAL_API_VERSION_NUMB="$(docker version | grep -i "api version" | grep -oP '[0-9]+.[0-9]+' | head -1 | sed 's/\.//')"
if [ -n "$LOCAL_API_VERSION_NUMB" ] && [ -n "$API_VERSION_NUMB" ]; then
if ! [ "$LOCAL_API_VERSION_NUMB" -ge "$API_VERSION_NUMB" ]; then
echo "Docker v$API_VERSION is not supported by your docker engine. Cannot proceed."
@@ -53,6 +62,58 @@ else
sleep 10
fi
# Check if startup command was executed correctly
if ! docker ps | grep -q "nextcloud-aio-mastercontainer"; then
echo "It seems like you did not give the mastercontainer the correct name?"
exit 1
elif ! docker volume ls | grep -q "nextcloud_aio_mastercontainer"; then
echo "It seems like you did not give the mastercontainer volume the correct name?"
exit 1
fi
# Check for other options
if [ -n "$NEXTCLOUD_DATADIR" ]; then
if ! echo "$NEXTCLOUD_DATADIR" | grep -q "^/mnt/" \
&& ! echo "$NEXTCLOUD_DATADIR" | grep -q "^/media/"
then
echo "You've set NEXTCLOUD_DATADIR but not to an allowed value.
The string must start with '/mnt/' or '/media/'. E.g. '/mnt/ncdata'"
exit 1
elif [ "$NEXTCLOUD_DATADIR" = "/mnt/" ] || [ "$NEXTCLOUD_DATADIR" = "/media/" ]; then
echo "You've set NEXTCLOUD_DATADIR but not to an allowed value.
The string must start with '/mnt/' or '/media/' and not be equal to these."
exit 1
fi
fi
if [ -n "$NEXTCLOUD_MOUNT" ]; then
if ! echo "$NEXTCLOUD_MOUNT" | grep -q "^/mnt/" \
&& ! echo "$NEXTCLOUD_MOUNT" | grep -q "^/media/" \
&& ! echo "$NEXTCLOUD_MOUNT" | grep -q "^/var/backups$"
then
echo "You've set NEXCLOUD_MOUNT but not to an allowed value.
The string must be equal to/start with '/mnt/' or '/media/' or be equal to '/var/backups'."
exit 1
elif [ "$NEXTCLOUD_MOUNT" = "/mnt/ncdata" ] || echo "$NEXTCLOUD_MOUNT" | grep -q "^/mnt/ncdata/"; then
echo "/mnt/ncdata and /mnt/ncdata/ are not allowed for NEXTCLOUD_MOUNT."
exit 1
fi
fi
if [ -n "$NEXTCLOUD_DATADIR" ] && [ -n "$NEXTCLOUD_MOUNT" ]; then
if [ "$NEXTCLOUD_DATADIR" = "$NEXTCLOUD_MOUNT" ]; then
echo "NEXTCLOUD_DATADIR and NEXTCLOUD_MOUNT are not allowed to be equal."
exit 1
fi
fi
if [ -n "$APACHE_PORT" ]; then
if ! check_if_number "$APACHE_PORT"; then
echo "You provided an Apache port but did not only use numbers"
exit 1
elif ! [ "$APACHE_PORT" -le 65535 ] || ! [ "$APACHE_PORT" -ge 1 ]; then
echo "The provided Apache port is invalid. It must be between 1 and 65535"
exit 1
fi
fi
# Add important folders
mkdir -p /mnt/docker-aio-config/data/
mkdir -p /mnt/docker-aio-config/session/
@@ -71,12 +132,12 @@ chown root:root -R /mnt/docker-aio-config/certs/
GENERATED_CERTS="/mnt/docker-aio-config/certs"
TMP_CERTS="/etc/apache2/certs"
mkdir -p "$GENERATED_CERTS"
cd "$GENERATED_CERTS"
cd "$GENERATED_CERTS" || exit 1
if ! [ -f ./ssl.crt ] && ! [ -f ./ssl.key ]; then
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/C=DE/ST=BE/L=Local/O=Dev/CN=nextcloud.local" -keyout ./ssl.key -out ./ssl.crt
fi
if [ -f ./ssl.crt ] && [ -f ./ssl.key ]; then
cd "$TMP_CERTS"
cd "$TMP_CERTS" || exit 1
rm ./ssl.crt
rm ./ssl.key
cp "$GENERATED_CERTS/ssl.crt" ./

View File

@@ -1,15 +1,21 @@
# From https://github.com/nextcloud/docker/blob/master/22/fpm/Dockerfile
FROM php:8.0-fpm-bullseye
# From https://github.com/nextcloud/docker/blob/master/23/fpm-alpine/Dockerfile
FROM php:8.0.16-fpm-alpine3.15
# Custom: change id of www-data user as it needs to be the same like on old installations
RUN set -ex; \
apk add --no-cache shadow; \
deluser www-data; \
groupmod -g 333 xfs; \
usermod -u 333 -g 333 xfs; \
addgroup -g 33 -S www-data; \
adduser -u 33 -D -S -G www-data www-data
# entrypoint.sh and cron.sh dependencies
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
apk add --no-cache \
rsync \
bzip2 \
; \
rm -rf /var/lib/apt/lists/*;
;
# install the PHP extensions we need
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
@@ -17,30 +23,28 @@ ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 10G
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
autoconf \
freetype-dev \
icu-dev \
libevent-dev \
libfreetype6-dev \
libicu-dev \
libjpeg-dev \
libldap2-dev \
libjpeg-turbo-dev \
libmcrypt-dev \
libmemcached-dev \
libpng-dev \
libpq-dev \
libmemcached-dev \
libxml2-dev \
libmagickwand-dev \
libzip-dev \
openldap-dev \
pcre-dev \
postgresql-dev \
imagemagick-dev \
libwebp-dev \
libgmp-dev \
gmp-dev \
; \
\
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-configure ldap; \
docker-php-ext-install -j "$(nproc)" \
bcmath \
exif \
@@ -58,7 +62,7 @@ RUN set -ex; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.21; \
pecl install memcached-3.1.5; \
pecl install redis-5.3.6; \
pecl install redis-5.3.7; \
pecl install imagick-3.7.0; \
\
docker-php-ext-enable \
@@ -69,29 +73,21 @@ RUN set -ex; \
; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .nextcloud-phpext-rundeps $runDeps; \
apk del .build-deps
# set recommended PHP.ini settings
# see https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
RUN { \
echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=16'; \
echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=1'; \
echo 'opcache.revalidate_freq=60'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
@@ -109,15 +105,13 @@ RUN { \
VOLUME /var/www/html
ENV NEXTCLOUD_VERSION 23.0.1
ENV NEXTCLOUD_VERSION 23.0.2
RUN set -ex; \
fetchDeps=" \
apk add --no-cache --virtual .fetch-deps \
bzip2 \
gnupg \
dirmngr \
"; \
apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \
; \
\
curl -fsSL -o nextcloud.tar.bz2 \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
@@ -125,7 +119,7 @@ RUN set -ex; \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
gpgconf --kill all; \
@@ -134,9 +128,7 @@ RUN set -ex; \
mkdir -p /usr/src/nextcloud/data; \
mkdir -p /usr/src/nextcloud/custom_apps; \
chmod +x /usr/src/nextcloud/occ; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
rm -rf /var/lib/apt/lists/*
apk del .fetch-deps
COPY *.sh upgrade.exclude /
COPY config/* /usr/src/nextcloud/config/
@@ -144,31 +136,28 @@ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
# Template from https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm/Dockerfile
# Template from https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm-alpine/Dockerfile
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
apk add --no-cache \
ffmpeg \
libmagickcore-6.q16-6-extra \
imagemagick \
procps \
smbclient \
samba-client \
supervisor \
# libreoffice \
; \
rm -rf /var/lib/apt/lists/*
;
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libbz2-dev \
libc-client-dev \
libkrb5-dev \
libsmbclient-dev \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
imap-dev \
krb5-dev \
openssl-dev \
samba-dev \
bzip2-dev \
; \
\
docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \
@@ -179,19 +168,14 @@ RUN set -ex; \
pecl install smbclient; \
docker-php-ext-enable smbclient; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .nextcloud-phpext-rundeps $runDeps; \
apk del .build-deps
RUN mkdir -p \
/var/log/supervisord \
@@ -207,12 +191,11 @@ CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
# Custom:
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
netcat \
apk add --no-cache \
bash \
netcat-openbsd \
openssl \
gnupg \
dirmngr \
git \
postgresql-client \
; \
@@ -225,14 +208,16 @@ RUN set -ex; \
sed -i 's/^pm.min_spare_servers =.*/pm.min_spare_servers = 25/' /usr/local/etc/php-fpm.d/www.conf; \
sed -i 's/^pm.max_spare_servers =.*/pm.max_spare_servers = 75/' /usr/local/etc/php-fpm.d/www.conf
RUN rm -rf /tmp/nextcloud-aio && \
RUN set -ex; \
rm -rf /tmp/nextcloud-aio && \
mkdir -p /tmp/nextcloud-aio && \
cd /tmp/nextcloud-aio && \
git clone https://github.com/nextcloud-releases/all-in-one.git --depth 1 .; \
mkdir -p /usr/src/nextcloud/apps/nextcloud-aio; \
cp -r ./app/* /usr/src/nextcloud/apps/nextcloud-aio/
RUN chown www-data:root -R /usr/src && \
RUN set -ex; \
chown www-data:root -R /usr/src && \
chown www-data:root -R /usr/local/etc/php/conf.d && \
chown www-data:root -R /var/log/supervisord/ && \
chown www-data:root -R /var/run/supervisord/ && \
@@ -242,14 +227,16 @@ RUN chown www-data:root -R /usr/src && \
COPY start.sh /
COPY notify.sh /
RUN chmod +x /start.sh && \
RUN set -ex; \
chmod +x /start.sh && \
chmod +r /supervisord.conf && \
chmod +x /entrypoint.sh && \
chmod +r /upgrade.exclude && \
chmod +x /cron.sh && \
chmod +x /notify.sh
RUN mkdir /mnt/ncdata; \
RUN set -ex; \
mkdir /mnt/ncdata; \
chown www-data:www-data /mnt/ncdata;
VOLUME /mnt/ncdata

View File

@@ -18,8 +18,3 @@ $overwriteCondAddr = getenv('OVERWRITECONDADDR');
if ($overwriteCondAddr) {
$CONFIG['overwritecondaddr'] = $overwriteCondAddr;
}
$trustedProxies = getenv('TRUSTED_PROXIES');
if ($trustedProxies) {
$CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));
}

View File

@@ -21,6 +21,15 @@ redis.session.lock_retries = -1
redis.session.lock_wait_time = 10000
REDIS_CONF
# Check permissions in ncdata
touch "/mnt/ncdata/this-is-a-test-file"
if ! [ -f "/mnt/ncdata/this-is-a-test-file" ]; then
echo "The www-data user doesn't seem to have access rights in /mnt/ncdata.
Did you maybe change the datadir and did forget to apply the correct permissions?"
exit 1
fi
rm "/mnt/ncdata/this-is-a-test-file"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
@@ -50,7 +59,8 @@ if ! [ -f "/mnt/ncdata/skip.update" ]; then
NEXT_MAJOR="$((INSTALLED_MAJOR + 1))"
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-${NEXT_MAJOR}.tar.bz2"
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/latest-${NEXT_MAJOR}.tar.bz2.asc"
export GNUPGHOME="$(mktemp -d)"
GNUPGHOME="$(mktemp -d)"
export GNUPGHOME
# gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A
gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2
@@ -97,6 +107,11 @@ if ! [ -f "/mnt/ncdata/skip.update" ]; then
fi
php /var/www/html/occ app:update --all
# Fix removing the updatenotification for old instances
if [ -d "/var/www/html/apps/updatenotification" ]; then
php /var/www/html/occ app:disable updatenotification
fi
fi
echo "Initializing nextcloud $image_version ..."
@@ -177,6 +192,14 @@ if ! [ -f "/mnt/ncdata/skip.update" ]; then
# Not needed anymore with the removal of the updatenotification app:
# php /var/www/html/occ config:app:set updatenotification notify_groups --value="[]"
# Install some apps by default
php /var/www/html/occ app:install twofactor_totp
php /var/www/html/occ app:install deck
php /var/www/html/occ app:install tasks
php /var/www/html/occ app:install calendar
php /var/www/html/occ app:install contacts
php /var/www/html/occ app:install apporder
#upgrade
else
while [ -n "$(pgrep -f cron.php)" ]
@@ -209,6 +232,13 @@ if ! [ -f "/mnt/ncdata/skip.update" ]; then
fi
fi
# Check if appdata is present
# If not, something broke (e.g. changing ncdatadir after aio was first started)
if [ -z "$(find "/mnt/ncdata/" -maxdepth 1 -mindepth 1 -type d -name "appdata_*")" ]; then
echo "Appdata is not present. Did you maybe change the datadir after aio was first started?"
exit 1
fi
# Apply one-click-instance settings
echo "Applying one-click-instance settings..."
php /var/www/html/occ config:system:set one-click-instance --value=true --type=bool
@@ -236,6 +266,7 @@ elif [ "$(php /var/www/html/occ config:app:get notify_push enabled)" = "no" ]; t
else
php /var/www/html/occ app:update notify_push
fi
php /var/www/html/occ config:system:set trusted_proxies 0 --value="127.0.0.1"
php /var/www/html/occ config:app:set notify_push base_endpoint --value="https://$NC_DOMAIN/push"
# Collabora
@@ -248,6 +279,8 @@ else
fi
php /var/www/html/occ config:app:set richdocuments wopi_url --value="https://$NC_DOMAIN/"
# php /var/www/html/occ richdocuments:activate-config
# Fix https://github.com/nextcloud/all-in-one/issues/188:
php /var/www/html/occ config:system:set allow_local_remote_servers --type=bool --value=true
# Talk
if ! [ -d "/var/www/html/custom_apps/spreed" ]; then

View File

@@ -6,13 +6,24 @@ while ! nc -z "$POSTGRES_HOST" 5432; do
sleep 5
done
# Use the correct Postgres username
POSTGRES_USER="oc_$POSTGRES_USER"
export POSTGRES_USER
# Fix false database connection on old instances
if [ -f "/var/www/html/config/config.php" ] && sleep 2 && psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; then
sed -i "s|'dbuser'.*=>.*$|'dbuser' => '$POSTGRES_USER',|" /var/www/html/config/config.php
sed -i "s|'dbpassword'.*=>.*$|'dbpassword' => '$POSTGRES_PASSWORD',|" /var/www/html/config/config.php
fi
# Run original entrypoint
if ! bash /entrypoint.sh; then
exit 1
fi
# Correctly set CPU_ARCH for notify_push
export CPU_ARCH="$(uname -m)"
CPU_ARCH="$(uname -m)"
export CPU_ARCH
if [ -z "$CPU_ARCH" ]; then
echo "Could not get processor architecture. Exiting."
exit 1

View File

@@ -1,16 +1,25 @@
# From https://github.com/docker-library/postgres/blob/master/13/bullseye/Dockerfile
FROM postgres:13-bullseye
# From https://github.com/docker-library/postgres/blob/master/13/alpine/Dockerfile
FROM postgres:14.2-alpine3.15
RUN apk add --update --no-cache bash openssl shadow netcat-openbsd
# We need to use the same gid and uid as on old installations
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
openssl \
; \
rm -rf /var/lib/apt/lists/*
deluser postgres; \
groupmod -g 9999 ping; \
addgroup -g 999 -S postgres; \
adduser -u 999 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres
# Fix default permissions
RUN set -ex; \
chown -R postgres:postgres /var/lib/postgresql; \
chown -R postgres:postgres /var/run/postgresql; \
chown -R postgres:postgres "$PGDATA"
COPY start.sh /usr/bin/
RUN chmod +x /usr/bin/start.sh
COPY init-user-db.sh /docker-entrypoint-initdb.d/
RUN chmod +x /usr/bin/start.sh; \
chmod +xr /docker-entrypoint-initdb.d/init-user-db.sh
RUN mkdir /mnt/data; \
chown postgres:postgres /mnt/data;

View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -ex
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER "oc_$POSTGRES_USER" WITH PASSWORD '$POSTGRES_PASSWORD' CREATEDB;
ALTER DATABASE "$POSTGRES_DB" OWNER TO "oc_$POSTGRES_USER";
EOSQL
set +ex

View File

@@ -18,9 +18,18 @@ if ! [ -w "$DUMP_DIR" ]; then
exit 1
fi
# Delete the datadir once (needed for setting the correct credentials on old instances once)
if ! [ -f "$DUMP_DIR/export.failed" ] && ! [ -f "$DUMP_DIR/initial-cleanup-done" ]; then
set -ex
rm -rf "${DATADIR:?}/"*
touch "$DUMP_DIR/initial-cleanup-done"
set +ex
fi
# Test if some things match
# shellcheck disable=SC2235
if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSION")" ] ) \
|| ( ! [ -f "$DATADIR/PG_VERSION" ] && [ -f "$DUMP_FILE" ] ); then
|| ( ! [ -f "$DATADIR/PG_VERSION" ] && ( [ -f "$DUMP_FILE" ] || [ -f "$DUMP_DIR/export.failed" ] ) ); then
# The DUMP_file must be provided
if ! [ -f "$DUMP_FILE" ]; then
echo "Unable to restore the database because the database dump is missing."
@@ -38,10 +47,10 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO
echo "Restoring from database dump."
# Exit if any command fails
set -e
set -ex
# Remove old database files
rm -rf "$DATADIR/"*
rm -rf "${DATADIR:?}/"*
# Change database port to a random port temporarily
export PGPORT=11000
@@ -49,13 +58,33 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO
# Create new database
exec docker-entrypoint.sh postgres &
# Wait 2s for creation
sleep 2s
# Wait for creation
while ! nc -z localhost 11000; do
echo "Waiting for the database to start."
sleep 5
done
# Set correct permissions
if grep -q "Owner: oc_admin" "$DUMP_FILE" && ! grep -q "Owner: oc_$POSTGRES_USER" "$DUMP_FILE"; then
OC_ADMIN_EXISTS=1
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER oc_admin WITH PASSWORD '$POSTGRES_PASSWORD' CREATEDB;
ALTER DATABASE "$POSTGRES_DB" OWNER TO oc_admin;
EOSQL
fi
# Restore database
echo "Restoring the database from database dump"
psql "$POSTGRES_DB" -U "$POSTGRES_USER" < "$DUMP_FILE"
# Correct permissions
if [ -n "$OC_ADMIN_EXISTS" ]; then
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
ALTER DATABASE "$POSTGRES_DB" OWNER TO "oc_$POSTGRES_USER";
REASSIGN OWNED BY oc_admin TO "oc_$POSTGRES_USER";
EOSQL
fi
# Shut down the database to be able to start it again
pg_ctl stop -m fast
@@ -63,13 +92,13 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO
export PGPORT=5432
# Don't exit if command fails anymore
set +e
set +ex
fi
# Cover the last case
if ! [ -f "$DATADIR/PG_VERSION" ] && ! [ -f "$DUMP_FILE" ]; then
# Remove old database files if somehow there should be some
rm -rf "$DATADIR/"*
rm -rf "${DATADIR:?}/"*
fi
# Catch docker stop attempts
@@ -91,6 +120,6 @@ if pg_dump --username "$POSTGRES_USER" "$POSTGRES_DB" > "$DUMP_FILE.temp"; then
exit 0
else
pg_ctl stop -m fast
echo "Database dump unsucessful!"
echo "Database dump unsuccessful!"
exit 1
fi

View File

@@ -1,13 +1,7 @@
# From https://github.com/docker-library/redis/blob/master/6.2/Dockerfile
FROM redis:6.2-bullseye
# From https://github.com/docker-library/redis/blob/master/6.2/alpine/Dockerfile
FROM redis:6.2.6-alpine3.15
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
openssl \
; \
rm -rf /var/lib/apt/lists/*
RUN apk add --update --no-cache openssl bash
COPY start.sh /usr/bin/
RUN chmod +x /usr/bin/start.sh

View File

@@ -1,4 +1,4 @@
FROM ubuntu:focal
FROM ubuntu:focal-20220302
EXPOSE 3478
@@ -19,7 +19,7 @@ RUN set -ex; \
echo "deb https://packaging.gitlab.io/nats-server nats main" > /etc/apt/sources.list.d/morph027-nats-server.list; \
. /etc/lsb-release; \
curl -sL -o "/etc/apt/trusted.gpg.d/morph027-janus.asc" "https://packaging.gitlab.io/janus/gpg.key"; \
echo "deb https://packaging.gitlab.io/janus $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/morph027-janus.list; \
echo "deb https://packaging.gitlab.io/janus/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/morph027-janus.list; \
curl -sL -o "/etc/apt/trusted.gpg.d/morph027-nextcloud-spreed-signaling.asc" "https://packaging.gitlab.io/nextcloud-spreed-signaling/gpg.key"; \
echo "deb https://packaging.gitlab.io/nextcloud-spreed-signaling signaling main" > /etc/apt/sources.list.d/morph027-nextcloud-spreed-signaling.list

View File

@@ -1,16 +1,9 @@
# From https://github.com/containrrr/watchtower/blob/main/dockerfiles/Dockerfile.self-contained
FROM containrrr/watchtower:latest as watchtower
FROM containrrr/watchtower:1.4.0 as watchtower
FROM debian:bullseye
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
; \
rm -rf /var/lib/apt/lists/*
FROM alpine:3.15.0
RUN apk add --update --no-cache bash
COPY --from=watchtower /watchtower /
COPY start.sh /

View File

@@ -16,5 +16,4 @@ else
exit 1
fi
exec "$@"

View File

@@ -1,4 +1,4 @@
## How to develope the app?
## How to develop the app?
Please note that in order to check if an app is already downloaded
Nextcloud will look for a folder with the same name as the app.

View File

@@ -42,7 +42,7 @@ The procedure for migrating the files and the database works like this:
```
1. Run the following command to start the conversion:
```
occ db:convert-type --all-apps pgsql "$PG_USER" 127.0.0.1 "$PG_DATABASE"
occ db:convert-type --all-apps --password "$PGDB_PASS" pgsql "$PG_USER" 127.0.0.1 "$PG_DATABASE"
```
**Please note:** You might need to change the ip-address `127.0.0.1` based on your exact installation.<br>
Further information on the conversion is additionally available here: https://docs.nextcloud.com/server/stable/admin_manual/configuration_database/db_conversion.html#converting-database-type

View File

@@ -17,5 +17,9 @@
"slim/twig-view": "^3.2",
"slim/csrf": "^1.2",
"ext-apcu": "*"
}
},
"scripts": {
"psalm": "psalm --threads=1",
"psalm:update-baseline": "psalm --threads=1 --update-baseline"
}
}

86
php/composer.lock generated
View File

@@ -50,12 +50,12 @@
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -157,12 +157,12 @@
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
],
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -409,12 +409,12 @@
},
"type": "library",
"autoload": {
"psr-4": {
"FastRoute\\": "src/"
},
"files": [
"src/functions.php"
]
],
"psr-4": {
"FastRoute\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -465,12 +465,12 @@
}
},
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": [
"functions.php"
]
],
"psr-4": {
"Opis\\Closure\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -595,12 +595,12 @@
},
"type": "library",
"autoload": {
"psr-4": {
"DI\\": "src/"
},
"files": [
"src/functions.php"
]
],
"psr-4": {
"DI\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -1437,7 +1437,7 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -1469,12 +1469,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -1499,7 +1499,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
},
"funding": [
{
@@ -1519,7 +1519,7 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
@@ -1551,12 +1551,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -1582,7 +1582,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
},
"funding": [
{
@@ -1602,7 +1602,7 @@
},
{
"name": "symfony/polyfill-php81",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
@@ -1628,12 +1628,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php81\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php81\\": ""
},
"classmap": [
"Resources/stubs"
]
@@ -1661,7 +1661,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0"
},
"funding": [
{
@@ -1681,16 +1681,16 @@
},
{
"name": "twig/twig",
"version": "v3.3.7",
"version": "v3.3.8",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "8f168c6ffa3ce76d1786b3cd52275424a3fc675b"
"reference": "972d8604a92b7054828b539f2febb0211dd5945c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/8f168c6ffa3ce76d1786b3cd52275424a3fc675b",
"reference": "8f168c6ffa3ce76d1786b3cd52275424a3fc675b",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c",
"reference": "972d8604a92b7054828b539f2febb0211dd5945c",
"shasum": ""
},
"require": {
@@ -1741,7 +1741,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.3.7"
"source": "https://github.com/twigphp/Twig/tree/v3.3.8"
},
"funding": [
{
@@ -1753,7 +1753,7 @@
"type": "tidelift"
}
],
"time": "2022-01-03T21:15:37+00:00"
"time": "2022-02-04T06:59:48+00:00"
}
],
"packages-dev": [],

View File

@@ -10,17 +10,18 @@
"displayName": "Apache",
"containerName": "nextcloud/aio-apache",
"ports": [
"443/tcp"
"%APACHE_PORT%/tcp"
],
"internalPorts": [
"443"
"%APACHE_PORT%"
],
"secrets": [],
"environmentVariables": [
"NC_DOMAIN=%NC_DOMAIN%",
"NEXTCLOUD_HOST=nextcloud-aio-nextcloud",
"COLLABORA_HOST=nextcloud-aio-collabora",
"TALK_HOST=nextcloud-aio-talk"
"TALK_HOST=nextcloud-aio-talk",
"APACHE_PORT=%APACHE_PORT%"
],
"volumes": [
{
@@ -95,9 +96,14 @@
"writeable": true
},
{
"name": "nextcloud_aio_nextcloud_data",
"name": "%NEXTCLOUD_DATADIR%",
"location": "/mnt/ncdata",
"writeable": true
},
{
"name": "%NEXTCLOUD_MOUNT%",
"location": "%NEXTCLOUD_MOUNT%",
"writeable": true
}
],
"environmentVariables": [
@@ -114,7 +120,6 @@
"NEXTCLOUD_DATA_DIR=/mnt/ncdata",
"OVERWRITEHOST=%NC_DOMAIN%",
"OVERWRITEPROTOCOL=https",
"TRUSTED_PROXIES=127.0.0.1",
"TURN_SECRET=%TURN_SECRET%",
"SIGNALING_SECRET=%SIGNALING_SECRET%",
"AIO_URL=%AIO_URL%"
@@ -151,7 +156,8 @@
"9980"
],
"environmentVariables": [
"domain=%NC_DOMAIN%"
"domain=%NC_DOMAIN%",
"extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:logging.level=warning"
],
"volumes": [],
"secrets": [],
@@ -194,7 +200,8 @@
"internalPorts": [],
"environmentVariables": [
"BORG_PASSWORD=%BORGBACKUP_PASSWORD%",
"BORG_MODE=%BORGBACKUP_MODE%"
"BORG_MODE=%BORGBACKUP_MODE%",
"SELECTED_RESTORE_TIME=%SELECTED_RESTORE_TIME%"
],
"volumes": [
{
@@ -208,7 +215,7 @@
"writeable": true
},
{
"name": "nextcloud_aio_nextcloud_data",
"name": "%NEXTCLOUD_DATADIR%",
"location": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data",
"writeable": true
},
@@ -271,11 +278,12 @@
"displayName": "Domaincheck",
"containerName": "nextcloud/aio-domaincheck",
"ports": [
"443/tcp"
"%APACHE_PORT%/tcp"
],
"internalPorts": [],
"environmentVariables": [
"INSTANCE_ID=%INSTANCE_ID%"
"INSTANCE_ID=%INSTANCE_ID%",
"APACHE_PORT=%APACHE_PORT%"
],
"volumes": [],
"secrets": [

113
php/psalm-baseline.xml Normal file
View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<file src="public/index.php">
<MissingClosureParamType occurrences="10">
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$request</code>
<code>$request</code>
<code>$request</code>
<code>$response</code>
<code>$response</code>
<code>$response</code>
</MissingClosureParamType>
</file>
<file src="src/Controller/ConfigurationController.php">
<MissingParamType occurrences="1">
<code>$args</code>
</MissingParamType>
<PossiblyInvalidArrayAccess occurrences="2">
<code>$request-&gt;getParsedBody()['borg_backup_host_location']</code>
<code>$request-&gt;getParsedBody()['domain']</code>
</PossiblyInvalidArrayAccess>
<PossiblyNullArgument occurrences="2">
<code>$request-&gt;getParsedBody()['borg_backup_host_location']</code>
<code>$request-&gt;getParsedBody()['domain']</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="2">
<code>$request-&gt;getParsedBody()['borg_backup_host_location']</code>
<code>$request-&gt;getParsedBody()['domain']</code>
</PossiblyNullArrayAccess>
</file>
<file src="src/Controller/DockerController.php">
<MissingParamType occurrences="7">
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
</MissingParamType>
<PossiblyInvalidArrayAccess occurrences="1">
<code>$request-&gt;getParsedBody()['selected_restore_time']</code>
</PossiblyInvalidArrayAccess>
<PossiblyNullArgument occurrences="1">
<code>$container</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="1">
<code>$request-&gt;getParsedBody()['selected_restore_time']</code>
</PossiblyNullArrayAccess>
<PossiblyNullReference occurrences="5">
<code>GetDependsOn</code>
<code>GetDependsOn</code>
<code>GetIdentifier</code>
<code>GetIdentifier</code>
<code>GetRunningState</code>
</PossiblyNullReference>
</file>
<file src="src/Controller/LoginController.php">
<MissingParamType occurrences="3">
<code>$args</code>
<code>$args</code>
<code>$args</code>
</MissingParamType>
<PossiblyInvalidArrayAccess occurrences="1">
<code>$request-&gt;getParsedBody()['password']</code>
</PossiblyInvalidArrayAccess>
<PossiblyNullArgument occurrences="1">
<code>$password</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="1">
<code>$request-&gt;getParsedBody()['password']</code>
</PossiblyNullArrayAccess>
</file>
<file src="src/Cron/cron.php">
<PossiblyNullArgument occurrences="2">
<code>$nextcloudContainer</code>
<code>$nextcloudContainer</code>
</PossiblyNullArgument>
</file>
<file src="src/Docker/DockerActionManager.php">
<InvalidReturnType occurrences="1">
<code>IContainerState</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="1">
<code>$internalPort</code>
</InvalidScalarArgument>
<PossiblyFalseOperand occurrences="1">
<code>strpos($fullDigest, "@")</code>
</PossiblyFalseOperand>
<PossiblyNullArgument occurrences="1">
<code>$apacheContainer</code>
</PossiblyNullArgument>
<PossiblyNullReference occurrences="1">
<code>GetUpdateState</code>
</PossiblyNullReference>
<RedundantCondition occurrences="1">
<code>$container-&gt;GetInternalPorts() !== null</code>
</RedundantCondition>
</file>
<file src="src/Middleware/AuthMiddleware.php">
<UndefinedInterfaceMethod occurrences="1">
<code>withStatus</code>
</UndefinedInterfaceMethod>
</file>
<file src="src/Twig/ClassExtension.php">
<MissingParamType occurrences="1">
<code>$object</code>
</MissingParamType>
</file>
</files>

15
php/psalm.xml Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="templates"/>
<directory name="src"/>
<file name="public/index.php"/>
</projectFiles>
</psalm>

View File

@@ -22,11 +22,6 @@ ini_set('session.save_path', $dataConst->GetSessionDirectory());
// Auto logout on browser close
ini_set('session.cookie_lifetime', '0');
// Make sure to delete all stale sessions after at least one day
ini_set('session.gc_maxlifetime', '86400');
ini_set('session.gc_probability', '1');
ini_set('session.gc_divisor', '1');
// Create app
AppFactory::setContainer($container);
$app = AppFactory::create();
@@ -87,6 +82,8 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
'was_start_button_clicked' => $configurationManager->wasStartButtonClicked(),
'has_update_available' => $dockerActionManger->isAnyUpdateAvailable(),
'last_backup_time' => $configurationManager->GetLastBackupTime(),
'backup_times' => $configurationManager->GetBackupTimes(),
'current_channel' => $dockerActionManger->GetCurrentChannel(),
]);
})->setName('profile');
$app->get('/login', function ($request, $response, $args) use ($container) {

View File

@@ -136,7 +136,7 @@ input {
padding: 20px;
max-width: 100%;
word-break: break-word;
max-width: 450px;
max-width: 470px;
margin: 0 auto;
}

View File

@@ -6,7 +6,7 @@ class ContainerVolumes {
/** @var ContainerVolume[] */
private array $volumes = [];
public function AddVolume(ContainerVolume $volume) {
public function AddVolume(ContainerVolume $volume) : void {
$this->volumes[] = $volume;
}

View File

@@ -51,11 +51,17 @@ class ContainerDefinitionFetcher
foreach ($data['production'] as $entry) {
$ports = new ContainerPorts();
foreach ($entry['ports'] as $port) {
if($port === '%APACHE_PORT%/tcp') {
$port = $this->configurationManager->GetApachePort() . '/tcp';
}
$ports->AddPort($port);
}
$internalPorts = new ContainerInternalPorts();
foreach ($entry['internalPorts'] as $internalPort) {
if($internalPort === '%APACHE_PORT%') {
$internalPort = $this->configurationManager->GetApachePort();
}
$internalPorts->AddInternalPort($internalPort);
}
@@ -67,6 +73,23 @@ class ContainerDefinitionFetcher
continue;
}
}
if($value['name'] === '%NEXTCLOUD_MOUNT%') {
$value['name'] = $this->configurationManager->GetNextcloudMount();
if($value['name'] === '') {
continue;
}
} elseif ($value['name'] === '%NEXTCLOUD_DATADIR%') {
$value['name'] = $this->configurationManager->GetNextcloudDatadirMount();
if ($value['name'] === '') {
continue;
}
}
if($value['location'] === '%NEXTCLOUD_MOUNT%') {
$value['location'] = $this->configurationManager->GetNextcloudMount();
if($value['location'] === '') {
continue;
}
}
$volumes->AddVolume(
new ContainerVolume(
$value['name'],

View File

@@ -25,6 +25,12 @@ class ConfigurationController
$this->configurationManager->SetDomain($request->getParsedBody()['domain']);
}
if (isset($request->getParsedBody()['current-master-password']) || isset($request->getParsedBody()['new-master-password'])) {
$currentMasterPassword = $request->getParsedBody()['current-master-password'] ?? '';
$newMasterPassword = $request->getParsedBody()['new-master-password'] ?? '';
$this->configurationManager->ChangeMasterPassword($currentMasterPassword, $newMasterPassword);
}
if (isset($request->getParsedBody()['borg_backup_host_location'])) {
$this->configurationManager->SetBorgBackupHostLocation($request->getParsedBody()['borg_backup_host_location']);
}

View File

@@ -26,7 +26,7 @@ class DockerController
$this->configurationManager = $configurationManager;
}
private function PerformRecursiveContainerStart(string $id) {
private function PerformRecursiveContainerStart(string $id) : void {
$container = $this->containerDefinitionFetcher->GetContainerById($id);
foreach($container->GetDependsOn() as $dependency) {
@@ -83,6 +83,7 @@ class DockerController
public function StartBackupContainerRestore(Request $request, Response $response, $args) : Response {
$config = $this->configurationManager->GetConfig();
$config['backup-mode'] = 'restore';
$config['selected-restore-time'] = $request->getParsedBody()['selected_restore_time'];
$this->configurationManager->WriteConfig($config);
$id = self::TOP_CONTAINER;
@@ -125,14 +126,15 @@ class DockerController
return $response->withStatus(201)->withHeader('Location', '/');
}
private function PerformRecursiveContainerStop(string $id)
private function PerformRecursiveContainerStop(string $id) : void
{
$container = $this->containerDefinitionFetcher->GetContainerById($id);
foreach($container->GetDependsOn() as $dependency) {
$this->PerformRecursiveContainerStop($dependency);
}
$this->dockerActionManager->DisconnectContainerFromNetwork($container);
// Disconnecting is not needed. This also allows to start the containers manually via docker-cli
//$this->dockerActionManager->DisconnectContainerFromNetwork($container);
$this->dockerActionManager->StopContainer($container);
}
@@ -144,7 +146,7 @@ class DockerController
return $response->withStatus(201)->withHeader('Location', '/');
}
public function StartDomaincheckContainer()
public function StartDomaincheckContainer() : void
{
# Don't start if domain is already set
if ($this->configurationManager->GetDomain() != '') {
@@ -165,7 +167,7 @@ class DockerController
$this->PerformRecursiveContainerStart($id);
}
private function StopDomaincheckContainer()
private function StopDomaincheckContainer() : void
{
$id = 'nextcloud-aio-domaincheck';
$this->PerformRecursiveContainerStop($id);

View File

@@ -46,7 +46,7 @@ class ConfigurationManager
return $config['secrets'][$secretId];
}
private function DoubleSafeBackupSecret(string $borgBackupPassword) {
private function DoubleSafeBackupSecret(string $borgBackupPassword) : void {
file_put_contents(DataConst::GetBackupSecretFile(), $borgBackupPassword);
}
@@ -64,7 +64,7 @@ class ConfigurationManager
}
$content = file_get_contents(DataConst::GetBackupArchivesList());
if ($content === "") {
if ($content === '') {
return '';
}
@@ -83,6 +83,28 @@ class ConfigurationManager
return $lastBackupTime;
}
public function GetBackupTimes() : array {
if (!file_exists(DataConst::GetBackupArchivesList())) {
return [];
}
$content = file_get_contents(DataConst::GetBackupArchivesList());
if ($content === '') {
return [];
}
$backupLines = explode("\n", $content);
$backupTimes = [];
foreach($backupLines as $lines) {
if ($lines !== "") {
$backupTimesTemp = explode(',', $lines);
$backupTimes[] = $backupTimesTemp[1];
}
}
return $backupTimes;
}
public function wasStartButtonClicked() : bool {
if (isset($this->GetConfig()['wasStartButtonClicked'])) {
return true;
@@ -95,11 +117,16 @@ class ConfigurationManager
* @throws InvalidSettingConfigurationException
*/
public function SetDomain(string $domain) : void {
// Validate URL
if (!filter_var('http://' . $domain, FILTER_VALIDATE_URL)) {
// Validate domain
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
throw new InvalidSettingConfigurationException("Domain is not in a valid format!");
}
// Validate that it is not an IP-address
if(filter_var($domain, FILTER_VALIDATE_IP)) {
throw new InvalidSettingConfigurationException("Please enter a domain and not an IP-address!");
}
$dnsRecordIP = gethostbyname($domain);
// Validate IP
@@ -117,15 +144,23 @@ class ConfigurationManager
// Get Instance ID
$instanceID = $this->GetSecret('INSTANCE_ID');
// set protocol
$port = $this->GetApachePort();
if ($port !== '443') {
$protocol = 'https://';
} else {
$protocol = 'http://';
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://' . $domain . ':443');
curl_setopt($ch, CURLOPT_URL, $protocol . $domain . ':443');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$response = (string)curl_exec($ch);
# Get rid of trailing \n
$response = str_replace("\n", "", $response);
if($response !== $instanceID) {
throw new InvalidSettingConfigurationException("Domain does not point to this server.");
throw new InvalidSettingConfigurationException("Domain does not point to this server or reverse proxy not configured correctly.");
}
// Write domain
@@ -152,6 +187,15 @@ class ConfigurationManager
return $config['backup-mode'];
}
public function GetSelectedRestoreTime() : string {
$config = $this->GetConfig();
if(!isset($config['selected-restore-time'])) {
$config['selected-restore-time'] = '';
}
return $config['selected-restore-time'];
}
public function GetAIOURL() : string {
$config = $this->GetConfig();
if(!isset($config['AIO_URL'])) {
@@ -192,6 +236,57 @@ class ConfigurationManager
$this->WriteConfig($config);
}
/**
* @throws InvalidSettingConfigurationException
*/
public function ChangeMasterPassword(string $currentPassword, string $newPassword) : void {
if ($currentPassword === '') {
throw new InvalidSettingConfigurationException("Please enter your current password.");
}
if ($currentPassword !== $this->GetPassword()) {
throw new InvalidSettingConfigurationException("The entered current password is not correct.");
}
if ($newPassword === '') {
throw new InvalidSettingConfigurationException("Please enter a new password.");
}
if (strlen($newPassword) < 24) {
throw new InvalidSettingConfigurationException("New passwords must be >= 24 digits.");
}
if (!preg_match("#^[a-zA-Z0-9 ]+$#", $newPassword)) {
throw new InvalidSettingConfigurationException('Not allowed characters in the new password.');
}
// All checks pass so set the password
$this->SetPassword($newPassword);
}
public function GetApachePort() : string {
$port = getenv('APACHE_PORT');
if ($port === false) {
$config = $this->GetConfig();
if (!isset($config['apache_port']) || $config['apache_port'] === '') {
$config['apache_port'] = '443';
}
return $config['apache_port'];
} else {
if(file_exists(DataConst::GetConfigFile())) {
$config = $this->GetConfig();
if (!isset($config['apache_port'])) {
$config['apache_port'] = '';
}
if ($port !== $config['apache_port']) {
$config['apache_port'] = $port;
$this->WriteConfig($config);
}
}
return $port;
}
}
/**
* @throws InvalidSettingConfigurationException
*/
@@ -219,4 +314,50 @@ class ConfigurationManager
return $config['backup-mode'];
}
public function GetNextcloudMount() : string {
$mount = getenv('NEXTCLOUD_MOUNT');
if ($mount === false) {
$config = $this->GetConfig();
if (!isset($config['nextcloud_mount'])) {
$config['nextcloud_mount'] = '';
}
return $config['nextcloud_mount'];
} else {
if(file_exists(DataConst::GetConfigFile())) {
$config = $this->GetConfig();
if (!isset($config['nextcloud_mount'])) {
$config['nextcloud_mount'] = '';
}
if ($mount !== $config['nextcloud_mount']) {
$config['nextcloud_mount'] = $mount;
$this->WriteConfig($config);
}
}
return $mount;
}
}
public function GetNextcloudDatadirMount() : string {
$mount = getenv('NEXTCLOUD_DATADIR');
if ($mount === false) {
$config = $this->GetConfig();
if (!isset($config['nextcloud_datadir']) || $config['nextcloud_datadir'] === '') {
$config['nextcloud_datadir'] = 'nextcloud_aio_nextcloud_data';
}
return $config['nextcloud_datadir'];
} else {
if(file_exists(DataConst::GetConfigFile())) {
$config = $this->GetConfig();
if (!isset($config['nextcloud_datadir'])) {
$config['nextcloud_datadir'] = '';
}
if ($mount !== $config['nextcloud_datadir']) {
$config['nextcloud_datadir'] = $mount;
$this->WriteConfig($config);
}
}
return $mount;
}
}
}

View File

@@ -77,7 +77,7 @@ class DockerActionManager
$runningDigest = $this->GetRepoDigestOfContainer($container->GetIdentifier());
$remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($container->GetContainerName(), $tag);
if ($runningDigest === $remoteDigest) {
if ($runningDigest === $remoteDigest || $remoteDigest === null || $runningDigest === null) {
return new VersionEqualState();
} else {
return new VersionDifferentState();
@@ -109,7 +109,7 @@ class DockerActionManager
}
}
public function DeleteContainer(Container $container) {
public function DeleteContainer(Container $container) : void {
$url = $this->BuildApiUrl(sprintf('containers/%s?v=true', urlencode($container->GetIdentifier())));
try {
$this->guzzleClient->delete($url);
@@ -142,12 +142,12 @@ class DockerActionManager
return $response;
}
public function StartContainer(Container $container) {
public function StartContainer(Container $container) : void {
$url = $this->BuildApiUrl(sprintf('containers/%s/start', urlencode($container->GetIdentifier())));
$this->guzzleClient->post($url);
}
public function CreateVolumes(Container $container)
public function CreateVolumes(Container $container): void
{
$url = $this->BuildApiUrl('volumes/create');
foreach($container->GetVolumes()->GetVolumes() as $volume) {
@@ -170,7 +170,7 @@ class DockerActionManager
}
}
public function CreateContainer(Container $container) {
public function CreateContainer(Container $container) : void {
$volumes = [];
foreach($container->GetVolumes()->GetVolumes() as $volume) {
$volumeEntry = $volume->name . ':' . $volume->mountPoint;
@@ -212,6 +212,10 @@ class DockerActionManager
$replacements[1] = $this->configurationManager->GetBackupMode();
} elseif ($out[1] === 'AIO_URL') {
$replacements[1] = $this->configurationManager->GetAIOURL();
} elseif ($out[1] === 'SELECTED_RESTORE_TIME') {
$replacements[1] = $this->configurationManager->GetSelectedRestoreTime();
} elseif ($out[1] === 'APACHE_PORT') {
$replacements[1] = $this->configurationManager->GetApachePort();
} else {
$replacements[1] = $this->configurationManager->GetSecret($out[1]);
}
@@ -255,13 +259,21 @@ class DockerActionManager
);
}
public function PullContainer(Container $container)
public function PullContainer(Container $container) : void
{
$url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', urlencode($this->BuildImageName($container))));
try {
$this->guzzleClient->post($url);
} catch (RequestException $e) {
throw $e;
$pullcontainer = true;
if ($container->GetIdentifier() === 'nextcloud-aio-database') {
if ($this->GetDatabasecontainerExitCode() > 0) {
$pullcontainer = false;
}
}
if ($pullcontainer) {
$url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', urlencode($this->BuildImageName($container))));
try {
$this->guzzleClient->post($url);
} catch (RequestException $e) {
throw $e;
}
}
}
@@ -279,10 +291,9 @@ class DockerActionManager
return $updateAvailable;
}
public function isAnyUpdateAvailable() {
public function isAnyUpdateAvailable() : bool {
$id = 'nextcloud-aio-apache';
if ($this->isContainerUpdateAvailable($id) !== "") {
return true;
} else {
@@ -343,14 +354,14 @@ class DockerActionManager
$runningDigest = $this->GetRepoDigestOfContainer($containerName);
$remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($imageName, $tag);
if ($remoteDigest === $runningDigest) {
if ($remoteDigest === $runningDigest || $remoteDigest === null || $runningDigest === null) {
return false;
} else {
return true;
}
}
public function sendNotification(Container $container, string $subject, string $message)
public function sendNotification(Container $container, string $subject, string $message) : void
{
if ($this->GetContainerStartingState($container) instanceof RunningState) {
@@ -396,7 +407,7 @@ class DockerActionManager
}
}
public function DisconnectContainerFromNetwork(Container $container)
public function DisconnectContainerFromNetwork(Container $container) : void
{
$url = $this->BuildApiUrl(
@@ -417,7 +428,7 @@ class DockerActionManager
}
}
private function ConnectContainerIdToNetwork(string $id)
private function ConnectContainerIdToNetwork(string $id) : void
{
$url = $this->BuildApiUrl('networks/create');
try {
@@ -460,17 +471,17 @@ class DockerActionManager
}
}
public function ConnectMasterContainerToNetwork()
public function ConnectMasterContainerToNetwork() : void
{
$this->ConnectContainerIdToNetwork('nextcloud-aio-mastercontainer');
}
public function ConnectContainerToNetwork(Container $container)
public function ConnectContainerToNetwork(Container $container) : void
{
$this->ConnectContainerIdToNetwork($container->GetIdentifier());
}
public function StopContainer(Container $container) {
public function StopContainer(Container $container) : void {
$url = $this->BuildApiUrl(sprintf('containers/%s/stop?t=%s', urlencode($container->GetIdentifier()), $container->GetMaxShutdownTime()));
try {
$this->guzzleClient->post($url);
@@ -504,6 +515,29 @@ class DockerActionManager
}
}
public function GetDatabasecontainerExitCode() : int
{
$containerName = 'nextcloud-aio-database';
$url = $this->BuildApiUrl(sprintf('containers/%s/json', urlencode($containerName)));
try {
$response = $this->guzzleClient->get($url);
} catch (RequestException $e) {
if ($e->getCode() === 404) {
return -1;
}
throw $e;
}
$responseBody = json_decode((string)$response->getBody(), true);
$exitCode = $responseBody['State']['ExitCode'];
if (is_int($exitCode)) {
return $exitCode;
} else {
return -1;
}
}
public function isLoginAllowed() : bool {
$id = 'nextcloud-aio-apache';
$apacheContainer = $this->containerDefinitionFetcher->GetContainerById($id);

View File

@@ -16,7 +16,7 @@
</header>
<div class="content">
<h1>Nextcloud AIO Beta v0.2.1</h1>
<h1>Nextcloud AIO Beta v0.7.0</h1>
This is beta software and not production ready.<br><br>
{% set isAnyRunning = false %}
@@ -48,25 +48,36 @@
{% endfor %}
{% if isWatchtowerRunning == true %}
Mastercontainer updpate currently running. It will restart the mastercontainer soon which will make it unavailable for a moment. Please wait until thats done.<br /><br />
Mastercontainer update currently running. It will restart the mastercontainer soon which will make it unavailable for a moment. Please wait until that's done.<br /><br />
<a href="" class="button reload">Reload ↻</a><br/>
{% else %}
{% if isBackupOrRestoreRunning == false and domain == "" %}
Please type in the domain that will be used for Nextcloud:<br><br />
<form method="POST" action="/api/configuration" class="xhr">
<input type="text" name="domain" value="{{ domain }}" placeholder="nextcloud.yourdomain.com"/>
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Submit" />
</form>
Make sure that this server is reachable on Port 443 and you've correctly set up the DNS config for the domain that you enter. <br><br>
If you have a dynamic IP-adress, you can use e.g. <a href="https://ddclient.net/">DDclient</a> with a compatible domain provider for DNS updates.
{% if is_mastercontainer_update_available == true %}
<h2>Mastercontainer update</h2>
⚠ A mastercontainer update is available. Please click on the button below to update it. Afterwards, you will be able to proceed with the setup.<br><br>
<form method="POST" action="/api/docker/watchtower" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Update mastercontainer" />
</form>
{% else %}
Please type in the domain that will be used for Nextcloud:<br><br />
<form method="POST" action="/api/configuration" class="xhr">
<input type="text" name="domain" value="{{ domain }}" placeholder="nextcloud.yourdomain.com"/>
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Submit" />
</form>
Make sure that this server is reachable on Port 443 and you've correctly set up the DNS config for the domain that you enter. <br><br>
If you have a dynamic IP-address, you can use e.g. <a href="https://ddclient.net/">DDclient</a> with a compatible domain provider for DNS updates.
{% endif %}
{% endif %}
{% if domain != "" %}
{% if isAnyRunning == true %}
{% if isApacheStarting != true %}
Your initial Nextcloud credentials:<br><br />
Initial Nextcloud username: admin<br />
Initial Nextcloud password: {{ nextcloud_password }}<br /><br/>
<a href="https://{{ domain }}" class="button" target="_blank" rel="noopener">Open your Nextcloud ↗</a><br/>
@@ -99,18 +110,21 @@
</ul>
{% if has_update_available == true %}
⚠ Container updates are available. Click on `Stop Containers` and `Start Containers` to update them. You should consider creating a backup first. The mastercontainer gets updated with a different procedure though and has its own update button which is visible if an update is available.<br><br>
{% if is_mastercontainer_update_available == false %}
⚠ Container updates are available. Click on `Stop Containers` and `Start Containers` to update them. You should consider creating a backup first.<br><br>
{% endif %}
{% else %}
{% if is_mastercontainer_update_available == false %}
Your containers are up-to-date.<br><br>
{% else %}
Your containers are up-to-date. (Except the mastercontainer. See the section below.)<br><br>
{% endif %}
{% endif %}
{% endif %}
{% if isAnyRunning == true %}
{% if isApacheStarting != true %}
{% if is_mastercontainer_update_available == true %}
⚠ A mastercontainer update is available. Please click on the button below to stop your containers in order to be able to update the mastercontainer.<br /><br />
{% endif %}
<form method="POST" action="/api/docker/stop" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
@@ -126,37 +140,63 @@
{% if was_start_button_clicked == false %}
Clicking on the button below will download all docker containers and start them. This can take a lot of time depending on your internect connection. Since the overall size is a few GB, this will take around 5-10 min or more. So be aware and patient!<br><br>
{% endif %}
{% if was_start_button_clicked == false or has_update_available == false %}
<form method="POST" action="/api/docker/start" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Start containers" />
</form>
{% if is_mastercontainer_update_available == true %}
⚠ Please update your mastercontainer. Afterwards, you will be able to start your containers again.<br><br>
{% else %}
<form method="POST" action="/api/docker/start" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button " type="submit" value="Start and update containers" onclick="return confirm('Start and update containers? You should consider creating a backup first.')" />
</form>
{% if was_start_button_clicked == false or has_update_available == false %}
<form method="POST" action="/api/docker/start" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Start containers" />
</form>
{% else %}
<form method="POST" action="/api/docker/start" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button " type="submit" value="Start and update containers" onclick="return confirm('Start and update containers? You should consider creating a backup first.')" />
</form>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if is_mastercontainer_update_available == true %}
{% if isBackupOrRestoreRunning == false %}
<h2>Mastercontainer update</h2>
⚠ A mastercontainer update is available. Please click on the button below to update it. All other containers get updated independently from the mastercontainer by simply clicking on `Stop containers` and clicking on `Start containers` if a new update is available.<br><br>
<form method="POST" action="/api/docker/watchtower" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Update mastercontainer" />
</form>
{% endif %}
{% endif %}
{% if was_start_button_clicked == true %}
{% if isBackupOrRestoreRunning == false %}
<h2>Mastercontainer</h2>
You are currently running the {{ current_channel }} channel.<br><br>
{% if is_mastercontainer_update_available == true %}
{% if isAnyRunning == false %}
⚠ A mastercontainer update is available. Please click on the button below to update it.<br><br>
<form method="POST" action="/api/docker/watchtower" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Update mastercontainer" />
</form>
{% else %}
⚠ A mastercontainer update is available. Please stop your containers in order to be able to update the mastercontainer.<br><br>
{% endif %}
{% if current_channel starts with 'latest' %}
You can find the changelog <a href="https://github.com/nextcloud/all-in-one/releases/latest">here</a><br><br>
{% elseif current_channel starts with 'beta' %}
You can find the changelog <a href="https://github.com/nextcloud/all-in-one/releases">here</a><br><br>
{% elseif current_channel starts with 'develop' %}
You can find all changes <a href="https://github.com/nextcloud-releases/all-in-one/commits/main">here</a><br><br>
{% endif %}
{% endif %}
{% if isApacheStarting == false %}
You can change your AIO password below:<br><br />
<form method="POST" action="/api/configuration" class="xhr">
<input type="text" autocomplete="current-password" name="current-master-password" placeholder="your current aio password"/>
<input type="text" autocomplete="new-password" name="new-master-password" placeholder="your new aio password"/>
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Submit" />
</form>
The new password needs to be at least 24 characters long. Allowed characters are the <a href="https://en.wikipedia.org/wiki/Latin_alphabet#/media/File:Abecedarium.png">latin characters</a> 'a-z', 'A-Z', '0-9' and spaces.<br><br>
{% endif %}
{% endif %}
{% if isBackupOrRestoreRunning == false and borg_backup_host_location == "" and isApacheStarting != true %}
<h2>Backup and restore</h2>
@@ -177,9 +217,9 @@
<span class="status error"></span> Last {{ borg_backup_mode }} failed! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
{% elseif backup_exit_code == 0 %}
{% if borg_backup_mode == "backup" %}
<span class="status success"></span> Last {{ borg_backup_mode }} succesful on {{ last_backup_time }}! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
<span class="status success"></span> Last {{ borg_backup_mode }} successful on {{ last_backup_time }}! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
{% else %}
<span class="status success"></span> Last {{ borg_backup_mode }} succesful! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
<span class="status success"></span> Last {{ borg_backup_mode }} successful! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup">Logs</a>)<br /><br />
{% endif %}
{% endif %}
{% endif %}
@@ -190,6 +230,7 @@
Backed up will get all important data of your Nextcloud AIO instance like the database, your files and configuration files of the mastercontainer and else. <br /><br/>
The backup itself will use a tool that is called <a href="https://github.com/borgbackup/borg#what-is-borgbackup">BorgBackup<a/> which is a well-known server backup tool that efficiently backs up your files and encrypts them on the fly. <br /><br/>
Backups get created in the following directory on the host: {{ borg_backup_host_location }}/borg <br /><br/>
Be aware that this solution does not back up files and folders that are mounted into Nextcloud using the external storage app. <br /><br/>
{% if isApacheStarting != true %}
<form method="POST" action="/api/docker/backup" class="xhr">
@@ -206,11 +247,16 @@
<input class="button" type="submit" value="Check backup integrity" onclick="return confirm('Check backup integrity? Are you sure that you want to check the backup? This can take a long time depending on the size of your backup.')" /><br/>
</form>
Click on the button below to restore the last backup from {{ last_backup_time }}. This will overwrite all your files with the state of the backup. It makes sense to run an integrity check before restoring your files but is not mandatory since it shouldn't be needed in most situations.<br><br>
<form method="POST" action="/api/docker/restore" class="xhr">
Choose the backup that you want to restore and click on the button below to restore the selected backup. This will overwrite all your files with the state of the backup so you should consider creating a backup first. It also makes sense to run an integrity check before restoring your files but is not mandatory since it shouldn't be needed in most situations.<br><br>
<form method="POST" action="/api/docker/restore" class="xhr" id="restore_selection">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Restore last backup" onclick="return confirm('Restore last backup? Are you sure that you want to restore the last backup? This will stop all running containers and restore the last backup from {{ last_backup_time }}. You might want to check the backup integrity first.')" />
<select id="selected_restore_time" name="selected_restore_time" form="restore_selection">
{% for restore_time in backup_times %}
<option value="{{ restore_time }}">{{ restore_time }}</option>
{% endfor %}
</select>
<input class="button" type="submit" value="Restore selected backup" onclick="return confirm('Restore the selected backup? Are you sure that you want to restore the selected backup? This will stop all running containers and restore the selected backup. It is recommended to create a backup first. You might also want to check the backup integrity.')" />
</form>
{% endif %}
{% endif %}
@@ -221,6 +267,10 @@
{% endif %}
{% endif %}
{% endif %}
<h2>Optional</h2>
In this section, you will find optional addons in the future.
It will disable the ability to change them when any containers are running and allow to change them when they are stopped.
Also, it will display possible sections for optional addons. (which itself will be displayed when enabled and running).
{% endif %}
{% endif %}

163
readme.md
View File

@@ -66,29 +66,29 @@ Included are:
</details>
4. After the initial startup, you should be able to open the Nextcloud AIO Interface now on port 8080 of this server.<br>
E.g. https://internal.ip.of.this.server:8080<br>
E.g. `https://internal.ip.of.this.server:8080`<br>
If your server has port 80 and 8443 open and you point a domain to your server, you can get a valid certificate automatially by opening the Nextcloud AIO Interface via:<br>
https://your-domain-that-points-to-this-server.tld:8443
`https://your-domain-that-points-to-this-server.tld:8443`
5. Please do not forget to open port `3478/TCP` and `3478/UDP` for the Talk container!
## FAQ
### How does it work?
Nextcloud AIO is inspired by projects like Portainer that allow to manage the docker daemon by talking to the docker socket directly. This concept allows to install only one container with a single command that does the heavy lifting of creating and managing all containers that are needed in order to provide a Nextcloud installation with most features included. It also makes updating a breeze and is not bound to the host system (and its slow updates) anymore as everything is in containers. Additionally, it is very easy to handle from a user perspective because a simple interface for managing your Nextcloud AIO installation is provided.
### Are reverse proxies supported?
Reverse proxies are currently because of the above mentioned architecture not supported.<br>
You might investigate yourself though how it could made work behind reverse proxies. If you open a PR with that we might consider it then :)
Yes. Please refer to the following documentation on this: [reverse-proxy.md](https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md)
### Which ports are mandatory to be open?
Only those (if you acces the Mastercontainer Interface internally via port 8080):
- `443/TCP` for the Nextcloud container
- `3478/TCP` and `3478/UPD` for the Talk container
- `443/TCP` for the Apache container
- `3478/TCP` and `3478/UDP` for the Talk container
### Explanation of used ports:
- `8080/TCP`: Mastercontainer Interface with self-signed certificate (works always, also if only access via IP-address is possible, e.g. `https://internal.ip.address:8080/`)
- `80/TCP`: redirects to Nextcloud (is used for getting the certificate via ACME http-challenge for the Mastercontainer)
- `8443/TCP`: Mastercontainer Interface with valid certificate (only works if port 80 and 8443 are open and you point a domain to your server. It generates a valid certificate then automatically and access via e.g. `https://public.domain.com:8443/` is possible.)
- `443/TCP`: will be used by the Nextcloud container later on and needs to be open
- `3478/TCP` and `3478/UPD`: will be used by the Turnserver inside the Talk container and needs to be open
- `443/TCP`: will be used by the Apache container later on and needs to be open
- `3478/TCP` and `3478/UDP`: will be used by the Turnserver inside the Talk container and needs to be open
### How to run `occ` commands?
Simply run the following: `sudo docker exec -it nextcloud-aio-nextcloud php occ your-command`. Of course `your-command` needs to be exchanged with the command that you want to run.
@@ -113,11 +113,151 @@ It is recommended to create a backup before any container update. By doing this,
If you connect an external drive to your host, and choose the backup directory to be on that drive, you are also kind of save against drive failures of the drive where the docker volumes are stored on.
Backups can be created and restored in the AIO interface using the buttons `Create Backup` and `Restore last backup`. Additionally, a backup check is provided that checks the integrity of your backups but it shouldn't be needed in most situations.
Backups can be created and restored in the AIO interface using the buttons `Create Backup` and `Restore selected backup`. Additionally, a backup check is provided that checks the integrity of your backups but it shouldn't be needed in most situations.
The backups itself get encrypted with an encryption key that gets shown to you in the AIO interface. Please save that at a safe place as you will not be able to restore from backup without this key.
Note that this implementation does not provide remote backups, for this you can use the [backup app](https://apps.nextcloud.com/apps/backup).
Be aware that this solution does not back up files and folders that are mounted into Nextcloud using the external storage app.
Note that this implementation does not provide remote backups, for this you can use the [backup app](https://apps.nextcloud.com/apps/backup).
---
#### Failure of the backup container in LXC containers
If you are running AIO in a LXC container, you need to make sure that FUSE is enabled in the LXC container settings. Otherwise the backup container will not be able to start as FUSE is required for it to work.
---
#### Pro-tip: Backup archives access
You can open the BorgBackup archives on your host by following these steps:<br>
(instructions for Ubuntu Desktop)
```bash
# Install borgbackup on the host
sudo apt update && sudo apt install borgbackup
# Mount the archives to /tmp/borg (if you are using the default backup location /mnt/backup/borg)
sudo mkdir -p /tmp/borg && sudo borg mount "/mnt/backup/borg" /tmp/borg
# After entering your repository key successfully, you should be able to access all archives in /tmp/borg
# You can now do whatever you want by syncing them to a different place using rsync or doing other things
# E.g. you can open the file manager on that location by running:
xhost +si:localuser:root && sudo nautilus /tmp/borg
# When you are done, simply close the file manager and run the following command to unmount the backup archives:
sudo umount /tmp/borg
```
---
#### Delete backup archives manually
You can delete BorgBackup archives on your host manually by following these steps:<br>
(instructions for Debian based OS' like Ubuntu)
```bash
# Install borgbackup on the host
sudo apt update && sudo apt install borgbackup
# List all archives (if you are using the default backup location /mnt/backup/borg)
sudo borg list "/mnt/backup/borg"
# After entering your repository key successfully, you should now see a list of all backup archives
# An example backup archive might be called 20220223_174237-nextcloud-aio
# Then you can simply delete the archive with:
sudo borg delete --stats --progress "/mnt/backup/borg::20220223_174237-nextcloud-aio"
```
After doing so, make sure to update the backup archives list in the AIO interface!<br>
You can do so by clicking on the `Check backup integrity` button or `Create backup` button.
---
#### Sync the backup regularly to another drive
For increased backup security, you might consider syncing the backup repository regularly to another drive.
To do that, first add the drive to `/etc/fstab` so that it is able to get automatically mounted and then create a script that does all the things automatically. Here is an example for such a script:
<details>
<summary>Click here to expand</summary>
```bash
#!/bin/bash
# Please modify all variables below to your needings:
SOURCE_DIRECTORY="/mnt/backup/borg"
DRIVE_MOUNTPOINT="/mnt/backup-drive"
TARGET_DIRECTORY="/mnt/backup-drive/borg"
########################################
# Please do NOT modify anything below! #
########################################
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
if ! [ -d "$SOURCE_DIRECTORY" ]; then
echo "The source directory does not exist."
exit 1
fi
if ! [ -d "$DRIVE_MOUNTPOINT" ]; then
echo "The drive mountpoint must be an existing directory"
exit 1
fi
if ! grep -q " $DRIVE_MOUNTPOINT " /etc/fstab; then
echo "Could not find the drive mountpoint in the fstab file. Did you add it there?"
exit 1
fi
if ! mountpoint -q "$DRIVE_MOUNTPOINT"; then
mount "$DRIVE_MOUNTPOINT"
if ! mountpoint -q "$DRIVE_MOUNTPOINT"; then
echo "Could not mount the drive. Is it connected?"
exit 1
fi
fi
if [ -f "$SOURCE_DIRECTORY/lock.roster" ]; then
echo "Cannot run the script as the backup archive is currently changed. Please try again later."
exit 1
fi
mkdir -p "$TARGET_DIRECTORY"
if ! [ -d "$TARGET_DIRECTORY" ]; then
echo "Could not create target directory"
exit 1
fi
if ! rsync --stats --archive --human-readable --delete "$SOURCE_DIRECTORY/" "$TARGET_DIRECTORY"; then
echo "Failed to sync the backup repository to the target directory."
exit 1
fi
umount "$DRIVE_MOUNTPOINT"
if mountpoint -q "$DRIVE_MOUNTPOINT"; then
echo "Synced the backup repository successfully but failed to unmount the target drive."
exit 0
fi
echo "Synced the backup repository successfully and unmounted the target drive."
exit 0
```
</details>
You can simply copy and past the script into a file e.g. named `backup-script.sh` e.g. here: `/root/backup-script.sh`. Do not forget to modify the variables to your needings though!
Afterwards apply the correct permissions with `sudo chown root:root /root/backup-script.sh` and `sudo chmod 700 /root/backup-script.sh`. Then you can create a cronjob that runs e.g. at `20:00` each week on sundays like this: `crontab -u root -l | { cat; echo "0 20 * * 7 /root/backup-script.sh"; } | crontab -u root -`. Make sure that it does not collidate with the daily backups from AIO (if configured) since the target backup repository might get into an inconsistent state. (There is no check in place that checks this.)
### How to change the default location of Nextcloud's Datadir?
You can configure the Nextcloud container to use a specific directory on your host as data directory. You can do so by adding the environmental variable `NEXTCLOUD_DATADIR` to the initial startup of the mastercontainer. Allowed values for that variable are strings that start with `/mnt/` or `/media/`. An example for this is `-e NEXTCLOUD_DATADIR="/mnt/ncdata"`. Please make sure to apply the correct permissions to the chosen directory before starting Nextcloud the first time. In this example would the command for this be: `sudo chown -R 33:0 /mnt/ncdata`. **Attention:** It is very important to change the datadir **before** Nextcloud is installed/started the first time and not to change it afterwards!
### How to allow the Nextcloud container to access directories on the host?
By default, the Nextcloud container is confined and cannot access directories on the host OS. You might want to change this when you are planning to use local external storage in Nextcloud to store some files outside the data directory and can do so by adding the environmental variable `NEXTCLOUD_MOUNT` to the initial startup of the mastercontainer. Allowed values for that variable are strings that are equal to or start with `/mnt/` or `/media/` or are equal to `/var/backups` and unequal to `/mnt/ncdata`. Two examples for this are: `-e NEXTCLOUD_MOUNT="/mnt/"` or `-e NEXTCLOUD_MOUNT="/media/"`. After doing so, please make sure to apply the correct permissions to the directories that you want to use in Nextcloud. E.g. `sudo chown -R 33:0 /mnt/your-drive-mountpoint` should make it work. You can then navigate to the apps management page, activate the external storage app, navigate to `https://your-nc-domain.com/settings/admin/externalstorages` and add a local external storage directory that will be accessible inside the container at the same place that you've entered. E.g. `/mnt/your-drive-mountpoint` will be mounted to `/mnt/your-drive-mountpoint` inside the container, etc. Be aware though that these locations will not be covered by the built-in backup solution!
### Huge docker logs
When your containers run for a few days without a restart, the container logs that you can view from the AIO interface can get really huge. You can limit the loge sizes by enabling logrotate for docker container logs. Feel free to enable this by following those instructions: https://sandro-keil.de/blog/logrotate-for-docker-container/
### Access/Edit Nextcloud files/folders manually
The files and folders that you add to Nextcloud are by default stored in the following directory: `/var/lib/docker/volumes/nextcloud_aio_nextcloud_data/_data/` on the host. If needed, you can modify/add/delete files/folders there but **ATTENTION**: be very careful when doing so because you might corrupt your AIO installation! Best is to create a backup using the built-in backup solution before editing/changing files/folders in there because you will then be able to restore your instance to the backed up state.
@@ -131,6 +271,9 @@ You can move the whole docker library and all its files including all Nextcloud
### How to edit Nextclouds config.php file with a texteditor?
You can edit Nextclouds config.php file directly from the host with your favorite text editor. E.g. like this: `sudo nano /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/config/config.php`. Make sure to not break the file though which might corrupt your Nextcloud instance otherwise. In best case, create a backup using the built-in backup solution before editing the file.
### Custom skeleton directory
If you want to define a custom skeleton directory, you can do so by putting your skeleton files into `/var/lib/docker/volumes/nextcloud_aio_nextcloud_data/_data/skeleton/`, applying the correct permissions with `sudo chown -R 33:0 /var/lib/docker/volumes/nextcloud_aio_nextcloud_data/_data/skeleton` and setting the skeleton directory option with `sudo docker exec -it nextcloud-aio-nextcloud php occ config:system:set skeletondirectory --value="/mnt/ncdata/skeleton"`. You can read further on this option here: [click here](https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=skeletondir#:~:text=adding%20%3Fdirect%3D1-,'skeletondirectory',-%3D%3E%20'%2Fpath%2Fto%2Fnextcloud)
### LDAP
It is possible to connect to an existing LDAP server. You need to make sure that the LDAP server is reachable from the Nextcloud container. Then you can enable the LDAP app and configure LDAP in Nextcloud manually. If you don't have a LDAP server yet, recommended is to use this docker container: https://hub.docker.com/r/osixia/openldap/. Make sure here as well that Nextcloud can talk to the LDAP server. The easiest way is by adding the LDAP docker container to the docker network `nextcloud-aio`. Then you can connect to the LDAP container by its name from the Nextcloud container. **Pro-tip**: You will probably find this app useful: https://apps.nextcloud.com/apps/ldap_write_support

68
reverse-proxy.md Normal file
View File

@@ -0,0 +1,68 @@
## Reverse Proxy Config
Basically, you need to specify the port that the apache container shall use and modify the startup command a bit.
All examples below will use port `11000` as example apache port. Also it is supposed that the reverse proxy runs on the same server like AIO, hence `localhost` is used and not an internal ip-address to point to the AIO instance. Modify both to your needings.
### Caddy reverse proxy config example
Add this to your Caddyfile:
```
https://<your-nc-domain>:443 {
header Strict-Transport-Security max-age=31536000;
reverse_proxy localhost:11000
}
```
Of course you need to modify `<your-nc-domain>` to the domain on which you want to run Nextcloud.
### Startup command
```
# For x64 CPUs:
sudo docker run -it \
--name nextcloud-aio-mastercontainer \
--restart always \
-p 8080:8080 \
-e APACHE_PORT=11000 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest
```
<details>
<summary>Command for arm64 CPUs like the Raspberry Pi 4</summary>
```
# For arm64 CPUs:
sudo docker run -it \
--name nextcloud-aio-mastercontainer \
--restart always \
-p 8080:8080 \
-e APACHE_PORT=11000 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest-arm64
```
</details>
After doing so, you should be able to access the AIO Interface via `https://internal.ip.of.this.server:8080`. Enter your domain that you've entered in the reverse proxy config and you should be done. Please do not forget to open port `3478/TCP` and `3478/UDP` for the Talk container!
### Optional
If you want to also access your AIO interface publicly with a valid certificate, you can add e.g. the following config to your Caddyfile:
```
https://<your-nc-domain>:8443 {
reverse_proxy https://localhost:8080 {
transport http {
tls_insecure_skip_verify
}
}
}
```
Of course you also need to modify `<your-nc-domain>` to the domain that you want to use. Afterwards should the AIO interface be accessible via `https://<your-nc-domain>:8443`.