forked from coop-cloud/nextcloud
Compare commits
23 Commits
add-postgr
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
8b138eac19 | ||
|
819378f3fb | ||
|
8dcc2925ea | ||
|
2ec6f21dd1 | ||
|
9a070231c7 | ||
63ce9a6fb9 | |||
827cb16964 | |||
992992d678 | |||
20f0a45baf | |||
e996b5c057 | |||
0aabef8f7b | |||
2be42d0a84 | |||
e76454c4fd | |||
ec39fd5fed | |||
16ad6c22ea | |||
daa57eece9 | |||
2ddf11728f | |||
71d15ef4df | |||
0d4f060e94 | |||
1e1977a2b4 | |||
801e0a0762 | |||
01f610d02f | |||
12eea19cab |
11
.env.sample
11
.env.sample
@ -1,10 +1,14 @@
|
|||||||
TYPE=nextcloud
|
TYPE=nextcloud
|
||||||
|
|
||||||
DOMAIN=nextcloud.example.com
|
DOMAIN={{ .Domain }}
|
||||||
## Domain aliases
|
## Domain aliases
|
||||||
#EXTRA_DOMAINS=', `www.nextcloud.example.com`'
|
#EXTRA_DOMAINS=', `www.nextcloud.example.com`'
|
||||||
LETS_ENCRYPT_ENV=production
|
LETS_ENCRYPT_ENV=production
|
||||||
|
|
||||||
|
COMPOSE_FILE="compose.yml"
|
||||||
|
COMPOSE_FILE="$COMPOSE_FILE:compose.mariadb.yml"
|
||||||
|
#COMPOSE_FILE="$COMPOSE_FILE:compose.postgres.yml"
|
||||||
|
|
||||||
ADMIN_USER=admin
|
ADMIN_USER=admin
|
||||||
|
|
||||||
SECRET_DB_ROOT_PASSWORD_VERSION=v1
|
SECRET_DB_ROOT_PASSWORD_VERSION=v1
|
||||||
@ -12,3 +16,8 @@ SECRET_DB_PASSWORD_VERSION=v1
|
|||||||
SECRET_ADMIN_PASSWORD_VERSION=v1
|
SECRET_ADMIN_PASSWORD_VERSION=v1
|
||||||
|
|
||||||
EXTRA_VOLUME=/dev/null:/tmp/.dummy
|
EXTRA_VOLUME=/dev/null:/tmp/.dummy
|
||||||
|
|
||||||
|
# X_FRAME_OPTIONS_ENABLED=1
|
||||||
|
# X_FRAME_OPTIONS_ALLOW_FROM=embedding-site.example.org
|
||||||
|
# APPS="calendar sociallogin onlyoffice"
|
||||||
|
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/.envrc
|
/.envrc
|
||||||
|
|
||||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"shellcheck.customArgs": [
|
|
||||||
"--shell=bash"
|
|
||||||
]
|
|
||||||
}
|
|
24
README.md
24
README.md
@ -166,3 +166,27 @@ Here is an example CSS config which hides the local login and makes space for a
|
|||||||
[nextcloud-docker]: https://hub.docker.com/_/nextcloud/
|
[nextcloud-docker]: https://hub.docker.com/_/nextcloud/
|
||||||
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
||||||
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
||||||
|
|
||||||
|
## Using [`previewgenerator`](https://github.com/nextcloud/previewgenerator) app
|
||||||
|
|
||||||
|
> Beware, this appp has been known to not work...
|
||||||
|
|
||||||
|
After you install, enable etc. then you need to run the generation (**warning**: it can take a long time!):
|
||||||
|
|
||||||
|
```
|
||||||
|
abra app run <domain> app bash -u www-data
|
||||||
|
./occ preview:generate-all
|
||||||
|
```
|
||||||
|
|
||||||
|
To set up the cron to run again, there is [no clear solution in the context of
|
||||||
|
containers](https://github.com/nextcloud/previewgenerator/issues/1). So, a
|
||||||
|
pretty dodgy hack is to run it from the system directly:
|
||||||
|
|
||||||
|
```
|
||||||
|
root@foo.com /etc/cron.hourly $ cat foo-com-preview-generate
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker exec -u www-data $(docker ps -f name=foo_com_app -q) ./occ preview:pre-generate
|
||||||
|
```
|
||||||
|
|
||||||
|
This app will improve performance of image browsing at the cost of storage space.
|
||||||
|
19
abra.sh
19
abra.sh
@ -1,6 +1,7 @@
|
|||||||
export FPM_TUNE_VERSION=v4
|
export FPM_TUNE_VERSION=v4
|
||||||
export NGINX_CONF_VERSION=v2
|
export NGINX_CONF_VERSION=v4
|
||||||
export MY_CNF_VERSION=v4
|
export MY_CNF_VERSION=v4
|
||||||
|
export ENTRYPOINT_VERSION=v2
|
||||||
|
|
||||||
NC_APP_DIR="app:/var/www/html"
|
NC_APP_DIR="app:/var/www/html"
|
||||||
|
|
||||||
@ -12,6 +13,22 @@ sub_occ(){
|
|||||||
sub_app_run php /var/www/html/occ "$@"
|
sub_app_run php /var/www/html/occ "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_occ(){
|
||||||
|
su -p www-data -s /bin/sh -c "/var/www/html/occ $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_apps(){
|
||||||
|
install_apps="$@"
|
||||||
|
if [ -z "$install_apps" ]
|
||||||
|
then
|
||||||
|
install_apps=$APPS
|
||||||
|
fi
|
||||||
|
for app in $install_apps
|
||||||
|
do
|
||||||
|
run_occ "app:install $app"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
_backup_app() {
|
_backup_app() {
|
||||||
# Copied _abra_backup_dir to make UX better on restore and backup
|
# Copied _abra_backup_dir to make UX better on restore and backup
|
||||||
{
|
{
|
||||||
|
40
compose.mariadb.yml
Normal file
40
compose.mariadb.yml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
environment:
|
||||||
|
- MYSQL_HOST=db
|
||||||
|
- MYSQL_DATABASE=nextcloud
|
||||||
|
- MYSQL_USER=nextcloud
|
||||||
|
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: "mariadb:10.5"
|
||||||
|
environment:
|
||||||
|
- MYSQL_DATABASE=nextcloud
|
||||||
|
- MYSQL_USER=nextcloud
|
||||||
|
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
||||||
|
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
|
||||||
|
configs:
|
||||||
|
- source: my_tune
|
||||||
|
target: /etc/mysql/conf.d/my-tune.cnf
|
||||||
|
secrets:
|
||||||
|
- db_root_password
|
||||||
|
- db_password
|
||||||
|
volumes:
|
||||||
|
- "mariadb:/var/lib/mysql"
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
deploy:
|
||||||
|
labels:
|
||||||
|
backupbot.backup: "true"
|
||||||
|
backupbot.backup.pre-hook: 'mkdir -p /tmp/backup/ && mysqldump --single-transaction -u root -p"$$(cat /run/secrets/db_root_password)" nextcloud > /tmp/backup/backup.sql'
|
||||||
|
backupbot.backup.post-hook: "rm -rf /tmp/backup"
|
||||||
|
backupbot.backup.path: "/tmp/backup/"
|
||||||
|
configs:
|
||||||
|
my_tune:
|
||||||
|
name: ${STACK_NAME}_my_cnf_${MY_CNF_VERSION}
|
||||||
|
file: my-tune.cnf
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mariadb:
|
37
compose.postgres.yml
Normal file
37
compose.postgres.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
environment:
|
||||||
|
- POSTGRES_HOST=db
|
||||||
|
- POSTGRES_DB=nextcloud
|
||||||
|
- POSTGRES_USER=nextcloud
|
||||||
|
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
||||||
|
- NEXTCLOUD_UPDATE=1
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: "postgres:12"
|
||||||
|
volumes:
|
||||||
|
- "postgres:/var/lib/postgresql/data"
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: nextcloud
|
||||||
|
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
|
||||||
|
POSTGRES_DB: nextcloud
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
deploy:
|
||||||
|
labels:
|
||||||
|
backupbot.backup: "true"
|
||||||
|
backupbot.backup.pre-hook: "mkdir -p /tmp/backup/ && PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /tmp/backup/backup.sql"
|
||||||
|
backupbot.backup.post-hook: "rm -rf /tmp/backup"
|
||||||
|
backupbot.backup.path: "/tmp/backup/"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres:
|
52
compose.yml
52
compose.yml
@ -1,11 +1,13 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: nginx:1.20.0
|
image: nginx:1.22.1
|
||||||
configs:
|
configs:
|
||||||
- source: nginx_conf
|
- source: nginx_conf
|
||||||
target: /etc/nginx/nginx.conf
|
target: /etc/nginx/nginx.conf
|
||||||
environment:
|
environment:
|
||||||
|
- X_FRAME_OPTIONS_ALLOW_FROM
|
||||||
|
- X_FRAME_OPTIONS_ENABLED
|
||||||
- DOMAIN
|
- DOMAIN
|
||||||
- STACK_NAME
|
- STACK_NAME
|
||||||
volumes:
|
volumes:
|
||||||
@ -33,22 +35,25 @@ services:
|
|||||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud:23.0.1-fpm
|
image: nextcloud:25.0.1-fpm
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
configs:
|
configs:
|
||||||
- source: fpm_tune
|
- source: fpm_tune
|
||||||
target: /usr/local/etc/php-fpm.d/fpm-tune.conf
|
target: /usr/local/etc/php-fpm.d/fpm-tune.conf
|
||||||
|
- source: entrypoint
|
||||||
|
target: /custom-entrypoint.sh
|
||||||
|
mode: 555
|
||||||
|
entrypoint: /custom-entrypoint.sh
|
||||||
secrets:
|
secrets:
|
||||||
- db_password
|
- db_password
|
||||||
- admin_password
|
- admin_password
|
||||||
environment:
|
environment:
|
||||||
|
- APPS
|
||||||
|
- X_FRAME_OPTIONS_ALLOW_FROM
|
||||||
|
- X_FRAME_OPTIONS_ENABLED
|
||||||
- DOMAIN
|
- DOMAIN
|
||||||
- STACK_NAME
|
- STACK_NAME
|
||||||
- MYSQL_HOST=db
|
|
||||||
- MYSQL_DATABASE=nextcloud
|
|
||||||
- MYSQL_USER=nextcloud
|
|
||||||
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
|
||||||
- NEXTCLOUD_ADMIN_USER=${ADMIN_USER}
|
- NEXTCLOUD_ADMIN_USER=${ADMIN_USER}
|
||||||
- NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/admin_password
|
- NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/admin_password
|
||||||
- NEXTCLOUD_TRUSTED_DOMAINS=${DOMAIN}
|
- NEXTCLOUD_TRUSTED_DOMAINS=${DOMAIN}
|
||||||
@ -73,28 +78,12 @@ services:
|
|||||||
failure_action: rollback
|
failure_action: rollback
|
||||||
order: start-first
|
order: start-first
|
||||||
labels:
|
labels:
|
||||||
- "coop-cloud.${STACK_NAME}.version=1.0.0+23.0.1-fpm"
|
- "coop-cloud.${STACK_NAME}.version=2.1.6+25.0.1-fpm"
|
||||||
|
- "backupbot.backup=true"
|
||||||
db:
|
- "backupbot.backup.path=/var/www/html/config/,/var/www/html/data/,/var/www/html/custom_apps/"
|
||||||
image: "mariadb:10.5"
|
|
||||||
environment:
|
|
||||||
- MYSQL_DATABASE=nextcloud
|
|
||||||
- MYSQL_USER=nextcloud
|
|
||||||
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
|
||||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
|
|
||||||
configs:
|
|
||||||
- source: my_tune
|
|
||||||
target: /etc/mysql/conf.d/my-tune.cnf
|
|
||||||
secrets:
|
|
||||||
- db_root_password
|
|
||||||
- db_password
|
|
||||||
volumes:
|
|
||||||
- "mariadb:/var/lib/mysql"
|
|
||||||
networks:
|
|
||||||
- internal
|
|
||||||
|
|
||||||
cron:
|
cron:
|
||||||
image: nextcloud:23.0.1-fpm
|
image: nextcloud:25.0.1-fpm
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html/
|
- nextcloud:/var/www/html/
|
||||||
- nextapps:/var/www/html/custom_apps:cached
|
- nextapps:/var/www/html/custom_apps:cached
|
||||||
@ -106,7 +95,7 @@ services:
|
|||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
image: redis:6.2.5-alpine
|
image: redis:7.0.5-alpine
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
volumes:
|
volumes:
|
||||||
@ -128,9 +117,9 @@ volumes:
|
|||||||
nextapps:
|
nextapps:
|
||||||
nextdata:
|
nextdata:
|
||||||
nextconfig:
|
nextconfig:
|
||||||
mariadb:
|
|
||||||
redis:
|
redis:
|
||||||
|
|
||||||
|
|
||||||
configs:
|
configs:
|
||||||
nginx_conf:
|
nginx_conf:
|
||||||
name: ${STACK_NAME}_nginx_${NGINX_CONF_VERSION}
|
name: ${STACK_NAME}_nginx_${NGINX_CONF_VERSION}
|
||||||
@ -139,9 +128,10 @@ configs:
|
|||||||
fpm_tune:
|
fpm_tune:
|
||||||
name: ${STACK_NAME}_fpm_tune_${FPM_TUNE_VERSION}
|
name: ${STACK_NAME}_fpm_tune_${FPM_TUNE_VERSION}
|
||||||
file: fpm-tune.ini
|
file: fpm-tune.ini
|
||||||
my_tune:
|
entrypoint:
|
||||||
name: ${STACK_NAME}_my_cnf_${MY_CNF_VERSION}
|
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
|
||||||
file: my-tune.cnf
|
file: entrypoint.sh.tmpl
|
||||||
|
template_driver: golang
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
proxy:
|
proxy:
|
||||||
|
12
entrypoint.sh.tmpl
Normal file
12
entrypoint.sh.tmpl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Giving the db container some time to come up"; sleep 20
|
||||||
|
# see this issue with postgres db https://github.com/nextcloud/docker/issues/1204
|
||||||
|
|
||||||
|
{{ if eq (env "X_FRAME_OPTIONS_ENABLED") "1" }}
|
||||||
|
if ! [[ $(grep {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }} lib/public/AppFramework/Http/ContentSecurityPolicy.php) ]]; then
|
||||||
|
sed -i "91 a\\\t\t'{{ env "X_FRAME_OPTIONS_ALLOW_FROM" }}', " lib/public/AppFramework/Http/ContentSecurityPolicy.php
|
||||||
|
fi
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
/entrypoint.sh php-fpm
|
@ -41,6 +41,7 @@ http {
|
|||||||
# could take several months.
|
# could take several months.
|
||||||
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
|
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
|
||||||
|
|
||||||
|
|
||||||
# set max upload size
|
# set max upload size
|
||||||
client_max_body_size 512M;
|
client_max_body_size 512M;
|
||||||
fastcgi_buffers 64 4K;
|
fastcgi_buffers 64 4K;
|
||||||
@ -61,11 +62,17 @@ http {
|
|||||||
add_header Referrer-Policy "no-referrer" always;
|
add_header Referrer-Policy "no-referrer" always;
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
add_header X-Download-Options "noopen" always;
|
add_header X-Download-Options "noopen" always;
|
||||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
||||||
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
||||||
add_header X-Robots-Tag "none" always;
|
add_header X-Robots-Tag "none" always;
|
||||||
add_header X-XSS-Protection "1; mode=block" always;
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
|
||||||
|
{{ if eq (env "X_FRAME_OPTIONS_ENABLED") "1" }}
|
||||||
|
add_header Content-Security-Policy "frame-ancestors {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }} {{ env "DOMAIN" }}";
|
||||||
|
{{ else }}
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
# Remove X-Powered-By, which is an information leak
|
# Remove X-Powered-By, which is an information leak
|
||||||
fastcgi_hide_header X-Powered-By;
|
fastcgi_hide_header X-Powered-By;
|
||||||
|
|
||||||
|
6
releases/2.0.0+23.0.3-fpm
Normal file
6
releases/2.0.0+23.0.3-fpm
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
2.0.0 introduces a minor nextcloud update to 23.0.4 and moves the database service to a seperate override.yml file to support different database types (mariadb / postgres). This might break your installation. Please add the following snippet to your config .env to ensure the right db is used:
|
||||||
|
|
||||||
|
```
|
||||||
|
COMPOSE_FILE="compose.yml"
|
||||||
|
COMPOSE_FILE="$COMPOSE_FILE:compose.mariadb.yml"
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user