Skip to content

Commit af913de

Browse files
authored
Merge pull request #41 from Local-Connectivity-Lab/operating-procedure
Documenting operating procedure
2 parents 48268f4 + 4096140 commit af913de

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

README.md

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,108 @@ Visualizations of coverage and performance analysis for Community Cellular Netwo
44

55
Now hosted on https://coverage.seattlecommunitynetwork.org/
66

7-
# Testing & Deployment
7+
8+
## Initial Setup
9+
To install this service, the fist time, you will need to:
10+
11+
1. Required tools and versions:
12+
1. Install `node` and `npm` according to the directions at https://nodejs.org/en/download/package-manager
13+
2. Install `pm2` using: `npm install pm2 -g` (as per https://www.npmjs.com/package/pm2#installing-pm2)
14+
2. Clone the service: `https://github.com/Local-Connectivity-Lab/ccn-coverage-vis`
15+
2. Configure:
16+
1. `cd cd ccn-coverage-vis`
17+
1. Edit `src/utils/config.ts` and set the correct URL for your API host (if you're testing or you're deploying to a new URL).
18+
4. Deploy as below.
19+
5. When starting the ccn-coverage-vis service the first time, use:
20+
```
21+
pm2 start --name "Vis Server" npm -- run start
22+
```
23+
This will register ccn-coverage-vis with [PM2](https://pm2.keymetrics.io/docs/usage/quick-start/).
24+
25+
26+
## Deploying
27+
Once the service has been setup (as above), it can be deployed using the following process:
28+
1. Login to the coverage-host
29+
2. Pull the lastest version from github
30+
3. Restart the service
31+
32+
The shell commands are:
33+
```
34+
ssh coverage-host
35+
cd ccn-coverage-vis
36+
git pull
37+
npm install
38+
npm run build
39+
pm2 restart Vis Server
40+
```
41+
42+
## Troubleshooting & Recovery
43+
When a problem occurs, there are several checks to determine where the failure is:
44+
1. Check HTTP errors in the browser
45+
1. Login to the coverage-host
46+
2. Confirm ccn-coverage-vis is operating as expected
47+
3. Confirm nginx is operating as expected
48+
49+
### Checking HTTP errors in the browser
50+
First, open your browser and go to: https://coverage.seattlecommunitynetwork.org/
51+
52+
Is it working?
53+
54+
If not, open up the browser **Web Developer Tools**, usually under the menu Tools > Developer Tools > Web Developer Tools.
55+
56+
With this panel open at the bottom of the screen select the **Network** tab and refresh the browser page.
57+
58+
Look in the first column, Status:
59+
* `200`: OK, everything is good.
60+
* `502`: Error with the backend services (behind nginx)
61+
* `500` errors: problem with nxginx. Look in `/var/log/nginx/error.log` for details.
62+
* `400` errors: problem with the service. Check the service logs and nginx logs.
63+
* Timeout or unreachable error: Something is broken in the network between your web browser and the coverage-vis host.
64+
65+
66+
### Checking ccn-coverage-vis with pm2
67+
Next, confirm ccn-coverage-vis is operating as expected. To do this, you will need to be able to log into the server hosting the coverage service.
68+
69+
Use `pm2 list` to confirm the "Vis Server" is **online**
70+
```
71+
ssh coverage-host
72+
pm2 list
73+
```
74+
![Online services under PM2](pm2-running-services.png "Online services under PM2")
75+
76+
If the "Vis Server" is not online as expected, restart it with:
77+
```
78+
pm2 restart Vis Server
79+
```
80+
81+
82+
### Checking nginx
83+
If there appear problems with nginx, then check that the
84+
85+
Check service operation:
86+
```
87+
systemctl status nginx
88+
```
89+
90+
Check nginx logs:
91+
```
92+
sudo tail /var/log/nginx/error.log
93+
```
94+
95+
Sources of errors might include nginx configuration in `/etc/nginx/conf.d/01-ccn-coverage.conf`
96+
97+
If you need to restart nginx, use:
98+
```
99+
sudo systemctl restart nginx
100+
```
101+
102+
### Clean Recovery
103+
If nothing else works, the last option is a clean reinstall of the service. The process is:
104+
* Remove the `ccn-coverage-vis` directory.
105+
* Re-install as per **Initial Setup**.
106+
107+
108+
## Testing
8109
9110
Changes to the main branch are automically built and deployed to: https://seattlecommunitynetwork.org/ccn-coverage-vis/
10111

pm2-running-services.png

17.5 KB
Loading

0 commit comments

Comments
 (0)