summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorhashworks2020-03-24 20:18:42 +0100
committerhashworks2020-03-24 20:18:42 +0100
commitfc1562431d1a22a92e8c3e9dc85877ee8361bfb8 (patch)
tree07b56d258ed56fb5caf586bdf6b13f6f484e3c3d
parent6843d5e9b075bc73955a8907bdc084df798fec74 (diff)
downloadaur-fc1562431d1a22a92e8c3e9dc85877ee8361bfb8.tar.gz
Add systemd timers and php-fpm example config
-rw-r--r--.SRCINFO14
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD22
-rw-r--r--filebin-file-cron.service16
-rw-r--r--filebin-file-cron.timer9
-rw-r--r--filebin-php-fpm.conf23
-rw-r--r--filebin-user-cron.service15
-rw-r--r--filebin-user-cron.timer9
-rw-r--r--filebin.install24
9 files changed, 118 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f0264c135aa4..64757f615d24 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = filebin
pkgdesc = A pastebin service written in PHP
pkgver = 3.4.3
- pkgrel = 1
+ pkgrel = 2
url = https://wiki.server-speed.net/projects/filebin
install = filebin.install
arch = any
@@ -21,8 +21,18 @@ pkgbase = filebin
backup = etc/webapps/filebin/memcached.php
source = git+https://github.com/Bluewind/filebin.git
source = filebin-nginx.conf
+ source = filebin-php-fpm.conf
+ source = filebin-file-cron.service
+ source = filebin-file-cron.timer
+ source = filebin-user-cron.service
+ source = filebin-user-cron.timer
sha256sums = SKIP
- sha256sums = 5500d423d798478bf4f7bb0a147fe8a42b00e843513dd70665ec81f304a6c729
+ sha256sums = 6ed404a3fbc28c6ab35bf1eba67ddcf46cfd48893237155e38d297a13020180c
+ sha256sums = 034442098d1608807bec2a03028a7c8bb9ae9d286c378e2f668b4aca3cc9d4e1
+ sha256sums = 78dd850467d89ac3d1b57fa72fe9ce8d736ce29a89abe624d9c4d2e168e59d19
+ sha256sums = 116b1e5031c22ad251c486b18ff203813f7227197ef853927ddc2de00e85cbe1
+ sha256sums = 36c82c506a058edc50b882200332c6a540aa68a5749919eb62dc6c633c47deb3
+ sha256sums = d73e4b984ab95954bd18e08237c6aa8bec32ccc5699531727362e2c75ba9c25e
pkgname = filebin
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..b41a9988077c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+filebin
+filebin*.tar.*
diff --git a/PKGBUILD b/PKGBUILD
index 2b3ff1cd904f..8cde2f29cdab 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: hashworks<mail@hashworks.net>
pkgname=filebin
pkgver=3.4.3
-pkgrel=1
+pkgrel=2
pkgdesc="A pastebin service written in PHP"
arch=('any')
url="https://wiki.server-speed.net/projects/filebin"
@@ -22,9 +22,19 @@ install=filebin.install
options=('!strip' 'emptydirs')
source=("git+https://github.com/Bluewind/filebin.git"
'filebin-nginx.conf'
+ 'filebin-php-fpm.conf'
+ 'filebin-file-cron.service'
+ 'filebin-file-cron.timer'
+ 'filebin-user-cron.service'
+ 'filebin-user-cron.timer'
)
sha256sums=('SKIP'
- '5500d423d798478bf4f7bb0a147fe8a42b00e843513dd70665ec81f304a6c729')
+ '6ed404a3fbc28c6ab35bf1eba67ddcf46cfd48893237155e38d297a13020180c'
+ '034442098d1608807bec2a03028a7c8bb9ae9d286c378e2f668b4aca3cc9d4e1'
+ '78dd850467d89ac3d1b57fa72fe9ce8d736ce29a89abe624d9c4d2e168e59d19'
+ '116b1e5031c22ad251c486b18ff203813f7227197ef853927ddc2de00e85cbe1'
+ '36c82c506a058edc50b882200332c6a540aa68a5749919eb62dc6c633c47deb3'
+ 'd73e4b984ab95954bd18e08237c6aa8bec32ccc5699531727362e2c75ba9c25e')
build () {
cd ${srcdir}/filebin
@@ -36,8 +46,10 @@ build () {
package() {
mkdir -p ${pkgdir}/usr/share/webapps
mkdir -p ${pkgdir}/etc/webapps/filebin
+ mkdir -p ${pkgdir}/usr/lib/systemd/system
cp -ra ${srcdir}/filebin/ ${pkgdir}/usr/share/webapps/filebin/
- cp filebin-nginx.conf ${pkgdir}/usr/share/webapps/filebin
+ cp filebin-file-cron.service filebin-file-cron.timer filebin-user-cron.service filebin-user-cron.timer ${pkgdir}/usr/lib/systemd/system
+ cp filebin-nginx.conf filebin-php-fpm.conf ${pkgdir}/usr/share/webapps/filebin
cd ${pkgdir}/usr/share/webapps/filebin
cp application/config/example/{config-local,database,memcached}.php ${pkgdir}/etc/webapps/filebin
rm application/config/memcached.php
@@ -45,8 +57,12 @@ package() {
cp data/local/examples/contact-info.php ${pkgdir}/etc/webapps/filebin
ln -s /etc/webapps/filebin/contact-info.php data/local
+ # http
+ chown 33:33 ${pkgdir}/usr/share/webapps/filebin/data/uploads
+
# removing unnecessary data for a production environment
rm -rf .git
+ rm -rf git-hooks
rm -rf application/third_party/{test-more-php,mockery}
rm -rf application/tests
find . -name \*.gitignore -type f -delete
diff --git a/filebin-file-cron.service b/filebin-file-cron.service
new file mode 100644
index 000000000000..62769e12fc99
--- /dev/null
+++ b/filebin-file-cron.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Filebin file cronjob
+
+[Service]
+User=http
+Group=http
+
+PrivateDevices=yes
+PrivateTmp=yes
+ProtectHome=read-only
+ProtectSystem=strict
+NoNewPrivileges=yes
+ReadWritePaths=-/usr/share/webapps/filebin/data/uploads
+
+Type=oneshot
+ExecStart=/usr/bin/php /usr/share/webapps/filebin/index.php file cron
diff --git a/filebin-file-cron.timer b/filebin-file-cron.timer
new file mode 100644
index 000000000000..9ab395695f08
--- /dev/null
+++ b/filebin-file-cron.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run filebin file cron every ten minutes
+
+[Timer]
+OnCalendar=*:0/10
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/filebin-php-fpm.conf b/filebin-php-fpm.conf
new file mode 100644
index 000000000000..ec7440994917
--- /dev/null
+++ b/filebin-php-fpm.conf
@@ -0,0 +1,23 @@
+[fb]
+user = http
+group = http
+
+listen = /run/php-fpm/$pool.sock
+listen.owner = http
+listen.group = http
+
+pm = dynamic
+pm.max_children = 100
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 10
+
+php_flag[display_errors] = off
+
+php_admin_value[open_basedir] = /usr/share/webapps/filebin:/etc/webapps/filebin:/tmp
+
+; For absurdely large textfiles
+php_admin_value[memory_limit] = 512M
+
+php_admin_value[post_max_size] = 1G
+php_admin_value[upload_max_filesize] = 1G
diff --git a/filebin-user-cron.service b/filebin-user-cron.service
new file mode 100644
index 000000000000..2f4d3d79f32a
--- /dev/null
+++ b/filebin-user-cron.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Filebin user cronjob
+
+[Service]
+User=http
+Group=http
+
+PrivateDevices=yes
+PrivateTmp=yes
+ProtectHome=read-only
+ProtectSystem=strict
+NoNewPrivileges=yes
+
+Type=oneshot
+ExecStart=/usr/bin/php /usr/share/webapps/filebin/index.php user cron
diff --git a/filebin-user-cron.timer b/filebin-user-cron.timer
new file mode 100644
index 000000000000..0abd463ddb4c
--- /dev/null
+++ b/filebin-user-cron.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run filebin user cron hourly
+
+[Timer]
+OnCalendar=hourly
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/filebin.install b/filebin.install
index 5034cf6af9d9..f16d2ea35b47 100644
--- a/filebin.install
+++ b/filebin.install
@@ -1,16 +1,18 @@
post_install() {
echo "-------------------------------------------------------------------------------"
- echo "run check_deps.php to make sure all dependecies are installed"
- echo "update 'open_basedir' in php's config to include '/tmp',
- '/usr/share/webapps/filebin' and '/etc/webapps/filebin'"
- echo "enable exif, phar and any of mysql, mysqli, pgsql, pdo_mysql or pdo_pgsql for database access"
- echo "edit the files in '/etc/webapps/filebin'"
- echo "do not edit config.php! use config-local.php to override it when needed"
- echo "add '/usr/share/webapps/filebin/crontab' to the user's crontab"
- echo "run 'php index.php tools update_database' to initialize your database'"
- echo "run 'php index.php user add_user' to add your first user"
- echo "additional information can be found in '/usr/share/webapps/filebin/INSTALL'"
- echo "there is a sample nginx configuration file in '/usr/share/webapps/filebin'"
+ echo "Run check_deps.php to make sure all dependecies are installed."
+ echo ""
+ echo "Update 'open_basedir' in php's config to include '/tmp', '/usr/share/webapps/filebin' and '/etc/webapps/filebin' (sample php-fpm config includes that)."
+ echo "Enable exif, phar and any of mysql, mysqli, pgsql, pdo_mysql or pdo_pgsql for database access."
+ echo "Edit the files in '/etc/webapps/filebin'."
+ echo "Run 'php index.php tools update_database' to initialize your database."
+ echo "Run 'php index.php user add_user' to add your first user."
+
+ echo "Additional information can be found in '/usr/share/webapps/filebin/INSTALL'."
+ echo ""
+ echo "For nginx and php-fpm there are sample configuration files in '/usr/share/webapps/filebin'."
+ echo ""
+ echo "Additionally you should enable 'filebin-user-cron.timer' and 'filebin-user-cron.timer'."
echo "-------------------------------------------------------------------------------"
}