-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmanifest.jps
104 lines (88 loc) · 2.81 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
type: install
jpsVersion: 8.3.1
id: ghost
name: Ghost
baseUrl: https://raw.githubusercontent.com/jelastic-jps/ghost/master
logo: /images/ghost-white.png
homepage: https://ghost.org/
mixins:
- configs/vers.yaml
categories:
- apps/content-management
description:
text: /texts/description.md
short: The professional publishing platform
success: /texts/success.md
onBeforeInstall: |
return {
result: 0,
ssl: !!jelastic.billing.account.GetQuotas('environment.jelasticssl.enabled').array[0].value,
nodes: [{
nodeType: "nodejs20-pm2",
cloudlets: 16,
env: {
NODE_ENV: "production"
},
nodeGroup: "cp"
}, {
nodeType: "mysql",
cloudlets: 8,
nodeGroup: "sqldb"
}]
}
skipNodeEmails: true
nodes: definedInOnBeforeInstall
globals:
DB_USER: ghost-${fn.random}
DB_PASS: ${fn.password(10)}
APP_DIR: /home/jelastic/ROOT
PROTOCOL: http
onInstall:
- set-protocol
- create-db
- install-ghost-cli
- install-ghost
- create-pm2-ecosystem
- migration-lock-remove
- restartNodes:
nodeGroup: [cp]
actions:
set-protocol:
- script: |
return {
result:0,
ssl: jelastic.billing.account.GetQuotas('environment.jelasticssl.enabled').array[0].value
}
- if (${response.ssl}):
setGlobals:
PROTOCOL: https
create-db:
cmd[sqldb]: |-
MYSQL_PWD=${nodes.sqldb.password} mysql -uroot -e "CREATE DATABASE ghost;"
MYSQL_PWD=${nodes.sqldb.password} mysql -uroot -e "CREATE USER '${globals.DB_USER}'@'%' IDENTIFIED BY '${globals.DB_PASS}';"
MYSQL_PWD=${nodes.sqldb.password} mysql -uroot -e "GRANT ALL PRIVILEGES ON ghost.* TO '${globals.DB_USER}'@'%' WITH GRANT OPTION;"
install-ghost-cli:
cmd[cp]:
npm install -g ghost-cli
install-ghost:
cmd[cp]: |-
rm -rf ${globals.APP_DIR}/*;
ghost install ${globals.version_ghost} --url ${globals.PROTOCOL}://${env.domain} \
--ip ${nodes.cp.master.intIP} --port 8080 \
--db mysql --dbhost ${nodes.sqldb.master.intIP} --dbuser ${globals.DB_USER} --dbpass ${globals.DB_PASS} --dbname ghost \
--dir ${globals.APP_DIR} --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd --no-start;
create-pm2-ecosystem:
cmd[cp]: |-
echo "module.exports = {
apps : [{
name : \"ghost\",
script : \"${globals.APP_DIR}/current/index.js\",
cwd : \"${globals.APP_DIR}\"
}]
}" > ${globals.APP_DIR}/ecosystem.config.js;
pm2 delete all; pm2 unstartup; pm2 flush;
pm2 start /home/jelastic/ROOT/ecosystem.config.js;
pm2 save;
migration-lock-remove:
cmd[sqldb]:
mysql -u${globals.DB_USER} -p${globals.DB_PASS} -e "use ghost; UPDATE migrations_lock SET locked=0 WHERE lock_key='km01';"