1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,192 @@ |
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+echo "Please enter the following:" |
|
4 |
+read -p 'First and Last name: ' name |
|
5 |
+read -p 'Callsign: ' callsign |
|
6 |
+read -p "APRS ssid: $callsign-" ssid |
|
7 |
+echo |
|
8 |
+echo "If you need your APRS Passcode you can get it here: https://willamettevalleymesh.net/aprs-passcode/" |
|
9 |
+read -p 'Please enter callsign APRS Passcode: ' aprspasscode |
|
10 |
+read -p 'Your Email Address: ' email |
|
11 |
+ |
|
12 |
+ |
|
13 |
+apt update -y |
|
14 |
+apt upgrade -y |
|
15 |
+ |
|
16 |
+apt install -y sudo build-essential htop nginx libevent* debhelper libssl-dev libcap-dev libz-dev libwww-perl libsctp-dev |
|
17 |
+apt --fix-broken install |
|
18 |
+ |
|
19 |
+adduser --system --no-create-home --home /var/run/aprsc --shell /usr/sbin/nologin --group aprsc |
|
20 |
+ |
|
21 |
+cd |
|
22 |
+wget http://he.fi/aprsc/down/aprsc-latest.tar.gz |
|
23 |
+tar xvfz aprsc-latest.tar.gz |
|
24 |
+rm -rf aprsc-latest.tar.gz |
|
25 |
+cd aprsc-* |
|
26 |
+cd src |
|
27 |
+./configure |
|
28 |
+make make-deb |
|
29 |
+sudo dpkg -i ../aprsc_*.deb |
|
30 |
+ |
|
31 |
+ |
|
32 |
+sudo systemctl enable aprsc |
|
33 |
+ |
|
34 |
+ |
|
35 |
+tee /etc/default/aprsc <<EOF |
|
36 |
+ |
|
37 |
+# |
|
38 |
+# STARTAPRSC: start aprsc on boot. Should be set to "yes" once you have |
|
39 |
+# configured aprsc. |
|
40 |
+# |
|
41 |
+STARTAPRSC="yes" |
|
42 |
+ |
|
43 |
+# |
|
44 |
+# Additional options that are passed to the Daemon. |
|
45 |
+# Description of used options (don't change these unless |
|
46 |
+# you're sure what you're doing): |
|
47 |
+# -u aprsc: switch to user 'aprsc' as soon as possible |
|
48 |
+# -t /opt/aprsc: chroot to the given directory |
|
49 |
+# -f: fork to a daemon |
|
50 |
+# -e info: log at level info |
|
51 |
+# -o file: log to file |
|
52 |
+# -r logs: log files are placed in /opt/aprsc/logs |
|
53 |
+# -c etc/aprsc.conf: configuration file location |
|
54 |
+# |
|
55 |
+# Since the daemon chroots to /opt/aprsc, all paths are relative to |
|
56 |
+# that directory and the daemon cannot access any files outside |
|
57 |
+# the chroot. |
|
58 |
+# |
|
59 |
+# aprsc can log to syslog too, but that'd require bringing the |
|
60 |
+# syslog socket within the chroot. |
|
61 |
+# |
|
62 |
+ |
|
63 |
+DAEMON_OPTS="-u aprsc -t /opt/aprsc -f -e info -o file -r logs -c etc/aprsc.conf" |
|
64 |
+ |
|
65 |
+EOF |
|
66 |
+ |
|
67 |
+echo "ServerId $callsign-$ssid" > /opt/aprsc/etc/aprsc.conf |
|
68 |
+echo "PassCode $aprspasscode" >> /opt/aprsc/etc/aprsc.conf |
|
69 |
+echo "MyAdmin \"$name, $callsign\"" >> /opt/aprsc/etc/aprsc.conf |
|
70 |
+echo "MyEmail $email" >> /opt/aprsc/etc/aprsc.conf |
|
71 |
+ |
|
72 |
+ |
|
73 |
+tee -a /opt/aprsc/etc/aprsc.conf <<EOF |
|
74 |
+ |
|
75 |
+### Directories ######### |
|
76 |
+# Data directory (for persistent state files - currently none) |
|
77 |
+RunDir data |
|
78 |
+ |
|
79 |
+# If logging to a file (-o file), enable built-in log rotation. |
|
80 |
+# LogRotate <megabytes> <filecount> |
|
81 |
+# "LogRotate 10 5" keeps 5 old files of 10 megabytes each. |
|
82 |
+LogRotate 10 5 |
|
83 |
+ |
|
84 |
+### Intervals and timers ######### |
|
85 |
+# Interval specification format examples: |
|
86 |
+# 600 (600 seconds), or 600s, 5m, 2h, 1h30m, 1d3h15m24s, etc... |
|
87 |
+ |
|
88 |
+# When no data is received from an upstream server in N seconds, switch to |
|
89 |
+# another server. |
|
90 |
+UpstreamTimeout 15s |
|
91 |
+ |
|
92 |
+# When no data is received from a downstream server in N seconds, disconnect |
|
93 |
+ClientTimeout 48h |
|
94 |
+ |
|
95 |
+### TCP listener ########## |
|
96 |
+# Listen <socketname> <porttype> tcp <address to bind> <port> <options...> |
|
97 |
+# socketname: any name you wish to show up in logs and statistics |
|
98 |
+# porttype: one of: |
|
99 |
+# fullfeed - everything, after dupe filtering |
|
100 |
+# igate - igate / client port with user-specified filters |
|
101 |
+# udpsubmit - UDP packet submission port (8080) |
|
102 |
+# dupefeed - duplicate packets dropped by the server |
|
103 |
+# options: |
|
104 |
+# filter "m/500" - force a filter for users connected here |
|
105 |
+# maxclients 100 - limit clients connected on this port |
|
106 |
+# acl etc/client.acl - match client addresses against ACL |
|
107 |
+# hidden - don't show the port in the status page |
|
108 |
+# |
|
109 |
+# If you wish to provide UDP service for clients, set up a |
|
110 |
+# second listener on the same address, port and protocol. |
|
111 |
+# |
|
112 |
+# The "::" is IPv6 "IN6ADDR_ANY", whereas "0.0.0.0" is same |
|
113 |
+# with IPv4. |
|
114 |
+# |
|
115 |
+# On FreeBSD you need to have separate listeners for IPv4 and |
|
116 |
+# IPv6. On Linux, just use :: alone - the IPv6 listener will |
|
117 |
+# catch the IPv4 connections just as well. |
|
118 |
+# |
|
119 |
+# Example of normal server ports for Linux, supporting both TCP and UDP, |
|
120 |
+# IPv4 and IPv6: |
|
121 |
+# |
|
122 |
+Listen "Full feed" fullfeed tcp :: 10152 hidden |
|
123 |
+Listen "" fullfeed udp :: 10152 hidden |
|
124 |
+ |
|
125 |
+Listen "Client-Defined Filters" igate tcp :: 14580 |
|
126 |
+Listen "" igate udp :: 14580 |
|
127 |
+ |
|
128 |
+Listen "350 km from my position" igate tcp :: 20350 filter "m/350" |
|
129 |
+Listen "" igate udp :: 20350 filter "m/350" |
|
130 |
+ |
|
131 |
+Listen "UDP submit" udpsubmit udp :: 8080 |
|
132 |
+ |
|
133 |
+### Uplink configuration ######## |
|
134 |
+# Uplink <name> <type> tcp <address> <port> |
|
135 |
+# name: a name of the server or service you're connecting to |
|
136 |
+# type: one of: |
|
137 |
+# full - full feed |
|
138 |
+# ro - read-only, do not transmit anything upstream |
|
139 |
+# |
|
140 |
+# If you wish to specify multiple alternative servers, use multiple |
|
141 |
+# Uplink lines, one for each server. |
|
142 |
+# |
|
143 |
+# Normally a single line for the 'rotate' address is fine - it will connect |
|
144 |
+# to one of the servers in a random fashion and go for another one should |
|
145 |
+# the first one become unavailable. |
|
146 |
+# |
|
147 |
+Uplink "Core rotate" full tcp rotate.aprs.net 10152 |
|
148 |
+#Uplink "Core rotate" ro tcp rotate.aprs.net 10152 |
|
149 |
+ |
|
150 |
+# OPTIONAL: Bind source address before connecting to an uplink |
|
151 |
+# You can enter two addresses, one for IPv4 and one for IPv6 connections. |
|
152 |
+# Needed if you have multiple IP addresses on your server and only one |
|
153 |
+# of them is allowed to connect by the remote server. |
|
154 |
+#UplinkBind 127.0.0.1 |
|
155 |
+#UplinkBind ::1 |
|
156 |
+ |
|
157 |
+### HTTP server ########## |
|
158 |
+# HTTPStatus port provides a status view to web browsers. |
|
159 |
+# IPv6+IPv4 support works slightly differently than in Listen: |
|
160 |
+# :: is "all addresses" for IPv6, 0.0.0.0 for IPv4, but |
|
161 |
+# :: only works if you actually have a global IPv6 address |
|
162 |
+# configured on the system. |
|
163 |
+# The example is for IPv4, change the address to :: if you have |
|
164 |
+# IPv6. For FreeBSD, or if you wish to support multiple specific |
|
165 |
+# ports/addresses, use multiple HTTPStatus directives for each. |
|
166 |
+HTTPStatus 0.0.0.0 14501 |
|
167 |
+# HTTPUpload port allows position uploads over HTTP |
|
168 |
+HTTPUpload 0.0.0.0 8080 |
|
169 |
+ |
|
170 |
+### Environment ############ |
|
171 |
+# When running this server as super-user, the server can (in many systems) |
|
172 |
+# increase several resource limits, and do other things that less privileged |
|
173 |
+# server can not do. |
|
174 |
+# |
|
175 |
+# The FileLimit is resource limit on how many simultaneous connections and |
|
176 |
+# some other internal resources the system can use at the same time. |
|
177 |
+# If the server is not being run as super-user, this setting has no effect |
|
178 |
+# in case it is above what normal user can set. |
|
179 |
+# |
|
180 |
+FileLimit 10000 |
|
181 |
+ |
|
182 |
+### Operator attention span qualification run ########### |
|
183 |
+# After configuring the rest of the settings, remove this bad command |
|
184 |
+# from the configuration file. It's here only to avoid starting the |
|
185 |
+# server up accidentally with an invalid configuration. |
|
186 |
+#MagicBadness 42.7 |
|
187 |
+EOF |
|
188 |
+ |
|
189 |
+sudo systemctl enable aprsc |
|
190 |
+ |
|
191 |
+reboot |
|
192 |
+ |
0 | 193 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,97 @@ |
1 |
+<!DOCTYPE html> |
|
2 |
+<html lang="en"> |
|
3 |
+<head> |
|
4 |
+ <meta charset="UTF-8"> |
|
5 |
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
6 |
+ <title>Welcome to the WVMN Tile Server</title> |
|
7 |
+ <style> |
|
8 |
+ body { |
|
9 |
+ padding-left: 60px; |
|
10 |
+ padding-right: 60px; |
|
11 |
+ } |
|
12 |
+ table { |
|
13 |
+ font-family: Arial, sans-serif; |
|
14 |
+ border-collapse: collapse; |
|
15 |
+ width: 100%; |
|
16 |
+ } |
|
17 |
+ th, td { |
|
18 |
+ border: 1px solid #dddddd; |
|
19 |
+ text-align: left; |
|
20 |
+ padding: 8px; |
|
21 |
+ } |
|
22 |
+ th { |
|
23 |
+ background-color: #009879; |
|
24 |
+ color: #ffffff; |
|
25 |
+ } |
|
26 |
+ tr:nth-child(even) { |
|
27 |
+ background-color: #f2f2f2; |
|
28 |
+ } |
|
29 |
+ </style> |
|
30 |
+</head> |
|
31 |
+<body> |
|
32 |
+ |
|
33 |
+<h1>Welcome to the WVMN Tile Server</h1> |
|
34 |
+<h2>This tile server has the following tile sets:</h2> |
|
35 |
+ |
|
36 |
+<table> |
|
37 |
+ <tr> |
|
38 |
+ <th>Map System</th> |
|
39 |
+ <th>URL</th> |
|
40 |
+ </tr> |
|
41 |
+ <tr> |
|
42 |
+ <td>OpenStreetMap (OSM)</td> |
|
43 |
+ <td><b>//10.131.18.18/osm/tiles/{z}/{x}/{y}</b></td> |
|
44 |
+ </tr> |
|
45 |
+ <tr> |
|
46 |
+ <td>Satellite</td> |
|
47 |
+ <td><b>//10.131.18.18/satellite/tiles/{z}/{x}/{y}</b></td> |
|
48 |
+ </tr> |
|
49 |
+ <tr> |
|
50 |
+ <td>Weather Radar (Nexrad) (WMS Layer Format)</td> |
|
51 |
+ <td><b>//10.131.18.18/nexrad/</b></td> |
|
52 |
+ </tr> |
|
53 |
+</table> |
|
54 |
+ |
|
55 |
+<br /> |
|
56 |
+ |
|
57 |
+<h2>Cache Status:</h2> |
|
58 |
+ |
|
59 |
+<table> |
|
60 |
+ <tr> |
|
61 |
+ <th>Map System</th> |
|
62 |
+ <th>Objects</th> |
|
63 |
+ <th>Cache Size</th> |
|
64 |
+ </tr> |
|
65 |
+ |
|
66 |
+<?php |
|
67 |
+function countFiles($dir) { |
|
68 |
+ $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)); |
|
69 |
+ $count = 0; |
|
70 |
+ foreach ($iterator as $file) { |
|
71 |
+ if ($file->isFile()) { |
|
72 |
+ $count++; |
|
73 |
+ } |
|
74 |
+ } |
|
75 |
+ return $count; |
|
76 |
+} |
|
77 |
+ |
|
78 |
+$cache = explode("\n", shell_exec("du -hs /tmp/maps*")); |
|
79 |
+array_pop($cache); |
|
80 |
+ |
|
81 |
+foreach ($cache as &$value) { |
|
82 |
+ $data = explode(" ", $value); |
|
83 |
+ echo "<tr><td>".str_replace("/tmp/maps-", "", $data[1])."</td><td>".countFiles($data[1])."</td><td>".$data[0]."</td></tr>"; |
|
84 |
+} |
|
85 |
+?> |
|
86 |
+</table> |
|
87 |
+ |
|
88 |
+<br /><br /> |
|
89 |
+ |
|
90 |
+<h2>For questions about this system contact:</h2> |
|
91 |
+<b>N:</b> Richard Cornwell<br /> |
|
92 |
+<b>C:</b> K9RCP <br /> |
|
93 |
+<b>E:</b> k9rcp@techtoknow.net<br /> |
|
94 |
+<b>P:</b> 4048551727<br /> |
|
95 |
+ |
|
96 |
+</body> |
|
97 |
+</html> |
0 | 98 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,71 @@ |
1 |
+user www-data; |
|
2 |
+worker_processes auto; |
|
3 |
+pid /run/nginx.pid; |
|
4 |
+include /etc/nginx/modules-enabled/*.conf; |
|
5 |
+ |
|
6 |
+events { |
|
7 |
+ worker_connections 768; |
|
8 |
+ # multi_accept on; |
|
9 |
+} |
|
10 |
+ |
|
11 |
+http { |
|
12 |
+ proxy_cache_path /tmp/maps-osm/ levels=1:2 keys_zone=osm_cache:100m max_size=10g inactive=60d; |
|
13 |
+ proxy_cache_path /tmp/maps-satellite/ levels=1:2 keys_zone=satellite_cache:100m max_size=9g inactive=90d; |
|
14 |
+ proxy_cache_path /tmp/maps-nexrad/ levels=1:2 keys_zone=nexrad_cache:10m max_size=1g inactive=1h; |
|
15 |
+ |
|
16 |
+ server { |
|
17 |
+ listen 80; |
|
18 |
+ server_name _; |
|
19 |
+ |
|
20 |
+ location ~ ^/osm/tiles/ { |
|
21 |
+ rewrite ^/osm/tiles/(.*)$ /styles/v1/mapbox/streets-v11/tiles/$1?access_token=MAPBOX-ACCESS-TOKEN-HERE break; |
|
22 |
+ proxy_ssl_server_name on; |
|
23 |
+ proxy_pass https://api.mapbox.com; |
|
24 |
+ proxy_cache osm_cache; |
|
25 |
+ proxy_cache_valid 200 302 304 30d; |
|
26 |
+ proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; |
|
27 |
+ proxy_cache_background_update on; |
|
28 |
+ add_header X-Proxy-Cache $upstream_cache_status; |
|
29 |
+ expires 30d; |
|
30 |
+ } |
|
31 |
+ |
|
32 |
+ location ~ ^/satellite/tiles/ { |
|
33 |
+ rewrite ^/satellite/tiles/(.*)$ /styles/v1/mapbox/satellite-v9/tiles/$1?access_token=MAPBOX-ACCESS-TOKEN-HERE break; |
|
34 |
+ proxy_ssl_server_name on; |
|
35 |
+ proxy_pass https://api.mapbox.com; |
|
36 |
+ proxy_cache satellite_cache; |
|
37 |
+ proxy_cache_valid 200 302 304 90d; |
|
38 |
+ proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; |
|
39 |
+ proxy_cache_background_update on; |
|
40 |
+ add_header X-Proxy-Cache $upstream_cache_status; |
|
41 |
+ expires 30d; |
|
42 |
+ } |
|
43 |
+ |
|
44 |
+ location ~ ^/nexrad/ { |
|
45 |
+ rewrite ^/nexrad/(.*)$ /cgi-bin/wms/nexrad/n0q.cgi$is_args$args break; |
|
46 |
+ proxy_ssl_server_name on; |
|
47 |
+ proxy_pass http://mesonet.agron.iastate.edu; |
|
48 |
+ proxy_cache nexrad_cache; |
|
49 |
+ proxy_cache_valid 200 302 304 5m; |
|
50 |
+ proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; |
|
51 |
+ proxy_cache_background_update on; |
|
52 |
+ add_header X-Proxy-Cache $upstream_cache_status; |
|
53 |
+ expires 30d; |
|
54 |
+ } |
|
55 |
+ |
|
56 |
+ location / { |
|
57 |
+ root /var/www/; |
|
58 |
+ index index.html index.php; |
|
59 |
+ |
|
60 |
+ error_page 404 = /index.php; |
|
61 |
+ try_files $uri $uri/ index.php =404; |
|
62 |
+ |
|
63 |
+ location ~ \.php$ { |
|
64 |
+ include /etc/nginx/fastcgi_params; |
|
65 |
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
|
66 |
+ fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; |
|
67 |
+ } |
|
68 |
+ } |
|
69 |
+ } |
|
70 |
+} |
|
71 |
+ |