-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathecosystem.json
68 lines (68 loc) · 2.77 KB
/
ecosystem.json
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
{
// Applications part
"apps": [{
"name": "API",
"script": "app.js",
"env": {
"COMMON_VARIABLE": "true"
},
// Environment variables injected when starting with --env production
// http://pm2.keymetrics.io/docs/usage/application-declaration/#switching-to-different-environments
"env_production": {
"NODE_ENV": "production"
}
}, {
"name": "WEB",
"script": "web.js"
}],
// Deployment part
// Here you describe each environment
"deploy": {
"production": {
"user": "node",
// Multi host is possible, just by passing IPs/hostname as an array
"host": ["212.83.163.1", "212.83.163.2", "212.83.163.3"],
// Branch
"ref": "origin/master",
// Git repository to clone
"repo": "[email protected]:repo.git",
// Path of the application on target servers
"path": "/var/www/production",
// Can be used to give options in the format used in the configura-
// tion file. This is useful for specifying options for which there
// is no separate command-line flag, see 'man ssh'
// can be either a single string or an array of strings
"ssh_options": "StrictHostKeyChecking=no",
// To prepare the host by installing required software (eg: git)
// even before the setup process starts
// can be multiple commands separated by the character ";"
// or path to a script on your local machine
"pre-setup": "apt-get install git",
// Commands / path to a script on the host machine
// This will be executed on the host after cloning the repository
// eg: placing configurations in the shared dir etc
"post-setup": "ls -la",
// Commands to execute locally (on the same machine you deploy things)
// Can be multiple commands separated by the character ";"
"pre-deploy-local": "echo 'This is a local executed command'"
// Commands to be executed on the server after the repo has been cloned
"post-deploy": "npm install && pm2 startOrRestart ecosystem.json --env production"
// Environment variables that must be injected in all applications on this env
"env": {
"NODE_ENV": "production"
}
},
"staging": {
"user": "node",
"host": "212.83.163.1",
"ref": "origin/master",
"repo": "[email protected]:repo.git",
"path": "/var/www/development",
"ssh_options": ["StrictHostKeyChecking=no", "PasswordAuthentication=no"],
"post-deploy": "pm2 startOrRestart ecosystem.json --env dev",
"env": {
"NODE_ENV": "staging"
}
}
}
}