Add file 'README.install-notify_push'.
This commit is contained in:
		
							
								
								
									
										145
									
								
								README.install-notify_push
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								README.install-notify_push
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,145 @@ | |||||||
|  | #!/usr/bin/env bash | ||||||
|  |  | ||||||
|  | # --- | ||||||
|  | # Nextcloud High Performance Backend für Dateien (notify_push) einrichten | ||||||
|  | # --- | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # see: | ||||||
|  | #     https://github.com/nextcloud/notify_push | ||||||
|  | #     https://apfelcast.com/nextcloud-high-performance-backend-fuer-dateien-einrichten-schritt-fuer-schritt-anleitung/ | ||||||
|  | #     https://www.youtube.com/watch?v=jMCI7hFAU1Y | ||||||
|  |  | ||||||
|  | HTTP_USER="www-data" | ||||||
|  |  | ||||||
|  | PHP_BIN="/usr/local/php/bin/php" | ||||||
|  |  | ||||||
|  | PHP_VERSION=8.3 | ||||||
|  |  | ||||||
|  | # 0   Requirements | ||||||
|  | # ================ | ||||||
|  | # | ||||||
|  | #     - Nextcloud auf LAMP/LEMP Stack | ||||||
|  | #       LAMP - (Linux Apache MySQL PHP) | ||||||
|  | #       LEMP - (Linux Nginx MySQL PHP) | ||||||
|  | # | ||||||
|  | #     - Redis Memory Caching Service | ||||||
|  |  | ||||||
|  | WEBSITE="cloud-test.oopen.de" | ||||||
|  | WEBSITE="cloud-02-test.oopen.de" | ||||||
|  | WEBSITE="cloud-01.oopen.de" | ||||||
|  |  | ||||||
|  | WEB_BASE_DIR="/var/www/${WEBSITE}" | ||||||
|  | NC_INSTALL_DIR="${WEB_BASE_DIR}/nextcloud" | ||||||
|  |  | ||||||
|  | IPv4="$(dig +short "${WEBSITE}" A)" | ||||||
|  | IPv6="$(dig +short "${WEBSITE}" AAAA)" | ||||||
|  |  | ||||||
|  | # 1   Install NC App 'Client Push" | ||||||
|  | # ================================ | ||||||
|  | # | ||||||
|  | #     Instead of using the 'occ' command, the 'Client Push' APP  | ||||||
|  | #     can also be installed via the Nextcloud web interface (Nextcloud Appstore). | ||||||
|  | # | ||||||
|  | sudo -u ${HTTP_USER} ${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ app:install notify_push | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # 2   Configure ReversProxy  | ||||||
|  | # ========================= | ||||||
|  | # | ||||||
|  |  | ||||||
|  | # 2a  Apache | ||||||
|  | # | ||||||
|  | a2enmod proxy | ||||||
|  | a2enmod proxy_http | ||||||
|  | a2enmod proxy_wstunnel | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # Add to your apache2 vhost configuration | ||||||
|  | # | ||||||
|  | #   ProxyPass /push/ws ws://127.0.0.1:7867/ws | ||||||
|  | #   ProxyPass /push/ http://127.0.0.1:7867/ | ||||||
|  | #   ProxyPassReverse /push/ http://127.0.0.1:7867/ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # restart apache2 | ||||||
|  | # | ||||||
|  | systemctl restart apache2 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # 2b  Nginx | ||||||
|  |  | ||||||
|  | # Add to your nginx vhost configuration | ||||||
|  | # | ||||||
|  | #   location ^~ /push/ { | ||||||
|  | #      proxy_pass http://127.0.0.1:7867/; | ||||||
|  | #      proxy_http_version 1.1; | ||||||
|  | #      proxy_set_header Upgrade $http_upgrade; | ||||||
|  | #      proxy_set_header Connection "Upgrade"; | ||||||
|  | #      proxy_set_header Host $host; | ||||||
|  | #      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||||||
|  | #   } | ||||||
|  |  | ||||||
|  | # reload nginx | ||||||
|  | # | ||||||
|  | nginx -s reload | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # 3   Configure NC - add truzsted proxy (IPv4 AND if exists IPv6 address to trusted proxies) | ||||||
|  | # ========================================================================================== | ||||||
|  | # | ||||||
|  | #     'trusted_proxies' => | ||||||
|  | #     array ( | ||||||
|  | #        0 => '${IPv4}', | ||||||
|  | #        1 => '${IPv6}', | ||||||
|  | #     ) | ||||||
|  | _parameter="trusted_proxies" | ||||||
|  | _type="string" | ||||||
|  | _value="${IPv4}" | ||||||
|  | sudo -u ${HTTP_USER} ${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ config:system:set ${_parameter} 0 \ | ||||||
|  |    --value="${_value}" --type="${_type}" | ||||||
|  |  | ||||||
|  | _value="${IPv6}" | ||||||
|  | sudo -u ${HTTP_USER} ${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ config:system:set ${_parameter} 1 \ | ||||||
|  |    --value="${_value}" --type="${_type}" | ||||||
|  |  | ||||||
|  | systemctl restart php-${PHP_VERSION}-fpm | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # 4   Create Service 'notify_push' | ||||||
|  | # ================================ | ||||||
|  | # | ||||||
|  | cat <<EOF > /etc/systemd/system/notify_push.service | ||||||
|  | [Unit] | ||||||
|  | Description = Push daemon for Nextcloud clients | ||||||
|  | Documentation=https://github.com/nextcloud/notify_push | ||||||
|  |  | ||||||
|  | [Service] | ||||||
|  | # Change if you already have something running on this port | ||||||
|  | Environment=PORT=7867 | ||||||
|  | Environment=NEXTCLOUD_URL=https://${WEBSITE} | ||||||
|  | ExecStart=${NC_INSTALL_DIR}/apps/notify_push/bin/x86_64/notify_push ${NC_INSTALL_DIR}/config/config.php | ||||||
|  | # requires the push server to have been build with the systemd feature (enabled by default) | ||||||
|  | Type=notify | ||||||
|  | User=${HTTP_USER} | ||||||
|  | Restart=always | ||||||
|  | RestartSec=60 | ||||||
|  |  | ||||||
|  | [Install] | ||||||
|  | WantedBy = multi-user.target | ||||||
|  | EOF | ||||||
|  |  | ||||||
|  | # enable service at boot time | ||||||
|  | # | ||||||
|  | systemctl daemon-reload | ||||||
|  | systemctl enable --now notify_push | ||||||
|  | systemctl start notify_push | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # 5.  Testing and final Nextcloud configuration | ||||||
|  | # ============================================= | ||||||
|  | # | ||||||
|  | sudo -u ${HTTP_USER} ${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ notify_push:setup | ||||||
|  |  | ||||||
|  |  | ||||||
|  | systemctl restart php-8.3-fpm.service | ||||||
		Reference in New Issue
	
	Block a user