mostly t11 fixes
[distro-setup] / disabled / pump.io
1 ########## begin pump.io setup ##########
2
3 # once pump adds a logrotation script, turn off nologger,
4 # and add
5 # "logfile": "/var/log/pumpio/pumpio.log",
6 #
7 s dd of=/etc/pump.io.json <<'EOF'
8 {
9 "secret": "SECRET_REPLACE_ME",
10 "driver": "mongodb",
11 "params": { "dbname": "pumpio" },
12 "noweb": false,
13 "site": "pump.iankelling.org",
14 "owner": "Ian Kelling",
15 "ownerURL": "https://iankelling.org/",
16 "port": 8001,
17 "urlPort": 443,
18 "hostname": "pump.iankelling.org",
19 "nologger": true,
20 "datadir": "/home/pumpio/pumpdata",
21 "enableUploads": true,
22 "debugClient": false,
23 "disableRegistration": true,
24 "noCDN": true,
25 "key": "/home/pumpio/privkey.pem",
26 "cert": "/home/pumpio/fullchain.pem",
27 "address": "localhost",
28 "sockjs": false
29 }
30 EOF
31 s sed -i "s#SECRET_REPLACE_ME#$(cat /p/c/machine_specific/li/pump-secret)#" /etc/pump.io.json
32
33 # stretch node is too old
34 # https://nodejs.org/en/download/package-manager/
35 curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
36 pi nodejs graphicsmagick mongodb
37 cd /home/iank
38 if [[ -e pump.io ]]; then
39 cd pump.io
40 git pull
41 else
42 git clone https://github.com/pump-io/pump.io.git
43 cd pump.io
44 fi
45 # note: these 2 commands seem
46 # note: doing this or the npm install pump.io as root had problems.
47 npm install
48 npm run build
49 # normally, next command would be
50 # s npm install -g odb
51 # but it\'s this until a bug in pump gets fixed
52 # https://github.com/pump-io/pump.io/issues/1287
53 s npm install -g databank-mongodb@0.19.2
54 if ! getent passwd pumpio &>/dev/null; then
55 s useradd -Um -s /bin/false pumpio
56 fi
57 sudo -u pumpio mkdir -p /home/pumpio/pumpdata
58 # for testing browser when only listening to localhost,
59 # in the pump.io.json, set hostname localhost, urlPort 5233
60 #ssh -L 5233:localhost:5233 li
61
62 s mkdir -p /var/log/pumpio/
63 s chown pumpio:pumpio /var/log/pumpio/
64
65 web-conf - apache2 pump.iankelling.org <<'EOF'
66 # currently a bug in pump that we cant terminate ssl
67 SSLProxyEngine On
68 ProxyPreserveHost On
69 ProxyPass / https://127.0.0.1:8001/
70 ProxyPassReverse / https://127.0.0.1:8001/
71 # i have sockjs disabled per people suggesting that
72 # it won\'t work with apache right now.
73 # not sure if it would work with this,
74 # but afaik, this is pointless atm.
75 <Location /main/realtime/sockjs/>
76 ProxyPass wss://127.0.0.1:8001/main/realtime/sockjs/
77 ProxyPassReverse wss://127.0.0.1:8001/main/realtime/sockjs/
78 </Location>
79 EOF
80
81 sudo -i <<'EOF'
82 export RENEWED_LINEAGE=/etc/letsencrypt/live/pump.iankelling.org
83 /a/bin/distro-setup/certbot-renew-hook
84 EOF
85
86 s dd of=/etc/systemd/system/pump.service <<'EOF'
87 [Unit]
88 Description=pump.io
89 After=syslog.target network.target mongodb.service
90 Requires=mongodb.service
91
92 [Service]
93 Type=simple
94 User=pumpio
95 Group=pumpio
96 ExecStart=/home/iank/pump.io/bin/pump
97 Environment=NODE_ENV=production
98 # failed to find databank-mongodb without this.
99 # I just looked at my environment variables took a guess.
100 Environment=NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
101
102 [Install]
103 WantedBy=multi-user.target
104 EOF
105 ser daemon-reload
106 sgo pump
107 ########## end pump.io setup ############