forked from coop-cloud/nextcloud
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			auto_app_i
			...
			auto_confi
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 5ee0547315 | 
@ -1,6 +1,6 @@
 | 
			
		||||
TYPE=nextcloud
 | 
			
		||||
 | 
			
		||||
DOMAIN={{ .Domain }}
 | 
			
		||||
DOMAIN=nextcloud.example.com
 | 
			
		||||
## Domain aliases
 | 
			
		||||
#EXTRA_DOMAINS=', `www.nextcloud.example.com`'
 | 
			
		||||
LETS_ENCRYPT_ENV=production
 | 
			
		||||
@ -16,8 +16,3 @@ SECRET_DB_PASSWORD_VERSION=v1
 | 
			
		||||
SECRET_ADMIN_PASSWORD_VERSION=v1
 | 
			
		||||
 | 
			
		||||
EXTRA_VOLUME=/dev/null:/tmp/.dummy
 | 
			
		||||
 | 
			
		||||
# X_FRAME_OPTIONS_ENABLED=1
 | 
			
		||||
# X_FRAME_OPTIONS_ALLOW_FROM=embedding-site.example.org
 | 
			
		||||
# APPS="calendar sociallogin onlyoffice"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										24
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								README.md
									
									
									
									
									
								
							@ -166,27 +166,3 @@ Here is an example CSS config which hides the local login and makes space for a
 | 
			
		||||
[nextcloud-docker]: https://hub.docker.com/_/nextcloud/
 | 
			
		||||
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
 | 
			
		||||
[`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,7 +1,6 @@
 | 
			
		||||
export FPM_TUNE_VERSION=v4
 | 
			
		||||
export NGINX_CONF_VERSION=v4
 | 
			
		||||
export NGINX_CONF_VERSION=v2
 | 
			
		||||
export MY_CNF_VERSION=v4
 | 
			
		||||
export ENTRYPOINT_VERSION=v2
 | 
			
		||||
 | 
			
		||||
NC_APP_DIR="app:/var/www/html"
 | 
			
		||||
 | 
			
		||||
@ -13,22 +12,6 @@ sub_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() {
 | 
			
		||||
  # Copied _abra_backup_dir to make UX better on restore and backup
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
@ -2,6 +2,7 @@ version: '3.8'
 | 
			
		||||
 | 
			
		||||
services:
 | 
			
		||||
  app:
 | 
			
		||||
    entrypoint: "sh -c 'sleep 10 && /entrypoint.sh php-fpm'" # tries to mitigate this error with postgres https://github.com/nextcloud/docker/issues/1204
 | 
			
		||||
    environment:
 | 
			
		||||
      - POSTGRES_HOST=db
 | 
			
		||||
      - POSTGRES_DB=nextcloud
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										25
									
								
								compose.yml
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								compose.yml
									
									
									
									
									
								
							@ -1,13 +1,11 @@
 | 
			
		||||
version: "3.8"
 | 
			
		||||
services:
 | 
			
		||||
  web:
 | 
			
		||||
    image: nginx:1.23.1
 | 
			
		||||
    image: nginx:1.21.6
 | 
			
		||||
    configs:
 | 
			
		||||
      - source: nginx_conf
 | 
			
		||||
        target: /etc/nginx/nginx.conf
 | 
			
		||||
    environment:
 | 
			
		||||
      - X_FRAME_OPTIONS_ALLOW_FROM
 | 
			
		||||
      - X_FRAME_OPTIONS_ENABLED
 | 
			
		||||
      - DOMAIN
 | 
			
		||||
      - STACK_NAME
 | 
			
		||||
    volumes:
 | 
			
		||||
@ -35,23 +33,16 @@ services:
 | 
			
		||||
        - "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
 | 
			
		||||
 | 
			
		||||
  app:
 | 
			
		||||
    image: nextcloud:24.0.6-fpm
 | 
			
		||||
    image: nextcloud:24.0.0-fpm
 | 
			
		||||
    depends_on:
 | 
			
		||||
      - db
 | 
			
		||||
    configs:
 | 
			
		||||
      - source: fpm_tune
 | 
			
		||||
        target: /usr/local/etc/php-fpm.d/fpm-tune.conf
 | 
			
		||||
      - source: entrypoint
 | 
			
		||||
        target: /custom-entrypoint.sh
 | 
			
		||||
        mode: 555
 | 
			
		||||
    entrypoint: /custom-entrypoint.sh
 | 
			
		||||
    secrets:
 | 
			
		||||
      - db_password
 | 
			
		||||
      - admin_password
 | 
			
		||||
    environment:
 | 
			
		||||
      - APPS
 | 
			
		||||
      - X_FRAME_OPTIONS_ALLOW_FROM
 | 
			
		||||
      - X_FRAME_OPTIONS_ENABLED
 | 
			
		||||
      - DOMAIN
 | 
			
		||||
      - STACK_NAME
 | 
			
		||||
      - NEXTCLOUD_ADMIN_USER=${ADMIN_USER}
 | 
			
		||||
@ -78,12 +69,13 @@ services:
 | 
			
		||||
        failure_action: rollback
 | 
			
		||||
        order: start-first
 | 
			
		||||
      labels:
 | 
			
		||||
        - "coop-cloud.${STACK_NAME}.version=2.1.4+24.0.6-fpm"
 | 
			
		||||
        - "coop-cloud.${STACK_NAME}.version=2.1.0+24.0.0-fpm"
 | 
			
		||||
        - "backupbot.backup=true"
 | 
			
		||||
        - "backupbot.backup.path=/var/www/html/config/,/var/www/html/data/,/var/www/html/custom_apps/"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  cron:
 | 
			
		||||
    image: nextcloud:24.0.6-fpm
 | 
			
		||||
    image: nextcloud:24.0.0-fpm
 | 
			
		||||
    volumes:
 | 
			
		||||
      - nextcloud:/var/www/html/
 | 
			
		||||
      - nextapps:/var/www/html/custom_apps:cached
 | 
			
		||||
@ -95,7 +87,7 @@ services:
 | 
			
		||||
    entrypoint: /cron.sh
 | 
			
		||||
 | 
			
		||||
  cache:
 | 
			
		||||
    image: redis:7.0.5-alpine
 | 
			
		||||
    image: redis:7.0.0-alpine
 | 
			
		||||
    networks:
 | 
			
		||||
      - internal
 | 
			
		||||
    volumes:
 | 
			
		||||
@ -119,7 +111,6 @@ volumes:
 | 
			
		||||
  nextconfig:
 | 
			
		||||
  redis:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
configs:
 | 
			
		||||
  nginx_conf:
 | 
			
		||||
    name: ${STACK_NAME}_nginx_${NGINX_CONF_VERSION}
 | 
			
		||||
@ -128,10 +119,6 @@ configs:
 | 
			
		||||
  fpm_tune:
 | 
			
		||||
    name: ${STACK_NAME}_fpm_tune_${FPM_TUNE_VERSION}
 | 
			
		||||
    file: fpm-tune.ini
 | 
			
		||||
  entrypoint:
 | 
			
		||||
    name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
 | 
			
		||||
    file: entrypoint.sh.tmpl
 | 
			
		||||
    template_driver: golang
 | 
			
		||||
 | 
			
		||||
networks:
 | 
			
		||||
  proxy:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										55
									
								
								configure_nextcloud.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										55
									
								
								configure_nextcloud.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,55 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
set -eu
 | 
			
		||||
 | 
			
		||||
app_name=$1
 | 
			
		||||
domain=$2
 | 
			
		||||
secret=$3
 | 
			
		||||
 | 
			
		||||
sub_occ(){
 | 
			
		||||
abra app run --user www-data $app_name app /var/www/html/occ "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Install apps
 | 
			
		||||
sub_occ app:install calendar || true
 | 
			
		||||
sub_occ app:install sociallogin || true
 | 
			
		||||
sub_occ app:install onlyoffice || true
 | 
			
		||||
 | 
			
		||||
# Disable Dashboard
 | 
			
		||||
sub_occ app:disable dashboard || true
 | 
			
		||||
 | 
			
		||||
# Configure SSO
 | 
			
		||||
 | 
			
		||||
sub_occ config:app:set sociallogin custom_providers --value="
 | 
			
		||||
{
 | 
			
		||||
  \"custom_oidc\": [
 | 
			
		||||
    {
 | 
			
		||||
      \"name\": \"authentik\",
 | 
			
		||||
      \"title\": \"Login\",
 | 
			
		||||
      \"authorizeUrl\": \"https://$domain/application/o/authorize/\",
 | 
			
		||||
      \"tokenUrl\": \"https://$domain/application/o/token/\",
 | 
			
		||||
      \"displayNameClaim\": \"preferred_username\",
 | 
			
		||||
      \"userInfoUrl\": \"https://$domain/application/o/userinfo/\",
 | 
			
		||||
      \"logoutUrl\": \"https://$domain/application/o/nextcloud/end-session/\",
 | 
			
		||||
      \"clientId\": \"nextcloud\",
 | 
			
		||||
      \"clientSecret\": \"$secret\",
 | 
			
		||||
      \"scope\": \"openid profile email nextcloud\",
 | 
			
		||||
      \"groupsClaim\": \"nextcloud_groups\",
 | 
			
		||||
      \"style\": \"openid\",
 | 
			
		||||
      \"defaultGroup\": \"\",
 | 
			
		||||
      \"groupMapping\": {
 | 
			
		||||
        \"admin\": \"admin\"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}"
 | 
			
		||||
 | 
			
		||||
sub_occ config:app:set sociallogin update_profile_on_login --value 1
 | 
			
		||||
sub_occ config:app:set sociallogin auto_create_groups --value 1
 | 
			
		||||
sub_occ config:app:set sociallogin hide_default_login --value 1
 | 
			
		||||
 | 
			
		||||
sub_occ config:system:set allow_user_to_change_display_name --value=false
 | 
			
		||||
sub_occ config:system:set lost_password_link --value=disabled
 | 
			
		||||
sub_occ config:system:set social_login_auto_redirect --value=true
 | 
			
		||||
 | 
			
		||||
abra app run --user www-data $app_name app cat config/config.php
 | 
			
		||||
@ -1,12 +0,0 @@
 | 
			
		||||
#!/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,7 +41,6 @@ http {
 | 
			
		||||
        # could take several months.
 | 
			
		||||
        #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        # set max upload size
 | 
			
		||||
        client_max_body_size 512M;
 | 
			
		||||
        fastcgi_buffers 64 4K;
 | 
			
		||||
@ -62,17 +61,11 @@ http {
 | 
			
		||||
        add_header Referrer-Policy                      "no-referrer"   always;
 | 
			
		||||
        add_header X-Content-Type-Options               "nosniff"       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-Robots-Tag                         "none"          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
 | 
			
		||||
        fastcgi_hide_header X-Powered-By;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user