Browse Source

added some more useful information.

master
Jared Dunbar 3 years ago
parent
commit
7abf0d766d
Signed by untrusted user: jared GPG Key ID: CF202CC859BAC692
  1. 92
      dubsdot.md

92
dubsdot.md

@ -53,7 +53,7 @@ There are a few different ways that you can configure your service on Dubsdot
**Use this configuration if you are only serving static files.**
To configure your static website with no backend, clone your website to `/var/www/<myapp`, as seen above. For example, while in the `/var/www` folder, run:
To configure your static website with no backend, clone your website to `/var/www/<myapp>`, as seen above. For example, while in the `/var/www` folder, run:
```bash
git clone https://github.com/<username>/<myapp>.git
@ -130,11 +130,97 @@ If your service brings down the apache server, please disable your site.
**TODO**
### Alternative backend server or other complex configuration
### Alternative backend server
**Use this configuration if you are using Flask or a custom socket server.**
**TODO**
To configure your static website with a TCP socket backend, clone your website to `/var/www/<myapp>`, as seen above, and your application code to `/opt/<myapp>`. For example, while in the `/var/www` folder, run:
```bash
git clone https://github.com/<username>/<myapp>.git
```
and it will clone your app to `/var/www/myapp`.
Once you finish all of that, become root on the system, and run the following:
```
cd /etc/apache2/sites-available
```
Create a new file called `<myapp>.conf` in this folder.
```
vim <myapp>.conf
```
Inside that, add some content like this:
```
# Service: myapp
<VirtualHost *:80>
ServerName myapp.cslabs.clarkson.edu
ServerAlias myapp.cosi.clarkson.edu
ServerAlias myapp
DocumentRoot "/var/www/myapp
ProxyPreserveHost on
ProxyPass /api http://localhost:99999
ProxyPassReverse /api http://localhost:99999
</VirtualHost>
```
Here's the explanation of the various parts of the above configuration:
* `VirtualHost *:80`: Listen on port 80 on any IP(v4?) address
* `DocumentRoot "/var/www/myapp"`: Set the document location root to `/vrestore the file from a backup.ar/www/myapp`. Say that you have a file called `index.html` at `/var/www/myapp/index.html`, with the value set here, you will find your `index.html` at `http://myapp.cslabs.clarkson.edu/index.html`
* `ServerName myapp.cslabs.clarkson.edu`: Sets the default server name to listen for when specified by your browser from DNS with the `Host:` HTTP field.
* `ServerAlias myapp.cosi.clarkson.edu`: Additional server names to listen for on the website, if they mach, you will get directed here the same way as with `ServerName`. This field is optional, `ServerName` is not.
* `ProxyPreserveHost on`: Preserve hostname in queries while passing to socket.
* `ProxyPass /api http://loclahost:99999`: Pass the `/api` url (and all below it) to the proxy specified
* `ProxyPassReverse /api http://localhost:99999`: erm. It's important!
Of these, the first and last opening/closing `VirtualHost`, `DocumentRoot`, and `ServerName` are required entries.
**ALLWAYS** have the configuration contained within the `VirtualHost` tags. **DO NOT** put options outside of these! It **WILL** negatively affect other services.
After you have created your file, feel free to run the following as root (they will fail to auto-complete if you are not a root shell because stupid):
Enable the website:
```
a2ensite myapp
```
Test the configuration:
```
apachectl configtest
```
If it fails, run the following so that if the server is rebooted for other reasons, that it doesn't crash the server:
```
a2dissite myapp
```
Once you feel confident with the configuration file you have specified, feel free to run the following:
```
systemctl restart apache2
```
If your service brings down the apache server, please disable your site.
Please note that you will also need to make a systemd service to run your socket application, and that it is highly discouraged to run it in tmux or otherwise.
**TODO:** Add systemd instructions here for a new service.
**TODO:** Add information about using Unix sockets with Flask apps.
## Control Access

Loading…
Cancel
Save