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/INSTALL.mdown
+80-2Lines changed: 80 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
#Deploying to a server
1
+
#Deploying to a server
2
2
3
3
To deploy, make sure both your local machine and your remote server/deployment target have pm2 installed with:
4
4
@@ -8,6 +8,8 @@ Make sure you have the file `ecosystem.json` with any saved deployment targets i
8
8
9
9
`gulp add-deploy-target`
10
10
11
+
**Note:** This command may not work on older projects! If it's not available you will need to modify the `ecosystem.json` file manually.
12
+
11
13
`ecosystem.json` will include any config as well as any deployment config along with your credentials. If you need to put in any credentials or sensitive information that can't be in the repository then answer the final question from `gulp add-deploy-target` with a yes and it will put the deployment config into `local.ecosystem.json`.
12
14
13
15
Once you've got your TARGETNAME (answer to the first question in `gulp add-deploy-target`) you can initialize the target host with:
@@ -50,7 +52,27 @@ Running `pm2 save` whenever you deploy a new app is very important as in the eve
50
52
51
53
Now that the app is started you will not have to stop or restart it when making updates. pm2 will automatically restart the app if any of it's files are changed so you can do `pm2 deploy TARGETNAME --force` from your local machine and the pm2 will automatically restart the app with any changes!
52
54
53
-
#Administration
55
+
## Initializing httpd
56
+
57
+
Next to this, you likely want to enable the httpd daemon. Often only very limited ports are exposed on servers, and we usually deliberately configure the application outside that scope. Add a forwarding rule for the appropriate dns:
58
+
59
+
- sudo chkconfig --levels 2345 httpd on
60
+
- sudo service httpd stop
61
+
- sudo vi /etc/httpd/conf/httpd.conf, uncomment the line with:
@@ -80,3 +102,59 @@ For more information use the help commands or consult the documentation [here](h
80
102
81
103
`pm2 deploy help`
82
104
105
+
## Converting an existing project
106
+
107
+
If you've previously deployed an application using linux server scripts then you will need to remove the scripts and the old deployment.
108
+
109
+
To minimize application downtime, you should configure and deploy the project using pm2 before removing the old deployment.
110
+
111
+
When converting a project to pm2 you should create an `ecosystem.json` file with your desired deployment config and commit it into the project, follow the above instructions and deploy it to your target server. pm2 will deploy the project to `/space/projects/{appname}/source`. **Don't** run `pm2 startOrRestart ecosystem.json` yet though!
112
+
113
+
Now once you've almost finished deploying with pm2 you will need to stop it with the service scripts:
114
+
115
+
`service stop {appname}`
116
+
117
+
If you have a {appname}-watch script then stop that as well:
118
+
119
+
`service stop {appname}-watch`
120
+
121
+
You should now be able to run `pm2 startOrRestart ecosystem.json`
122
+
123
+
Now that the project is deployed and assuming it's running okay you will need to clean up the old deployment.
124
+
125
+
Firstly, remove the chkconfig
126
+
127
+
`chkconfig -del {appname}`
128
+
129
+
And also for the watch script if appropriate
130
+
131
+
`chkconfig -del {appname}-watch`
132
+
133
+
Then delete the scripts
134
+
135
+
`rm /etc/init.d/{appname}`
136
+
137
+
`rm /etc/{appname}`
138
+
139
+
And for the watch script:
140
+
141
+
`rm /etc/init.d/{appname}-watch`
142
+
143
+
Older projects were typically deployed using a .git .live folder structure, since we no longer need these you can delete them:
144
+
145
+
`rm -r /space/projects/{appname}.git`
146
+
147
+
`rm -r /space/projects/{appname}.live]`
148
+
149
+
Finally delete the git remote that pointed to the .git folder from your laptop:
150
+
151
+
cd to your project directory and run:
152
+
153
+
`git remote rm {DeploymentName}`
154
+
155
+
You can then finish off by deleting the old etc folder from the project folder as the scripts and documentation inside should no longer be needed:
156
+
157
+
`rm -r ./etc`
158
+
159
+
You should also copy THIS Install guide to your projects repository for the benefit of other users.
0 commit comments