voicegardens/README.md

155 lines
4.0 KiB
Markdown
Raw Normal View History

2019-12-21 12:49:53 +01:00
# voicegardens
2020-02-11 16:38:29 +01:00
> An online landscape, built as a tool to explore the many aspects of the human voice.
2020-02-11 16:38:06 +01:00
- [voicegardens](#voicegardens)
- [Interwebz](#interwebz)
- [Hackity Hack Hack](#hackity-hack-hack)
- [Deploying](#deploying)
- [Layers of the Onion](#layers-of-the-onion)
- [License](#license)
2020-02-11 16:37:24 +01:00
## Interwebz
2020-02-11 16:37:24 +01:00
- [live site voicegardens.org](https://voicegardens.org)
- ["offline" installation version of voicegardens.org](https://offline.voicegardens.org)
2020-02-11 16:37:24 +01:00
- [barbican.org.uk: This is Public Space](https://www.barbican.org.uk/whats-on/2019/event/this-is-public-space)
- [upprojects.com: This is Public Space](https://www.upprojects.com/projects/this-is-public-space/)
## Hackity Hack Hack
2019-12-16 11:35:41 +01:00
```bash
$ sudo apt install -y make git
2019-12-21 12:49:53 +01:00
$ git clone ssh://gitea@vvvvvvaria.org:12345/varia/voicegardens.git
$ cd voicegardens
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
$ make dev-serve
```
2020-02-11 16:37:24 +01:00
## Deploying
2019-12-21 12:49:53 +01:00
2019-12-21 13:13:07 +01:00
You can add the following to your SSH configuration:
```
Host voicegardens.org
Hostname voicegardens.org
2021-05-18 09:50:08 +02:00
User <username>
2019-12-21 13:13:07 +01:00
Port 12345
2021-05-18 09:50:08 +02:00
IdentityFile ~/.ssh/<ssh-private-key-part>
2019-12-21 13:13:07 +01:00
```
Make sure you can SSH into the server.
```bash
$ ssh voicegardens.org
$ sudo -i # you have root access too
```
2019-12-22 05:36:48 +01:00
Then it's possible to release the site with the following targets.
2019-12-21 13:13:07 +01:00
2019-12-21 12:49:53 +01:00
```bash
$ make offline # https://offline.voicegardens.org
2020-02-11 16:37:24 +01:00
$ make voicegardens # https://voicegardens.org
2019-12-21 12:49:53 +01:00
```
2021-05-18 10:48:01 +02:00
Here is an example Supervisor configuration:
```
[group:voicegardens]
programs=online,offline
[program:online]
directory=/var/www/voicegardens.org
user=www-data
autostart=true
autorestart=true
environment=PATH="/var/www/voicegardens.org/.venv/lib/python3.7/site-packages:%(ENV_PATH)s"
command=/var/www/voicegardens.org/.venv/bin/gunicorn --workers 1 --bind 127.0.0.1:9090 voicegardens.server:app
[program:offline]
directory=/var/www/offline.voicegardens.org
user=www-data
autostart=true
autorestart=true
environment=PATH="/var/www/offline.voicegardens.org/.venv/lib/python3.7/site-packages:%(ENV_PATH)s"
command=/var/www/offline.voicegardens.org/.venv/bin/gunicorn --workers 1 --bind 127.0.0.1:9091 voicegardens.server:app
```
And an Nginx configuration (after running `cerbot --nginx -d voicegardens.org`):
```
upstream voicegardens {
server 127.0.0.1:9090;
}
server {
root /var/www/voicegardens.org;
server_name voicegardens.org; # managed by Certbot
location / {
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://voicegardens;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/voicegardens.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/voicegardens.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = voicegardens.org) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name voicegardens.org;
return 404; # managed by Certbot
}
```
2021-05-27 20:34:24 +02:00
You will also need to include the following in the `/etc/nginx/nginx.conf`:
```
client_max_body_size 100M;
```
And you'll need to create user accounts and hand out the right permissions too:
```
$ useradd -m voicegardens -s /bin/bash
$ usermod -a -G sudo voicegardens
$ usermod -a -G www-data voicegardens
$ chgrp www-data /var/www/voicegardens.org/voicegardens/archive/
$ chmod g+rwxs /var/www/offline.voicegardens.org/voicegardens/archive/
```
And the following in the `/etc/sudoers` file also:
```
voicegardens ALL=(ALL) NOPASSWD: ALL
```
2020-02-11 16:37:24 +01:00
## Layers of the Onion
2020-02-11 16:37:24 +01:00
- [Flask](http://flask.palletsprojects.com/en/1.1.x/)
- [p5.js](https://p5js.org)
## License
- [AGPL](LICENSE)