You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 5, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: app/templates/README.mdown
+41-23Lines changed: 41 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,29 +72,51 @@ XML, Binary, and Text data out of the box.
72
72
73
73
## Running with PM2
74
74
75
-
To run you must install pm2 with:
75
+
To run you must first install pm2 if you do not have it with:
76
76
77
77
`npm install pm2 -g`
78
78
79
-
Make sure you have the file `process.json` if it's missing then run:
79
+
It's very **Important** that when deploying to a secure server that you do all pm2 commands as the pm2 user by using:
80
80
81
-
`gulp init-process`
82
-
83
-
This file will also include any config your node layer needs eg. mlHost, mlPort, nodePort, mlPassword etc.
81
+
`sudo su pm2`
84
82
85
83
You can then launch the app using pm2 with:
86
84
87
-
`pm2 startOrRestart process.json`
85
+
`pm2 startOrRestart boot.json`
86
+
87
+
You can also launch the app using different environment configurations in boot.json (env name prefixed with "env_"), for example:
88
+
89
+
`pm2 startOrRestart boot.json --env prod`
90
+
91
+
You can also save your current pm2 deployments with:
88
92
89
-
You can also launch the app using different environment configuration (env name prefixed with "env_") using:
93
+
`pm2 save`
90
94
91
-
`pm2 startOrRestart process.json --env build`
95
+
You should run `pm2 save` whenever you deploy a new app.
92
96
93
97
To view all running pm2 applications use:
94
98
95
99
`pm2 list`
96
100
97
-
And for more information use:
101
+
To view any logs use:
102
+
103
+
`pm2 logs`
104
+
105
+
To monitor ram or cpu usage use:
106
+
107
+
`pm2 monit`
108
+
109
+
**If** you've deployed applications previously but don't see them when you run pm2 list then it might be because you're not logged in as the pm2 user or you deployed them under a different user.
110
+
111
+
If you accidently launch pm2 under your own account then you can kill the process with:
112
+
113
+
`pm2 kill`
114
+
115
+
And if you accidently run that command when logged in as the pm2 user then you can start pm2 and resurrect all processes from the last `pm2 save` with:
116
+
117
+
`pm2 resurrect`
118
+
119
+
For more information use:
98
120
99
121
`pm2 help`
100
122
@@ -104,32 +126,28 @@ To deploy, make sure both your local machine and your remote server/deployment t
104
126
105
127
`npm install pm2 -g`
106
128
107
-
Make sure you have the file `ecosystem.json`if it's missing then run:
129
+
Make sure you have the file `ecosystem.json`with any saved deployment targets inside, to create this file or add a new deployment target run:
108
130
109
-
`gulp init-ecosystem`
131
+
`gulp add-deploy-target`
110
132
111
-
`ecosystem.json` will include any config as well as any deployment config along with your credentials. It is git ignored by default and we recommend you avoid commiting it and instead put any repository appropriate configuration in `process.json`
112
-
113
-
Using the sample target in ecosystem.json as a guide, set up a target to deploy to. Your configuration must have an ssh key, remote server user, git repository potentially with credentials and a valid path that isn't being used.
133
+
`ecosystem.json` will include any config as well as any deployment config along with your credentials. It is git ignored by default and we recommend you avoid commiting it and instead put any repository appropriate configuration in `boot.json`
114
134
115
135
First initialize the target host:
116
136
117
-
`pm2 deploy ecosystem.json TARGETNAME setup`
137
+
`pm2 deploy TARGETNAME setup`
118
138
119
-
Then deploy new code with:
139
+
Then deploy your latest code from your git repository and run any post-deploy commands with:
120
140
121
-
`pm2 deploy ecosystem.json TARGETNAME`
141
+
`pm2 deploy TARGETNAME`
122
142
123
-
**Hint**, If you do not specify `ecosystem.json`pm2 automatically looks for it in your current directory
143
+
**Hint**, pm2 automatically looks `ecosystem.json`in your current directory, but you can use other config files with `pm2 deploy otherEcosystemFile.json TARGETNAME`
124
144
125
-
If you want to deploy without commiting your current code use `--force`:
145
+
If you have files you haven't commited, pm2 will ask you to commit them before deploying, to ignore this use `--force`:
126
146
127
147
`pm2 deploy TARGETNAME --force`
128
148
129
-
You can also run commands on the server with `exec` such as starting the app:
With your application deployed follow the above "Running with PM2" instructions to start the application, once you've started the app it will listen for changes and automatically restart when you make deploy changes with `pm2 deploy TARGETNAME`.
0 commit comments