aboutsummaryrefslogtreecommitdiffstats
path: root/community/nextcloud
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-06-22 20:07:36 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-06-22 21:39:02 +0200
commitcfba4b94512beb995453a6e4194203a6a268828d (patch)
treed83942178f099fb6119f025a4a617201cf0a5596 /community/nextcloud
parentfe766f7e20814be5141035aeecf9ba7a70eb7cd4 (diff)
downloadaports-cfba4b94512beb995453a6e4194203a6a268828d.tar.bz2
aports-cfba4b94512beb995453a6e4194203a6a268828d.tar.xz
community/nextcloud: add subpkg -initscript
Diffstat (limited to 'community/nextcloud')
-rw-r--r--community/nextcloud/APKBUILD28
-rw-r--r--community/nextcloud/fpm-pool.conf183
-rw-r--r--community/nextcloud/nextcloud-initscript.post-install26
-rw-r--r--community/nextcloud/nextcloud-initscript.pre-install6
-rw-r--r--community/nextcloud/nextcloud.confd5
5 files changed, 245 insertions, 3 deletions
diff --git a/community/nextcloud/APKBUILD b/community/nextcloud/APKBUILD
index 73c138425a..a3352e3e82 100644
--- a/community/nextcloud/APKBUILD
+++ b/community/nextcloud/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=nextcloud
pkgver=12.0.0
-pkgrel=0
+pkgrel=1
pkgdesc="A safe home for all your data"
url="http://nextcloud.com"
arch="noarch"
@@ -14,7 +14,7 @@ depends="$_php $_php-ctype $_php-curl $_php-dom $_php-gd $_php-fileinfo
"
makedepends="$depends_dev"
options="!check"
-subpackages="$pkgname-doc $pkgname-activity $pkgname-encryption
+subpackages="$pkgname-doc $pkgname-initscript $pkgname-activity $pkgname-encryption
$pkgname-firstrunwizard $pkgname-gallery $pkgname-ldap
$pkgname-logreader $pkgname-mysql $pkgname-notifications
$pkgname-password_policy $pkgname-pdfviewer $pkgname-pgsql
@@ -24,7 +24,10 @@ subpackages="$pkgname-doc $pkgname-activity $pkgname-encryption
source="https://download.nextcloud.com/server/releases/$pkgname-$pkgver.zip
nextcloud10-dont-chmod-config.patch
nextcloud.logrotate
+ $pkgname.confd
+ fpm-pool.conf
"
+pkgusers="nextcloud"
pkggroups="www-data"
builddir="$srcdir"/$pkgname
@@ -69,6 +72,23 @@ doc() {
"$subpkgdir"/usr/share/doc/nextcloud/core
}
+initscript() {
+ pkgdesc="Init script that runs Nextcloud with php-fpm"
+ depends="$pkgname $_php-fpm $_php-opcache"
+ install="$subpkgname.pre-install $subpkgname.post-install"
+
+ local confdir="$subpkgdir/etc/$_php/php-fpm.d"
+ local fpm_name="php-fpm${_php#php}"
+
+ install -m 644 -D "$srcdir"/fpm-pool.conf "$confdir"/$pkgname.conf
+ install -m 644 -D "$srcdir"/$pkgname.confd "$subpkgdir"/etc/conf.d/$pkgname
+
+ mkdir -p "$subpkgdir"/etc/init.d
+ ln -s $fpm_name "$subpkgdir"/etc/init.d/$pkgname
+
+ install -m 700 -o nextcloud -d "$subpkgdir"/var/tmp/$pkgname
+}
+
pgsql() {
pkgdesc="Nextcloud PostgreSQL support"
depends="$pkgname $_php-pgsql $_php-pdo_pgsql"
@@ -168,4 +188,6 @@ videoplayer() {
sha512sums="0e409eedbcc0f4e1652085c3e384db373858b0cc116c70361a4d066a08afbd6e75792332f95d08773cbed78c1520532886268249d514f2da70acb3ba120420d5 nextcloud-12.0.0.zip
a12a73a38bc009d3307ce97bb32fc62ac93e125a77a3d36b31c9d2212953fa17bd5c31f819e0759a0645b1c285817b067143b0b9c3673ce4ab3043fae426a67c nextcloud10-dont-chmod-config.patch
-80b94b04507502fa80f3473e4ce8041c2e1f832da8a44408f2f1beda4319dddfc55c9e79d80e8e5a5bfecb770820109870f888d2a3eed9ab5981abcd89f0a812 nextcloud.logrotate"
+80b94b04507502fa80f3473e4ce8041c2e1f832da8a44408f2f1beda4319dddfc55c9e79d80e8e5a5bfecb770820109870f888d2a3eed9ab5981abcd89f0a812 nextcloud.logrotate
+35cf156839215113b5d8fb8842b4c1e19a50be3c16be7048879fdd808674e4875dbacf3e2dd884fd182258595b7a137d7d3c2dc602a7ff5613c8b65fae0abe67 nextcloud.confd
+b5cdccdffb35e868ec1acb15ec2849cc1c2a00f6064ad21eb591b9694e84df4576f03248f5e814000a48c38096a2a1588dfc79be66691415f2f4ef3b4105d032 fpm-pool.conf"
diff --git a/community/nextcloud/fpm-pool.conf b/community/nextcloud/fpm-pool.conf
new file mode 100644
index 0000000000..14a25155ad
--- /dev/null
+++ b/community/nextcloud/fpm-pool.conf
@@ -0,0 +1,183 @@
+[global]
+; Error log file
+; Default Value: log/php-fpm.log
+error_log = /var/log/nextcloud/php-fpm.log
+
+; Log level
+; Possible Values: alert, error, warning, notice, debug
+; Default Value: notice
+log_level = warning
+
+; If this number of child processes exit with SIGSEGV or SIGBUS within the time
+; interval set by emergency_restart_interval then FPM will restart. A value
+; of '0' means 'Off'.
+; Default Value: 0
+emergency_restart_threshold = 10
+
+; Interval of time used by emergency_restart_interval to determine when
+; a graceful restart will be initiated. This can be useful to work around
+; accidental corruptions in an accelerator's shared memory.
+; Available Units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+emergency_restart_interval = 1m
+
+; Time limit for child processes to wait for a reaction on signals from master.
+; Available units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+process_control_timeout = 10s
+
+
+[nextcloud]
+; The address on which to accept FastCGI requests.
+; Valid syntaxes are:
+; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
+; a specific port;
+; 'port' - to listen on a TCP socket to all addresses on a
+; specific port;
+; '/path/to/unix/socket' - to listen on a unix socket (the path is *not*
+; relative to chroot!)
+; Note: This value is mandatory.
+listen = /run/nextcloud/fastcgi.sock
+
+; Set permissions for unix socket, if one is used. In Linux, read/write
+; permissions must be set in order to allow connections from a web server. Many
+; BSD-derived systems allow connections regardless of permissions.
+; Default Values: user and group are set as the running user
+; mode is set to 0666
+listen.mode = 0660
+
+; Choose how the process manager will control the number of child processes.
+; Possible Values:
+; static ... a fixed number of child processes.
+; dynamic ... the number of child processes are set dynamically.
+; ondemand ... no children are created at startup; children will be forked
+; when new requests will connect.
+; Note: This value is mandatory.
+pm = ondemand
+
+; The number of child processes to be created when pm is set to 'static' and the
+; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
+; This value sets the limit on the number of simultaneous requests that will be
+; served.
+; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
+; Note: This value is mandatory.
+pm.max_children = 10
+
+; The number of seconds after which an idle process will be killed.
+; Note: Used only when pm is set to 'ondemand'
+; Default Value: 10s
+pm.process_idle_timeout = 120s
+
+; The number of requests each child process should execute before respawning.
+; This can be useful to work around memory leaks in 3rd party libraries. For
+; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
+; Default Value: 0
+pm.max_requests = 500
+
+; The URI to view the FPM status page. If this value is not set, no URI will be
+; recognized as a status page.
+; Note: The value must start with a leading slash (/). The value can be
+; anything, but it may not be a good idea to use the .php extension or it
+; may conflict with a real PHP file.
+; Default Value: not set
+pm.status_path =
+
+; The ping URI to call the monitoring page of FPM. If this value is not set, no
+; URI will be recognized as a ping page. This could be used to test from outside
+; that FPM is alive and responding, or to
+; - create a graph of FPM availability (rrd or such);
+; - remove a server from a group if it is not responding (load balancing);
+; - trigger alerts for the operating team (24/7).
+; Note: The value must start with a leading slash (/). The value can be
+; anything, but it may not be a good idea to use the .php extension or it
+; may conflict with a real PHP file.
+; Default Value: not set
+ping.path = /ping
+
+; The timeout for serving a single request after which the worker process will
+; be killed. This option should be used when the 'max_execution_time' ini option
+; does not stop script execution for some reason. A value of '0' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_terminate_timeout = 0
+
+; The timeout for serving a single request after which a PHP backtrace will be
+; dumped to the 'slowlog' file. A value of '0s' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_slowlog_timeout = 0
+
+; The log file for slow requests
+; Default Value: not set
+; Note: slowlog is mandatory if request_slowlog_timeout is set
+; Note: the path is *not* relative to chroot.
+;slowlog = /var/log/nextcloud/php-fpm.slow.log
+
+; Redirect worker stdout and stderr into main error log. If not set, stdout and
+; stderr will be redirected to /dev/null according to FastCGI specs.
+; Note: on highloaded environement, this can cause some delay in the page
+; process time (several ms).
+; Default Value: no
+;catch_workers_output = yes
+
+; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
+; the current environment.
+; Default Value: clean env
+env[PATH] = /usr/bin:/bin
+
+; Additional php.ini defines, specific to this pool of workers. These settings
+; overwrite the values previously defined in the php.ini. The directives are the
+; same as the PHP SAPI:
+; php_value/php_flag - you can set classic ini defines which can
+; be overwritten from PHP call 'ini_set'.
+; php_admin_value/php_admin_flag - these directives won't be overwritten by
+; PHP call 'ini_set'
+; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
+;
+; Defining 'extension' will load the corresponding shared extension from
+; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
+; overwrite previously defined php.ini values, but will append the new value
+; instead.
+;
+; Note: path INI options can be relative and will be expanded with the prefix
+; (pool, global or /usr/lib/php7.x)
+
+; Allow HTTP file uploads.
+php_admin_flag[file_uploads] = true
+
+; Maximal size of a file that can be uploaded via web interface.
+php_admin_value[memory_limit] = 512M
+php_admin_value[post_max_size] = 513M
+php_admin_value[upload_max_filesize] = 513M
+
+; Where to store temporary files.
+php_admin_value[session.save_path] = /var/tmp/nextcloud
+php_admin_value[sys_temp_dir] = /var/tmp/nextcloud
+php_admin_value[upload_tmp_dir] = /var/tmp/nextcloud
+
+; Log errors to specified file.
+php_admin_value[error_log] = /var/log/nextcloud/php.error.log
+
+; OPcache error_log file name. Empty string assumes "stderr"
+php_admin_value[opcache.error_log] = /var/log/nextcloud/php.error.log
+
+; Output buffering is a mechanism for controlling how much output data
+; (excluding headers and cookies) PHP should keep internally before pushing that
+; data to the client. If your application's output exceeds this setting, PHP
+; will send that data in chunks of roughly the size you specify.
+; This must be disabled for ownCloud.
+php_admin_flag[output_buffering] = false
+
+; Overload(replace) single byte functions by mbstring functions.
+; This must be disabled for ownCloud.
+php_admin_flag[mbstring.func_overload] = false
+
+; Never populate the $HTTP_RAW_POST_DATA variable.
+; http://php.net/always-populate-raw-post-data
+php_admin_value[always_populate_raw_post_data] = -1
+
+; Disable certain functions for security reasons.
+; http://php.net/disable-functions
+php_admin_value[disable_functions] = exec,passthru,shell_exec,system,proc_open,curl_multi_exec,show_source
diff --git a/community/nextcloud/nextcloud-initscript.post-install b/community/nextcloud/nextcloud-initscript.post-install
new file mode 100644
index 0000000000..6d664a5026
--- /dev/null
+++ b/community/nextcloud/nextcloud-initscript.post-install
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# It's not needed to be writable for www-data group when running with php-fpm.
+for dir in /etc/nextcloud \
+ /etc/nextcloud/config.php \
+ /var/lib/nextcloud/data \
+ /usr/share/webapps/nextcloud/apps
+do
+ chmod g-w $dir
+ chown nextcloud $dir
+done
+chgrp root /etc/nextcloud/config.php
+
+# This must be writable (only) by nextcloud user.
+chown nextcloud /var/log/nextcloud
+chmod 750 /var/log/nextcloud
+
+cat <<EOF
+*
+* Point your web server to /run/nextcloud/fastcgi.sock and start Nextcloud with
+* /etc/init.d/nextcloud start. You can modify php-fpm settings in
+* /etc/php7/fpm.d/nextcloud.conf.
+*
+EOF
+
+exit 0
diff --git a/community/nextcloud/nextcloud-initscript.pre-install b/community/nextcloud/nextcloud-initscript.pre-install
new file mode 100644
index 0000000000..e9cf53919c
--- /dev/null
+++ b/community/nextcloud/nextcloud-initscript.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S -g 82 www-data 2>/dev/null
+adduser -S -D -H -h /var/lib/nextcloud -s /sbin/nologin -G www-data -g Nextcloud nextcloud 2>/dev/null
+
+exit 0
diff --git a/community/nextcloud/nextcloud.confd b/community/nextcloud/nextcloud.confd
new file mode 100644
index 0000000000..aae73dc2f3
--- /dev/null
+++ b/community/nextcloud/nextcloud.confd
@@ -0,0 +1,5 @@
+# Config file for /etc/init.d/nextcloud
+
+name="Nextcloud"
+user="nextcloud"
+group="www-data"