1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

First steps in supporting php-legacy in Arc

This sorts out HTTP servers, hopefully. Adaptation for systemd and documentation are still required
This commit is contained in:
J. King 2023-12-22 13:27:02 -05:00
parent 9951b44932
commit 29fb134633
9 changed files with 71 additions and 20 deletions

5
dist/apache/arsse-fcgi.conf vendored Normal file
View file

@ -0,0 +1,5 @@
ProxyPreserveHost On
ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/usr/share/arsse/arsse.php"
ProxyFCGISetEnvIf "-n req('Authorization')" HTTP_AUTHORIZATION "%{req:Authorization}"
ProxyPass "unix:/var/run/php/arsse.sock|fcgi://localhost/usr/share/arsse/"

View file

@ -1,34 +1,34 @@
# Nextcloud News protocol # Nextcloud News protocol
<Location "/index.php/apps/news/api"> <Location "/index.php/apps/news/api">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Tiny Tiny RSS protocol # Tiny Tiny RSS protocol
<Location "/tt-rss/api"> <Location "/tt-rss/api">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Tiny Tiny RSS feed icons # Tiny Tiny RSS feed icons
<Location "/tt-rss/feed-icons"> <Location "/tt-rss/feed-icons">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Fever protocol # Fever protocol
<Location "/fever"> <Location "/fever">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Miniflux protocol # Miniflux protocol
<Location "/v1"> <Location "/v1">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Miniflux version number # Miniflux version number
<Location "/version"> <Location "/version">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Miniflux "health check" # Miniflux "health check"
<Location "/healthcheck"> <Location "/healthcheck">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>

View file

@ -3,9 +3,4 @@ DocumentRoot "/usr/share/arsse/www"
Require all granted Require all granted
</Directory> </Directory>
Define ARSSE_PROXY "unix:/var/run/php/arsse.sock|fcgi://localhost/usr/share/arsse/"
ProxyPreserveHost On
ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/usr/share/arsse/arsse.php"
ProxyFCGISetEnvIf "-n req('Authorization')" HTTP_AUTHORIZATION "%{req:Authorization}"
Include "/etc/arsse/apache/arsse-loc.conf" Include "/etc/arsse/apache/arsse-loc.conf"

12
dist/arch/PKGBUILD vendored
View file

@ -14,7 +14,7 @@ optdepends=("nginx: HTTP server"
"apache>=2.4: HTTP server" "apache>=2.4: HTTP server"
"percona-server: Alternate database" "percona-server: Alternate database"
"postgresql>=10: Alternate database" "postgresql>=10: Alternate database"
"php-pgsql>=7.3: PostgreSQL database support") "php-pgsql-interpreter>=7.3: PostgreSQL database support")
backup=("etc/webapps/arsse/config.php" backup=("etc/webapps/arsse/config.php"
"etc/php/php-fpm.d/arsse.conf" "etc/php/php-fpm.d/arsse.conf"
"etc/webapps/arsse/nginx/example.conf" "etc/webapps/arsse/nginx/example.conf"
@ -23,13 +23,14 @@ backup=("etc/webapps/arsse/config.php"
"etc/webapps/arsse/nginx/arsse-fcgi.conf" "etc/webapps/arsse/nginx/arsse-fcgi.conf"
"etc/webapps/arsse/apache/example.conf" "etc/webapps/arsse/apache/example.conf"
"etc/webapps/arsse/apache/arsse.conf" "etc/webapps/arsse/apache/arsse.conf"
"etc/webapps/arsse/apache/arsse-fcgi.conf"
"etc/webapps/arsse/apache/arsse-loc.conf") "etc/webapps/arsse/apache/arsse-loc.conf")
source=("arsse-0.10.4.tar.gz") source=("arsse-0.10.4.tar.gz")
md5sums=("SKIP") md5sums=("SKIP")
package() { package() {
# define runtime dependencies # define runtime dependencies
depends=("php>=7.3" "php-intl>=7.3" "php-sqlite>=7.3" "php-fpm>=7.3") depends=("php-interpreter>=7.3" "php-sqlite-interpreter>=7.3" "php-fpm-interpreter>=7.3")
# create most directories necessary for the final package # create most directories necessary for the final package
cd "$pkgdir" cd "$pkgdir"
mkdir -p "usr/share/webapps/arsse" "usr/share/doc/arsse" "usr/share/licenses/arsse" "usr/lib/systemd/system" "usr/lib/sysusers.d" "usr/lib/tmpfiles.d" "etc/php/php-fpm.d" "etc/webapps/arsse" mkdir -p "usr/share/webapps/arsse" "usr/share/doc/arsse" "usr/share/licenses/arsse" "usr/lib/systemd/system" "usr/lib/sysusers.d" "usr/lib/tmpfiles.d" "etc/php/php-fpm.d" "etc/webapps/arsse"
@ -47,11 +48,14 @@ package() {
cd "$pkgdir" cd "$pkgdir"
# copy files requiring special permissions # copy files requiring special permissions
cd "$srcdir/arsse" cd "$srcdir/arsse"
install -Dm755 dist/arsse "$pkgdir/usr/bin/arsse"
install -Dm640 dist/config.php "$pkgdir/etc/webapps/arsse" install -Dm640 dist/config.php "$pkgdir/etc/webapps/arsse"
# patch generic configuration files to use Arch-specific paths and identifiers # patch generic configuration files to use Arch-specific paths and identifiers
sed -i -se 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" "$pkgdir/usr/lib/systemd/system/"* "$pkgdir/usr/bin/"* sed -i -se 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" "$pkgdir/usr/lib/systemd/system/"*
sed -i -se 's/\/var\/run\/php\//\/run\/php-fpm\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -i -se 's/\/var\/run\/php\//\/run\/php-fpm\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -i -se 's/www-data/http/g' "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -i -se 's/www-data/http/g' "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -i -e 's/^WorkingDirectory=.*$/WorkingDirectory=\/usr\/share\/webapps\/arsse/g' -e 's/^ConfigurationDirectory=.*$/ConfigurationDirectory=webapps\/arsse/g' "$pkgdir/usr/lib/systemd/system/arsse-fetch.service" sed -i -e 's/^WorkingDirectory=.*$/WorkingDirectory=\/usr\/share\/webapps\/arsse/g' -e 's/^ConfigurationDirectory=.*$/ConfigurationDirectory=webapps\/arsse/g' "$pkgdir/usr/lib/systemd/system/arsse-fetch.service"
# copy Arch-specific versions of files
install -Dm755 dist/arch/arsse "$pkgdir/usr/bin/arsse"
cp dist/arch/nginx-arsse-fcgi.conf "$pkgdir/etc/webapps/arsse/nginx/arsse-fcgi.conf"
cp dist/arch/apache-arsse-fcgi.conf "$pkgdir/etc/webapps/arsse/apache/arsse-fcgi.conf"
} }

6
dist/arch/apache-arsse-fcgi.conf vendored Normal file
View file

@ -0,0 +1,6 @@
ProxyPreserveHost On
ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/usr/share/webapps/arsse/arsse.php"
ProxyFCGISetEnvIf "-n req('Authorization')" HTTP_AUTHORIZATION "%{req:Authorization}"
# Modify the below line to begin with "unix:/run/php-fpm-legacy/" if using the php-legacy package
ProxyPass "unix:/run/php/arsse.sock|fcgi://localhost/usr/share/webapps/arsse/"

26
dist/arch/arsse vendored Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
readonly default_php="/usr/bin/php"
php=""
check_sudo() {
if ! command -v sudo > /dev/null; then
printf "The sudo command is not available.\n"
exit 1
fi
}
# allow overriding the php executable
if [[ -n "${ARSSE_PHP}" ]] && command -v "${ARSSE_PHP}" > /dev/null; then
php="${ARSSE_PHP}"
else
php="${default_php}"
fi
if [[ "${UID}" -eq 0 ]]; then
runuser -u "arsse" -- "$php" /usr/share/webapps/arsse/arsse.php "$@"
else
check_sudo
sudo -u "arsse" "$php" /usr/share/webapps/arsse/arsse.php "$@"
fi

16
dist/arch/ngninx-arsse-fcgi.conf vendored Normal file
View file

@ -0,0 +1,16 @@
fastcgi_pass_header Authorization; # required if the Arsse is to perform its own HTTP authentication
fastcgi_pass_request_body on;
fastcgi_pass_request_headers on;
fastcgi_intercept_errors off;
fastcgi_buffering off;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $uri;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/arsse/arsse.php;
# Modify the below line to begin with "/run/php-fpm-legacy/" if using the php-legacy package
fastcgi_pass unix:/run/php/arsse.sock;

View file

@ -10,3 +10,6 @@ fastcgi_param REQUEST_URI $uri;
fastcgi_param QUERY_STRING $query_string; fastcgi_param QUERY_STRING $query_string;
fastcgi_param HTTPS $https if_not_empty; fastcgi_param HTTPS $https if_not_empty;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/php/arsse.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/arsse/arsse.php;

View file

@ -2,15 +2,11 @@ root /usr/share/arsse/www;
location @arsse { location @arsse {
# HTTP authentication may be enabled for this location, though this may impact some features # HTTP authentication may be enabled for this location, though this may impact some features
fastcgi_pass unix:/var/run/php/arsse.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/arsse/arsse.php;
include /etc/arsse/nginx/arsse-fcgi.conf; include /etc/arsse/nginx/arsse-fcgi.conf;
} }
location @arsse_public { location @arsse_public {
# HTTP authentication should not be enabled for this location # HTTP authentication should not be enabled for this location
fastcgi_pass unix:/var/run/php/arsse.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/arsse/arsse.php;
include /etc/arsse/nginx/arsse-fcgi.conf; include /etc/arsse/nginx/arsse-fcgi.conf;
} }