forked from jelastic-jps/wordpress-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanifest.jps
149 lines (127 loc) · 4.43 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
---
type: install
version: '1.1'
name: WordPress Cluster
categories:
- apps/clusters
- apps/content-management
description: WordPress Cluster package provides integrated autoscaling and high availability for development and production environments. Clustered topology ensures effective handling of heavy workload.
logo: https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/master/images/wp-cluster.png
baseUrl: https://raw.githubusercontent.com/jelastic-jps/wordpress-cluster/master
settings:
fields:
- name: wp_title
caption: WP Title
type: string
default: HelloWorld
required: 'true'
regex: "^[\\w-.]*$"
regexText: Incorrect WP Title.
nodes:
- nodeType: mysql
tag: 5.7.22
count: 2
cloudlets: 8
nodeGroup: sqldb
displayName: Database
env:
ON_ENV_INSTALL: ''
- nodeType: nginxphp-dockerized
tag: 1.14.2-php-7.3.0
count: 2
cloudlets: 8
nodeGroup: cp
displayName: AppServer
links: sqldb:DB
volumes:
- "/var/www/webroot/ROOT"
- "/var/ftp/webroot/ROOT"
volumeMounts:
"/var/www/webroot/ROOT":
readOnly: false
sourcePath: "/data"
sourceNodeGroup: storage
"/var/ftp/webroot/ROOT":
readOnly: false
sourcePath: "/data"
sourceNodeGroup: storage
- nodeType: storage
cloudlets: 8
nodeGroup: storage
displayName: Storage
- nodeType: nginx-dockerized
tag: 1.14.2
count: 1
cloudlets: 8
nodeGroup: bl
displayName: Load balancer
onBeforeInit: |
var resp = jelastic.billing.account.GetQuotas(appid, session, 'environment.jelasticssl.enabled');
if (resp.result != 0 ) return resp;
return { result: 0, ssl: !!resp.array[0].value };
onAfterScaleOut[nodeGroup:cp]:
forEach(event.response.nodes):
cmd [${@i.id}]: sudo service nginx reload
setNodeDisplayName [${@i.id}]: AppServer
onAfterScaleOut[nodeGroup:bl]:
forEach(event.response.nodes):
setNodeDisplayName [${@i.id}]: Load balancer
globals:
DB_USER: jelastic-${fn.random}
DB_PASS: "${fn.password(20)}"
ADMIN_PASSWD: "${fn.password(20)}"
onInstall:
- log: Auto Scaling Triggers
- script: "${baseUrl}/scripts/addTriggers.js"
- log: Set Node Display Name
- setNodeDisplayName [bl]: Load balancer
- setNodeDisplayName [cp]: AppServer
- log: DB Multi-Master Cluster Setup
- installJps:
jps: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/scripts/ms-mm-configuration.jps
settings:
path: "https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master"
db_user: "${globals.DB_USER}"
db_pass: "${globals.DB_PASS}"
scheme: master
custom_conf: "${baseUrl}/configs/mysql/mysql.cnf"
nodeGroup: sqldb
- log: CP Layer Setup
- forEach(nodes.cp):
setupNode:
nodeId: "${@i.id}"
- log: Download and Unpack latest WordPress release
- cmd[storage]: wget -qO- 'https://wordpress.org/latest.tar.gz' | tar xz -C /tmp && mv /tmp/wordpress/* /data
- log: Setup WordPress
- installJps:
jps: "${baseUrl}/scripts/setup-wordpress.jps"
settings:
db_host: DB_1
db_user: "${globals.DB_USER}"
db_pass: "${globals.DB_PASS}"
admin_passwd: "${globals.ADMIN_PASSWD}"
wp_title: "${settings.wp_title}"
- log: 'Install HyperDB - is an advanced database class that supports replication, failover, load balancing and partitioning.'
- cmd[storage]: |-
wget ${baseUrl}/configs/wordpress/db-config.php -O /data/db-config.php
wget ${baseUrl}/configs/wordpress/db.php -O /data/wp-content/db.php
- log: Additional configuration for WordPress.
- cmd[storage]: |-
wget ${baseUrl}/configs/wordpress/wp-jelastic.php -O /data/wp-jelastic.php
sed -i "s/.*'wp-settings.php';.*/require_once ABSPATH . 'wp-jelastic.php';\n&/" /data/wp-config.php
- log: Plugins install
- installJps:
jps: "${baseUrl}/scripts/setup-plugins.jps"
settings:
server_webroot: /var/www/webroot/ROOT
- log: Set permission
- cmd[storage]: chown 700:700 -Rh /data/
actions:
setupNode:
- cmd[${this.nodeId}]: |-
wget ${baseUrl}/configs/nginx/nginx.conf -O /etc/nginx/nginx.conf
wget ${baseUrl}/configs/nginx/default.conf -O /etc/nginx/conf.d/default.conf
wget ${baseUrl}/configs/php/wp-upload.ini -O /etc/php.d/wp-upload.ini
wget ${baseUrl}/configs/php/opcache.ini -O /etc/php.d/opcache.ini
sudo service nginx restart
success: /text/success.md