-
Notifications
You must be signed in to change notification settings - Fork 13
/
manifest.jps
131 lines (118 loc) · 5.67 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
type: install
id: odoo-ce
version: 1.7
name: Odoo Community Edition
homepage: http:///www.odoo.com/
baseUrl: https://raw.githubusercontent.com/jelastic-jps/odoo/master
logo: /images/odoo-logo.png
globals:
db_user: odoo-${fn.random(1000)}
db_pswd: ${fn.password}
master_pswd: ${fn.password}
odoo_config: /etc/odoo/odoo.conf
openerp_config: /etc/odoo/openerp-server.conf
targetRegions:
type: [ vz.*, pcs.* ]
categories:
- apps/cms
- apps/popular
- apps/content-management
onBeforeInit: |
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
var client = new HttpClient(),
getMethod,
response,
status,
resp,
url;
url = "https://registry.hub.docker.com/v2/repositories/library/odoo/tags";
getMethod = new GetMethod(url);
status = client.executeMethod(getMethod);
resp = getMethod.getResponseBodyAsString();
resp = JSON.parse(resp);
tags = resp.results;
var ver = {};
var def = 13;
var tag;
for (var i = 0, n = tags.length; i < n; i++) {
tag = parseFloat(tags[i].name);
if (!isNaN(tag) && tag > 10 && tag < 18) {
ver[tags[i].name] = String(tags[i].name);
if (tag >= def) def = tags[i].name;
}
}
return {
result:0,
settings: {
fields: [{
name: "version",
caption: "Odoo Version",
type: "list",
values: ver,
"default": def
}]
}
};
onAfterBindSSL:
if (nodes.bl && ${settings.version} > 15):
cmd[bl]: |-
sed -i "s|location / {|location /websocket {\n proxy_redirect off;\n proxy_pass http://odoochat;\n proxy_set_header Upgrade \$http_upgrade;\n proxy_set_header Connection \$connection_upgrade;\n proxy_set_header X-Forwarded-Host \$host;\n proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto \$scheme;\n proxy_set_header X-Real-IP \$remote_addr; \n }\nlocation / {|g" /etc/nginx/conf.d/ssl.conf
sed -i "1s|^|upstream odoo {\n server ${nodes.cp[0].address}:8069;\n}\nupstream odoochat {\n server ${nodes.cp[0].address}:8072;\n}\nmap \$http_upgrade \$connection_upgrade {\n default upgrade;\n '' close;\n}\n # http -> https\nserver {\n listen 80; \n server_name ${env.domain};\n rewrite ^(.*) https://\$host\$1 permanent;\n}\n|" /etc/nginx/conf.d/ssl.conf
sed -i "s|proxy_pass http://\$upstream_name;|proxy_pass http://\$upstream_name;\n proxy_set_header X-Forwarded-Host \$host;|g" /etc/nginx/conf.d/ssl.conf
service nginx restart
user: root
description:
text: Odoo is an all-in-one business management software to run a company (ERP, CMS, CRM application, e-Commerce backend, etc).
With 10.000+ apps in, Odoo covers all your business needs in a one-stop solution and provides top notch usability that scales across all apps.
short: Odoo is an all-in-one business software (ERP, CMS, CRM application, e-Commerce backend, etc).
ssl: true
skipNodeEmails: true
nodes:
- nodeType: nginx
displayName: Balancer
cloudlets: 16
nodeGroup: bl
- image: odoo:${settings.version}
displayName: App Server
cloudlets: 16
nodeGroup: cp
links: sqldb:db
startServiceOnCreation: false
env:
JELASTIC_EXPOSE: 8069
POSTGRES_USER: ${globals.db_user}
POSTGRES_PASSWORD: ${globals.db_pswd}
POSTGRES_DB: postgres
- image: postgres:13.5
cloudlets: 16
nodeGroup: sqldb
displayName: Postgres DB
env:
POSTGRES_USER: ${globals.db_user}
POSTGRES_PASSWORD: ${globals.db_pswd}
POSTGRES_DB: postgres
onInstall:
- if ('${env.protocol}' == 'https'):
cmd[bl]: |-
CONF_FILE="/etc/nginx/nginx-jelastic.conf"
sed -i ':a;$!{N;ba};s/\(location \/ {\)/\1\n\n\t\t\t\t\t\tif ($http_x_forwarded_proto = http) {\n\t\t\t\t\t\t\t\treturn 302 https:\/\/$host$request_uri;\n\t\t\t\t\t\t\t\terror_page 500 502 503 504 = @rescue;\n\t\t\t\t\t\t}\n/1' $CONF_FILE
sed -i 's|location = /50x.html {| location /websocket {\n proxy_redirect off;\n proxy_pass http://${nodes.cp[0].address}:8072;\n }\n location = /50x.html {|g' $CONF_FILE
sed -i 's|proxy_connect_timeout 5s;|proxy_connect_timeout 5s;\n proxy_set_header X-NginX-Proxy true;\n proxy_set_header X-Forwarded-Proto https;\n proxy_set_header X-Forwarded-Host $host;|g' $CONF_FILE
service nginx restart
user: root
- cmd[cp]: |-
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -m comment --comment "Jelastic HTTP Autoredirect" -j REDIRECT --to-ports 8069
iptables-save > /etc/iptables/rules.v4
sudo sed -i s/"; admin_passwd.*"/"admin_passwd = ${globals.master_pswd}"/g ${globals.odoo_config} | tee -a ${globals.openerp_config}
echo "db_host = $DB_HOST" | tee -a ${globals.odoo_config} | tee -a ${globals.openerp_config}
echo "db_port = $DB_PORT" | tee -a ${globals.odoo_config} | tee -a ${globals.openerp_config}
echo "db_password = $DB_POSTGRES_PASSWORD" | tee -a ${globals.odoo_config} | tee -a ${globals.openerp_config}
echo "db_user = $DB_POSTGRES_USER" | tee -a ${globals.odoo_config} | tee -a ${globals.openerp_config}
echo "proxy_mode = True" | tee -a ${globals.odoo_config} | tee -a ${globals.openerp_config}
echo "workers = $(($(grep -c ^processor /proc/cpuinfo)*2))" | tee -a ${globals.odoo_config} | tee -a ${globals.openerp_config}
echo "max_cron_threads = 1" | tee -a ${globals.odoo_config} | tee -a ${globals.openerp_config}
/etc/init.d/odoo restart
success: |-
Please open [${env.url}](${env.url}) and complete the installation.
**Master Password:** ${globals.master_pswd}