15 | | The init script is handled by runit and is located in /etc/sv/ethercalc. |
| 15 | The init script is handled by runit and is located in /etc/sv/ethercalc. The run file is: |
| 16 | |
| 17 | {{{ |
| 18 | #!/bin/bash |
| 19 | |
| 20 | exec 2>&1 |
| 21 | exec chpst -e ./env -u calc:calc /usr/bin/nodejs /home/calc/node_modules/ethercalc/bin/ethercalc --keyfile /home/calc/keys/calc.mayfirst.org.key --certfile /home/calc/keys/calc.mayfirst.org.crt --basepath https://calc.mayfirst.org:8000 |
| 22 | }}} |
| 23 | |
| 24 | And in the env directory, there is a file called NODE_ENV with the contents: production |
| 25 | |
| 26 | We running apache which passed through traffic to ethercalc. The apache file (in site-enabled) has the following content: |
| 27 | |
| 28 | {{{ |
| 29 | <VirtualHost 209.234.253.233:443> |
| 30 | # web config for calc.mayfirst.org |
| 31 | ServerName calc.mayfirst.org |
| 32 | # ServerAlias www.calc.mayfirst.org |
| 33 | |
| 34 | <Proxy *> |
| 35 | Order deny,allow |
| 36 | Allow from all |
| 37 | </Proxy> |
| 38 | |
| 39 | #SSL Stuff |
| 40 | SSLEngine On |
| 41 | SSLProxyEngine On |
| 42 | SSLCertificateFile /home/calc/keys/calc.mayfirst.org.apache.crt |
| 43 | SSLCertificateKeyFile /home/calc/keys/calc.mayfirst.org.key |
| 44 | SSLCertificateChainFile /home/calc/keys/calc.mayfirst.org.apache.intermediate.crt |
| 45 | |
| 46 | ProxyPreserveHost On |
| 47 | ProxyRequests off |
| 48 | ProxyPass / https://calc.mayfirst.org:8000/ |
| 49 | ProxyPassReverse / https://calc.mayfirst.org:8000/ |
| 50 | </VirtualHost> |
| 51 | }}} |