-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.txt
81 lines (54 loc) · 2.82 KB
/
deploy.txt
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
This is a project marshall62/testauth on GitHub
To release a new version:
------------------------
push to github
To put it on rose go to /mnt/net/nodejs/testauth
sudo git pull
pm2 restart testauth
If errors happen and need to debug on rose:
cd to the testauth dir and run
node bin/testauth
Should now see it running without pm2.
Note: express-session is a module that needs to be installed directly on the server (not just read from
the package.json).
sudo npm install express-session
How it's installed and running on Rose:
1. Edit the httpd.conf file and make sure the modules for mod_proxy_http.so and mod_proxy.so are loaded
2. Set up a proxy as in 0rose.conf for testauth that forwards requests to port 3000 which is where the node express app is running.
<VirtualHost *:80>
ProxyPreserveHost On
<Location /testauth>
ProxyPass http://localhost:3000
ProxyPassReverse http://localhost:3000
</Location>
</VirtualHost>
app location: /mnt/net/nodejs/testauth
to run: cd to bin dir of above and run the testauth script as:
node testauth&
Test: http://rose.cs.umass.edu/testauth/tests
This will not stay up and running if there are crashes or reboots.
Install the PM2 process manager (as in this doc https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-centos-7)
More complete documentation here: http://pm2.keymetrics.io/docs/usage/quick-start/
sudo npm install pm2@latest -g
Add testauth to PM2's process list:
pm2 start testauth
OR
pm2 start testauth -- -c /testauth // The necessary args to pass in to testauth.bin
In the above command line we need to pass args so that URLs are constructed correctly on rose. Apache forwards
to node when requests come in on the /testauth path. So we pass the context
to the testauth program so that it knows it rather than trying to take apart URLs. No longer necessary as described below!
1/17: I've now got a config.js file that can be edited on the server so that it has different settings than
my development environment. This file has the config options for connecting to the db and password authentication server, etc.
It also has config.pageContext which can then be used instead of the program argument (-c /testauth) .
Set up pm2 to restart if the system reboots
sudo pm2 startup centos (for 6.8 centos which is what I have)
sudo pm2 startup systemd (for centos 7 which I don't have yet)
-- Note after reboot of rose I found that pm2 was not running the testauth process and that I needed to manually
-- start it and save it again.
pm2 save (to save these processes for restart on reboot)
PM2 commands (best seen when puTTY in with non-X terminal)
pm2 list : shows all processes
pm2 stop testauth
pm2 start testauth
pm2 restart testauth
pm2 info testauth