-
Notifications
You must be signed in to change notification settings - Fork 8
/
manifest.jps
117 lines (99 loc) · 4.27 KB
/
manifest.jps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
type: install
version: 1.7
id: moodle
name: Moodle
homepage: http://www.moodle.org/
categories:
- apps/content-management
baseUrl: https://raw.githubusercontent.com/jelastic-jps/moodle/master/
logo: images/Moodle-logo.png
description: Moodle is a learning platform, designed to provide educators and learners with a single robust, secure and integrated system to create personalised learning environments.
globals:
ADMIN_PASS: ${user.appPassword}
DB_PASS: ${fn.password(10)}
application: moodle
CONFIG: /var/www/webroot/ROOT/config.php
mixins:
- configs/vers.yaml
onAfterChangeTopology:
- if (${event.response.response.env.sslstate}):
setSSL:
value: 1
- else:
setSSL:
value: 0
onAfterBindSSL:
setSSL:
value: 1
onAfterRemoveSSL:
setSSL:
value: 0
nodes:
- cloudlets: 8
nodeType: apache2
engine: php8.3
- cloudlets: 8
nodeType: mysql8
onInstall:
- script: |
var version = "${globals.version_moodle}".match(/(\d+)\.(\d+)/g)[0].replace(".", "0");
if (version.length == 2) version += 0;
return {
result: 0,
version: version
};
- setGlobals:
version_short: ${response.version}
- deploy:
context: ROOT
archive: https://download.moodle.org/download.php/direct/stable${globals.version_short}/moodle-${globals.version_moodle}.zip
name: moodle-${globals.version_moodle}.zip
- createDb
- replaceInFile:
nodeType: apache2
path: ${SYSTEM_ETC}/php.ini
replacements:
- pattern: "; zend_extension=opcache.so"
replacement: zend_extension=opcache.so
- pattern: ";extension=mysqli.so"
replacement: "extension=mysqli.so \rmysqli.reconnect = Off \rmysqli.cache_size = 2000"
- pattern: ";extension=gd.so"
replacement: extension=gd.so
- pattern: ";extension=intl.so"
replacement: extension=intl.so
- pattern: "max_input_vars = 1000"
replacement: max_input_vars = 5000
- pattern: ";extension=soap.so"
replacement: extension=soap.so
- cmd[cp]: echo "extension=sodium.so" >> ${SYSTEM_ETC}/php.ini
user: root
- restartNodes:
nodeType: apache2
- cmd[cp]:
- chmod -R 0755 /var/www/webroot/ROOT/*
- find /var/www/webroot/ROOT/ -type f -exec chmod 0644 {} \
- mkdir /var/www/webroot/moodledata
- chown -R jelastic .
- php /var/www/webroot/ROOT/admin/cli/install.php --dbhost=${nodes.sqldb.address} --dbname=moodle --dbuser=moodle --dbpass='${globals.DB_PASS}' --dbport=3306 --adminuser=admin --adminpass='${globals.ADMIN_PASS}' --adminemail=${user.email} --lang=en --non-interactive --wwwroot=http://${env.domain} --dataroot=/var/www/webroot/moodledata/ --fullname=MoodleLMS --shortname=Moodle --agree-license
- sed -i "s|Header always set Cross-Origin-Opener-Policy|#Header always set Cross-Origin-Opener-Policy|g" /etc/httpd/conf.d/10-shared_headers.conf
- sudo service httpd restart
- writeFile:
nodeType: apache2
path: /var/www/webroot/moodledata/.htaccess
write: Redirect /moodledata ${env.url}
actions:
createDb:
cmd[sqldb]: |-
MYSQL_PWD=${nodes.mysql8.password} mysql -uroot -e "CREATE DATABASE moodle;"
MYSQL_PWD=${nodes.mysql8.password} mysql -uroot -e "CREATE USER 'moodle'@'%' IDENTIFIED BY '${globals.DB_PASS}';"
MYSQL_PWD=${nodes.mysql8.password} mysql -uroot -e "GRANT ALL PRIVILEGES ON moodle.* To 'moodle'@'%' WITH GRANT OPTION;"
setSSL:
cmd [cp]: |-
grep -q sslproxy ${globals.CONFIG} && { sed -ri "s|$CFG->sslproxy = .*;|$CFG->sslproxy = ${this.value};|g" ${globals.CONFIG}; } || { sed -ri "s|$CFG->wwwroot|$CFG->sslproxy = ${this.value};\n\$CFG->wwwroot|g" ${globals.CONFIG}; }
[[ "${this.value}" -eq "1" ]] && sed -ir "s|\$CFG->wwwroot.*= 'http\:|\$CFG->wwwroot = 'https\:|g" ${globals.CONFIG} || sed -ir "s|\$CFG->wwwroot.*= 'https\:|\$CFG->wwwroot = 'http\:|g" ${globals.CONFIG}
success: |
Below you will find your admin panel link, username and password.
Admin panel URL: [${env.protocol}://${env.domain}/login/index.php](${env.protocol}://${env.domain}/login/index.php)
Admin name: admin
Password: ${globals.ADMIN_PASS}
To add custom domain name for your Moodle installation follow the steps described in our [documentation](http://docs.jelastic.com/custom-domains)