Skip to content

Commit

Permalink
DietPi-Sofware | MediaWiki: A collaboration and documentation platform (
Browse files Browse the repository at this point in the history
#6443)

- DietPi-Software | MediaWiki: The collaboration and documentation platform which was developed for and is used by Wikipedia has been added to our software catalogue.
- DietPi-Software/DietPi-LetsEncrypt | Use shipped Lighttpd setenv module config from Bullseye on where required
  • Loading branch information
Joulinar committed Jun 25, 2023
1 parent 9428d4b commit f95f7f6
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dietpi-software.bash
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ do
case $i in
205) Process_Software webserver;;
27|56|63|64|107|132) Process_Software 89 webserver;; # 93 (Pi-hole) cannot be installed non-interactively
38|40|48|54|55|57|59|90|160) Process_Software 88 89 webserver;;
38|40|48|54|55|57|59|90|141|160) Process_Software 88 89 webserver;;
159) Process_Software 36 37 65 88 89 96 121 124 128 129 152 160 163 webserver;;
47|114|168) Process_Software 88 89 91 webserver;;
8|33|131|179|206) Process_Software 196;;
Expand Down
1 change: 1 addition & 0 deletions .meta/dietpi-survey_report
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ shopt -s extglob
done
unset -v 'aSOFTWARE_NAME8_19[141]' # Spotify Connect Web
unset -v 'aSOFTWARE_NAME8_19[177]' # Firefox Sync Server
aSOFTWARE_NAME8_19[210]='MediaWiki'

# Pre-create software counter array so that we can see also software (available in newest version) with 0 installs
for i in "${aSOFTWARE_NAME8_19[@]}"
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
v8.19
(2023-07-01)

New software:
- MediaWiki | The collaboration and documentation platform which was developed for and is used by Wikipedia has been added to our software catalogue.

Removed software:
- Spotify Connect Web | Development of this Spotify player stalled already in 2018, the underlying library has been deprecated even before that time. The process fails on Debian Bookworm and we have the functional alternatives Raspotify and Spotifyd: https://github.com/MichaIng/DietPi/issues/6418. If you need to uninstall this software title after the DietPi update, have a look here: https://github.com/MichaIng/DietPi/pull/6427
- Firefox Sync Server | As much as we like the browser and the idea of self-hosting its data sync, it stopped working already on Debian Bullseye, as it requires Python 2, which is EOL since 2020. Work has started on a new token server (one component of the whole stack) written in Rust, but it has been archived again. A sync storage server written in Rust exists, however, we are not able to compose a whole stack in Rust, respectively one that natively runs on modern OS versions. If someone is able to get a whole Firefox Sync Server up without Python 2, we would love to re-add it to our software catalogue. If you need to uninstall this software title after the DietPi update, have a look here: https://github.com/MichaIng/DietPi/pull/6427
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ Links to hardware and software manufacturers, sources and build instructions use
- [Moonlight (CLI)](https://github.com/moonlight-stream/moonlight-embedded)
- [Moonlight (GUI)](https://github.com/moonlight-stream/moonlight-qt)
- [Restic](https://github.com/restic/restic)
- [MediaWiki](https://github.com/wikimedia/mediawiki)

---

Expand Down
7 changes: 6 additions & 1 deletion dietpi/dietpi-letsencrypt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@
[[ -f $fp_cert_dir/combined.pem ]] && G_EXEC rm "$fp_cert_dir/combined.pem"

# Allow adding environment variables via: setenv.add-environment
G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
if (( $G_DISTRO < 6 ))
then
G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
else
[[ -f '/etc/lighttpd/conf-enabled/05-setenv.conf' ]] || G_EXEC lighty-enable-mod dietpi-https
fi

cat << _EOF_ > /etc/lighttpd/conf-available/50-dietpi-https.conf
# Based on: https://ssl-config.mozilla.org/#server=lighttpd
Expand Down
108 changes: 103 additions & 5 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,15 @@ Available commands:
aSOFTWARE_DESC[$software_id]='Fast, efficient and secure command-line backup program'
aSOFTWARE_CATX[$software_id]=4
aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/cloud/#restic'
#------------------
software_id=210
aSOFTWARE_NAME[$software_id]='MediaWiki'
aSOFTWARE_DESC[$software_id]='A collaboration and documentation platform'
aSOFTWARE_CATX[$software_id]=4
aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/cloud/#mediawiki'
aSOFTWARE_DEPS[$software_id]='88 89 webserver'
# - Buster: For MediaWiki, at least PHP 7.4.3 is required. https://www.mediawiki.org/wiki/Manual:Installation_requirements#PHP
aSOFTWARE_AVAIL_G_DISTRO[$software_id,5]=0

# Gaming & Emulation
#--------------------------------------------------------------------------------
Expand Down Expand Up @@ -3617,7 +3626,7 @@ _EOF_

Remove_SysV lighttpd

# Enable mod_deflate, if flagged
# Enable mod_deflate if flagged
[[ ${deflate[0]} && ! -f '/etc/lighttpd/conf-enabled/20-deflate.conf' ]] && G_EXEC lighty-enable-mod deflate

# Change webroot from /var/www/html to /var/www
Expand Down Expand Up @@ -4445,7 +4454,12 @@ Redirect 301 /.well-known/caldav /owncloud/remote.php/dav' > /etc/apache2/conf-

# Enable required modules
G_CONFIG_INJECT '"mod_access",' ' "mod_access",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
G_CONFIG_INJECT '"mod_setenv",' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
if (( $G_DISTRO < 6 ))
then
G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
else
[[ -f '/etc/lighttpd/conf-enabled/05-setenv.conf' ]] || G_EXEC lighty-enable-mod dietpi-https
fi

# Move ownCloud configuration file in place and activate it
owncloud_conf='/etc/lighttpd/conf-available/99-dietpi-owncloud.conf'
Expand Down Expand Up @@ -4707,7 +4721,12 @@ Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav' > /etc/apache2/conf

# Enable required modules
G_CONFIG_INJECT '"mod_access",' ' "mod_access",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
G_CONFIG_INJECT '"mod_setenv",' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
if (( $G_DISTRO < 6 ))
then
G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
else
[[ -f '/etc/lighttpd/conf-enabled/05-setenv.conf' ]] || G_EXEC lighty-enable-mod dietpi-https
fi

# Move Nextcloud configuration file in place and activate it
nextcloud_conf='/etc/lighttpd/conf-available/99-dietpi-nextcloud.conf'
Expand Down Expand Up @@ -6129,7 +6148,12 @@ _EOF_
if (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 ))
then
# Enable required modules
G_CONFIG_INJECT '"mod_setenv",' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
if (( $G_DISTRO < 6 ))
then
G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
else
[[ -f '/etc/lighttpd/conf-enabled/05-setenv.conf' ]] || G_EXEC lighty-enable-mod dietpi-https
fi

# Add and enable Pi-hole config
dps_index=$software_id Download_Install 'lighttpd.pihole.conf' /etc/lighttpd/conf-available/99-dietpi-pihole.conf
Expand Down Expand Up @@ -8101,7 +8125,12 @@ _EOF_
then
# Enable Lighttpd setenv, access and rewrite modules
G_CONFIG_INJECT '"mod_access",' ' "mod_access",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
G_CONFIG_INJECT '"mod_setenv",' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
if (( $G_DISTRO < 6 ))
then
G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
else
[[ -f '/etc/lighttpd/conf-enabled/05-setenv.conf' ]] || G_EXEC lighty-enable-mod dietpi-https
fi

# Move Pydio Lighttpd config in place
dps_index=$software_id Download_Install 'lighttpd.pydio.conf' /etc/lighttpd/conf-available/99-dietpi-pydio.conf
Expand Down Expand Up @@ -11654,6 +11683,69 @@ _EOF_
G_EXEC chmod +x /usr/local/bin/restic
fi

if To_Install 210 # MediaWiki
then
# Install required PHP modules: https://www.mediawiki.org/wiki/Manual:Installation_requirements#PHP
aDEPS=("php$PHP_VERSION-gd" "php$PHP_VERSION-intl")
# - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8
[[ $PHP_VERSION == 8* ]] || aDEPS+=("php$PHP_VERSION-json")
local php_modules=("${aDEPS[@]##*-}")

# Create MariaDB database and user
if [[ -d '/mnt/dietpi_userdata/mysql/mediawiki' ]]
then
G_DIETPI-NOTIFY 2 'MediaWiki MariaDB database found, will NOT overwrite.'
else
/boot/dietpi/func/create_mysql_db mediawiki mediawiki "$GLOBAL_PW"
fi

# Get latest version
local fallback_url='https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.3.tar.gz'
Download_Install "$(curl -sSfL 'https://www.mediawiki.org/wiki/Download' | grep -o 'https://releases\.wikimedia\.org/mediawiki/[^/"]*/mediawiki-[^"]*\.tar\.gz' | head -1)"

# Enable required PHP modules
G_EXEC phpenmod "${php_modules[@]}"

# Webserver configs
# - Lighttpd
if (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 ))
then
if (( $G_DISTRO < 6 ))
then
G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",'
else
[[ -f '/etc/lighttpd/conf-enabled/05-setenv.conf' ]] || G_EXEC lighty-enable-mod dietpi-https
fi
cat << '_EOF_' > /etc/lighttpd/conf-available/98-dietpi-mediawiki.conf
$HTTP["url"] =~ "^/wiki/images($|/)" {
setenv.set-response-header = ("X-Content-Type-Options" => "nosniff")
}
_EOF_
[[ -f '/etc/lighttpd/conf-enabled/98-dietpi-mediawiki.conf' ]] || lighty-enable-mod dietpi-mediawiki

# - Nginx
elif (( ${aSOFTWARE_INSTALL_STATE[85]} > 0 ))
then
cat << '_EOF_' > /etc/nginx/sites-dietpi/dietpi-mediawiki.conf
location ^~ /wiki/images {
add_header X-Content-Type-Options "nosniff" always;
}
_EOF_
fi

# Reinstall: Clean install but preserve existing config file
if [[ -f '/var/www/wiki/LocalSettings.php' ]]
then
G_EXEC mv /var/www/wiki/LocalSettings.php mediawiki-*/
G_EXEC chmod 600 mediawiki-*/LocalSettings.php
fi
G_EXEC chown -R www-data:www-data mediawiki-*
[[ -d '/var/www/wiki' ]] && G_EXEC rm -R /var/www/wiki

# Move new instance in place
G_EXEC mv mediawiki-* /var/www/wiki
fi

if To_Install 205 # Homer
then
# Download the latest release
Expand Down Expand Up @@ -14065,6 +14157,12 @@ _EOF_
[[ -f '/usr/local/bin/restic' ]] && G_EXEC rm /usr/local/bin/restic
fi

if To_Uninstall 210 # MediaWiki
then
[[ -d '/var/www/wiki' ]] && G_EXEC rm -R /var/www/wiki
Remove_Database mediawiki
fi

if To_Uninstall 198 # File Browser
then
Remove_Service filebrowser 1
Expand Down

0 comments on commit f95f7f6

Please sign in to comment.