-
-
Notifications
You must be signed in to change notification settings - Fork 99
Moodle #813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Moodle #813
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First quick review
frontend/public/json/moodle.json
Outdated
"password": null | ||
}, | ||
"notes": [ | ||
"Database and Admin credentials are saved in ~/moodle.creds", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes need an Type and must be seperate. Checkout the json-editor on our Site:
https://community-scripts.github.io/ProxmoxVE/json-editor
install/moodle-install.sh
Outdated
msg_info "Installing Web & DB stack" | ||
$STD apt-get install -y apache2 mariadb-server git unzip \ | ||
php libapache2-mod-php \ | ||
php-mysql php-zip php-xml php-gd php-curl \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have seperate functions for PHP, mariadb and co. Checkout other Scripts or our tools.func in misc
msg_ok "Selecting Moodle branch" | ||
REMOTE_BRANCHES="$(git ls-remote --heads https://github.com/moodle/moodle.git 'MOODLE_*_STABLE' | awk -F'refs/heads/' '{print $2}' | sort -V)" | ||
echo "Available stable branches:" | ||
echo "${REMOTE_BRANCHES}" | ||
echo -n "Enter branch to install [default MOODLE_500_STABLE]: " | ||
read -r MOODLE_BRANCH | ||
MOODLE_BRANCH="${MOODLE_BRANCH:-MOODLE_500_STABLE}" | ||
if ! echo "${REMOTE_BRANCHES}" | grep -qx "${MOODLE_BRANCH}"; then | ||
msg_error "Branch ${MOODLE_BRANCH} not found among remotes" | ||
exit 1 | ||
fi | ||
msg_ok "Selected ${MOODLE_BRANCH}" | ||
|
||
msg_info "Cloning Moodle (shallow)" | ||
install -d -m 0755 /var/www | ||
$STD rm -rf /var/www/moodle | ||
$STD git clone --depth 1 --branch "${MOODLE_BRANCH}" https://github.com/moodle/moodle.git /var/www/moodle | ||
msg_ok "Cloned Moodle ${MOODLE_BRANCH}" | ||
|
||
msg_info "Setting permissions and data directory" | ||
install -d -m 0770 -o www-data -g www-data /var/moodledata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why so much effort? Just use function "fetch_and_deploy_gh_release "moodle"....
install/moodle-install.sh
Outdated
msg_info "PHP tuning (CLI and Apache)" | ||
PHPVER="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')" || true | ||
if [[ -z "$PHPVER" ]]; then | ||
PHPVER="$(ls -1d /etc/php/* 2>/dev/null | awk -F'/' '{print $4}' | head -n1)" | ||
fi | ||
if [[ -z "$PHPVER" ]]; then | ||
msg_error "Unable to determine PHP version path under /etc/php" | ||
exit 1 | ||
fi | ||
for sapi in apache2 cli; do | ||
install -d -m 0755 "/etc/php/${PHPVER}/${sapi}/conf.d" | ||
{ | ||
echo "max_input_vars=5000" | ||
echo "memory_limit=256M" | ||
} >"/etc/php/${PHPVER}/${sapi}/conf.d/99-moodle.ini" | ||
done | ||
$STD systemctl reload apache2 | ||
msg_ok "PHP tuned" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this is not needed with setup_php function
db57a72
to
b1a3b4d
Compare
This reverts commit 317c6f6.
MARIADB_VERSION="latest" | ||
export MARIADB_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MARIADB_VERSION="latest" | |
export MARIADB_VERSION |
MARIADB_VERSION="latest" | ||
export MARIADB_VERSION | ||
setup_mariadb | ||
msg_ok "MariaDB ready" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg_ok "MariaDB ready" |
setup_php | ||
msg_ok "PHP ready" | ||
|
||
msg_info "Install MariaDB" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg_info "Install MariaDB" |
msg_info "Install PHP (Apache) + required modules" | ||
$STD apt-get install -y git | ||
PHP_VERSION="8.2" | ||
PHP_APACHE="YES" | ||
PHP_FPM="NO" | ||
PHP_MODULE="bcmath,curl,gd,intl,mbstring,opcache,readline,xml,zip,mysql,soap,ldap" | ||
PHP_MEMORY_LIMIT="256M" | ||
export PHP_VERSION PHP_APACHE PHP_FPM PHP_MODULE PHP_MEMORY_LIMIT | ||
setup_php | ||
msg_ok "PHP ready" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg_info "Install PHP (Apache) + required modules" | |
$STD apt-get install -y git | |
PHP_VERSION="8.2" | |
PHP_APACHE="YES" | |
PHP_FPM="NO" | |
PHP_MODULE="bcmath,curl,gd,intl,mbstring,opcache,readline,xml,zip,mysql,soap,ldap" | |
PHP_MEMORY_LIMIT="256M" | |
export PHP_VERSION PHP_APACHE PHP_FPM PHP_MODULE PHP_MEMORY_LIMIT | |
setup_php | |
msg_ok "PHP ready" | |
PHP_VERSION="8.2" PHP_APACHE="YES" PHP_MODULE="mysql,soap,ldap" PHP_MEMORY_LIMIT="256M" setup_php |
msg_ok "Selecting Moodle branch" | ||
REMOTE_BRANCHES="$(git ls-remote --heads https://github.com/moodle/moodle.git 'MOODLE_*_STABLE' | awk -F'refs/heads/' '{print $2}' | sort -V)" | ||
echo "Available stable branches:" | ||
echo "${REMOTE_BRANCHES}" | ||
echo -n "Enter branch to install [default MOODLE_500_STABLE]: " | ||
read -r MOODLE_BRANCH | ||
MOODLE_BRANCH="${MOODLE_BRANCH:-MOODLE_500_STABLE}" | ||
if ! echo "${REMOTE_BRANCHES}" | grep -qx "${MOODLE_BRANCH}"; then | ||
msg_error "Branch ${MOODLE_BRANCH} not found among remotes" | ||
exit 1 | ||
fi | ||
msg_ok "Selected ${MOODLE_BRANCH}" | ||
|
||
msg_info "Cloning Moodle (shallow)" | ||
install -d -m 0755 /var/www | ||
$STD rm -rf /var/www/moodle | ||
$STD git clone --depth 1 --branch "${MOODLE_BRANCH}" https://github.com/moodle/moodle.git /var/www/moodle | ||
msg_ok "Cloned Moodle ${MOODLE_BRANCH}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg_ok "Selecting Moodle branch" | |
REMOTE_BRANCHES="$(git ls-remote --heads https://github.com/moodle/moodle.git 'MOODLE_*_STABLE' | awk -F'refs/heads/' '{print $2}' | sort -V)" | |
echo "Available stable branches:" | |
echo "${REMOTE_BRANCHES}" | |
echo -n "Enter branch to install [default MOODLE_500_STABLE]: " | |
read -r MOODLE_BRANCH | |
MOODLE_BRANCH="${MOODLE_BRANCH:-MOODLE_500_STABLE}" | |
if ! echo "${REMOTE_BRANCHES}" | grep -qx "${MOODLE_BRANCH}"; then | |
msg_error "Branch ${MOODLE_BRANCH} not found among remotes" | |
exit 1 | |
fi | |
msg_ok "Selected ${MOODLE_BRANCH}" | |
msg_info "Cloning Moodle (shallow)" | |
install -d -m 0755 /var/www | |
$STD rm -rf /var/www/moodle | |
$STD git clone --depth 1 --branch "${MOODLE_BRANCH}" https://github.com/moodle/moodle.git /var/www/moodle | |
msg_ok "Cloned Moodle ${MOODLE_BRANCH}" |
Dont use git clone, use fetch_and_deploy_gh_release
function
@@ -0,0 +1,56 @@ | |||
#!/usr/bin/env bash | |||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) | |
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) |
|
||
msg_info "Preparing repository" | ||
$STD git config --system --add safe.directory /var/www/moodle || true | ||
|
||
BRANCH="$(runuser -u www-data -- git -C /var/www/moodle rev-parse --abbrev-ref HEAD 2>/dev/null || echo 'MOODLE_500_STABLE')" | ||
msg_info "Updating $APP (${BRANCH})" | ||
$STD runuser -u www-data -- git -C /var/www/moodle fetch --all --prune | ||
$STD runuser -u www-data -- git -C /var/www/moodle checkout -B "${BRANCH}" "origin/${BRANCH}" | ||
$STD runuser -u www-data -- git -C /var/www/moodle reset --hard "origin/${BRANCH}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use git
"interface_port": 80, | ||
"documentation": "https://docs.moodle.org/500/en/Main_page", | ||
"website": "https://moodle.org/", | ||
"logo": "https://moodle.org/theme/image.php/moodleorg/core/1720531200/moodle-logo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"logo": "https://moodle.org/theme/image.php/moodleorg/core/1720531200/moodle-logo", | |
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/moodle.webp", |
}, | ||
"notes": [ | ||
{ "type": "info", "text": "Database and Admin credentials are saved in ~/moodle.creds" }, | ||
{ "type": "warning", "text": "Moodle requires PHP settings: max_input_vars >= 5000 and memory_limit >= 256M. These are applied automatically." }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "type": "warning", "text": "Moodle requires PHP settings: max_input_vars >= 5000 and memory_limit >= 256M. These are applied automatically." }, |
Not needed
{ "type": "info", "text": "Database and Admin credentials are saved in ~/moodle.creds" }, | ||
{ "type": "warning", "text": "Moodle requires PHP settings: max_input_vars >= 5000 and memory_limit >= 256M. These are applied automatically." }, | ||
{ "type": "info", "text": "Default data directory: /var/moodledata (writeable by www-data)." }, | ||
{ "type": "info", "text": "Supports MariaDB as the database backend (configured by the script)." } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "type": "info", "text": "Supports MariaDB as the database backend (configured by the script)." } |
Not needed
π New scripts must first be submitted to ProxmoxVED for testing.
PRs for new scripts that skip this process will be closed.
βοΈ Description
Install script for moodle
π Related PR / Issue
Link: #
β Prerequisites (X in brackets)
π οΈ Type of Change (X in brackets)
README
,AppName.md
,CONTRIBUTING.md
, or other docs.π Code & Security Review (X in brackets)
Code_Audit.md
&CONTRIBUTING.md
guidelinesAppName.sh
,AppName-install.sh
,AppName.json
)π Additional Information (optional)