forked from jelastic-jps/wordpress-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanifest.jps
149 lines (128 loc) · 4.73 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
---
jpsType: install
jpsVersion: '1.1'
name: WordPress Cluster
categories:
- apps/clustered-dbs
- apps/popular
- apps/clusters
- apps/dev-and-admin-tools
description: Get your highly available and scalable clustered solution for WordPress,
the extremely popular open source CMS and blogging tool. This package is designed
to ensure the load tracking and distribution, as well as automatic adjusting the
amount of allocated resources according to it.
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.
ssl: false
nodes:
- nodeType: mysql5
count: 2
cloudlets: 8
nodeGroup: sqldb
displayName: Database
env:
ON_ENV_INSTALL: ''
- nodeType: nginxphp
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
count: 1
cloudlets: 8
nodeGroup: bl
displayName: Load balancer
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/multimaster-configuration.jps
settings:
db_user: "${globals.DB_USER}"
db_pass: "${globals.DB_PASS}"
custom_conf: "${baseUrl}/configs/mysql/mysql.cnf"
user: root
- 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: Below you will find your admin panel link, username and password.</br></br>
<table style='font-size:14px'><tr><td>Admin panel URL:</td><td><a href='${env.protocol}://${env.domain}/wp-admin/'
target='_blank'>${env.protocol}://${env.domain}/wp-admin/</a></td></tr><tr><td>Login:</td><td><b>admin</b></td></tr><tr><td>Password:</td><td><b>${globals.ADMIN_PASSWD}</b></td></tr></table></br>To
add custom domain name for your WordPress installation follow the steps described
in our <a href='http://docs.jelastic.com/custom-domains' target='_blank'>documentation</a>