Skip to content

Commit

Permalink
Hotfix aws s3 extension (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 authored Jun 30, 2024
1 parent a5fa41f commit 31ab81c
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion jobs/fastcgi.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ job "fastcgi" {
change_mode = "noop"
}

template {
data = var.run
destination = "local/run.php"
change_mode = "noop"
}

config {
image = "ghcr.io/femiwiki/femiwiki:2024-06-30T00-53-34439279"

Expand All @@ -86,6 +92,7 @@ job "fastcgi" {
"secrets/analytics-credentials-file.json:/a/analytics-credentials-file.json",
# Overwrite the default Hotfix.php provided by femiwiki/mediawiki
"local/Hotfix.php:/a/Hotfix.php",
"local/Hotfix.php:/usr/local/bin/run",
]

mounts = [
Expand Down Expand Up @@ -116,7 +123,7 @@ job "fastcgi" {
NOMAD_UPSTREAM_ADDR_memcached = "127.0.0.1:11211"
MEDIAWIKI_SKIP_INSTALL = "1"
MEDIAWIKI_SKIP_IMPORT_SITES = "1"
# MEDIAWIKI_SKIP_UPDATE = "1"
MEDIAWIKI_SKIP_UPDATE = "1"
}
}
}
Expand Down Expand Up @@ -161,3 +168,55 @@ $wgScribuntoEngineConf['luastandalone']['cpuLimit'] = 3;
EOF
}

variable "run" {
type = string
default = <<EOF
#!/bin/bash
set -euo pipefail; IFS=$'\n\t'
echo 'Starting Femiwiki ...'
curl -L https://raw.githubusercontent.com/edwardspec/mediawiki-aws-s3/29db5b45e4c4931e00424b636d2bc4026c42b8ad/s3/AmazonS3FileBackend.php \
-o /srv/femiwiki.com/extensions/AWS/s3/AmazonS3FileBackend.php
# Run Install.php
if [ -z "$${MEDIAWIKI_SKIP_INSTALL:-}" ]; then
echo 'Start installing Mediawiki ...'
DB_HOSTNAME="$(php -r 'require "/a/secret.php"; echo $wgDBserver;')"
DB_USERNAME="$(php -r 'require "/a/secret.php"; echo $wgDBuser;')"
DB_PASSWORD="$(php -r 'require "/a/secret.php"; echo $wgDBpassword;')"
php /srv/femiwiki.com/maintenance/install.php \
--lang ko \
--scriptpath '/w' \
--dbtype mysql \
--dbname femiwiki \
--dbserver "$${DB_HOSTNAME}" \
--dbuser "$${DB_USERNAME}" \
--dbpass "$${DB_PASSWORD}" \
--installdbuser "$${DB_USERNAME}" \
--installdbpass "$${DB_PASSWORD}" \
--pass 'admin_password_please_change' \
'페미위키' Admin
fi
# Overwrite LocalSettings.php generated by install script
ln -sf /a/LocalSettings.php /srv/femiwiki.com/LocalSettings.php
# Run update script
if [ -z "$${MEDIAWIKI_SKIP_UPDATE:-}" ]; then
/srv/femiwiki.com/maintenance/update.php --quick
fi
# Add Femiwiki to the sites table
if [ -z "$${MEDIAWIKI_SKIP_IMPORT_SITES:-}" ]; then
php /srv/femiwiki.com/maintenance/importSites.php /a/site-list.xml
fi
# Start cron daemon
cron
# Run php-fpm
php-fpm
EOF
}

0 comments on commit 31ab81c

Please sign in to comment.