2019-01-23 15:26:44 +01:00
# Hugvey / Pillow Talk
2019-03-07 20:19:43 +01:00
- Panpoticon
+ Fancy nickname for the web interface that allows altering the story and running the individual Hugveys
- Voice
+ Lyrebird voice syntehsis API wrapper. Set the oAuth token using a token generated [here ](http://hugvey.rubenvandeven.com/oauth.php )
- Client
+ Individual Hugveys that stream their mic output and play audiofiles trough the Panopticon. Communication with the server is done through zmq
+ Connect with them trough hugvey1.local etc (1-25).
- Central Command/server
+ One server to rule them all. Start individual threads/subprocesses for the individual Hugveys. The Panopticon is started when starting the server.
2019-03-07 08:36:05 +01:00
2019-01-23 15:26:44 +01:00
## Server
Run the server: `python hugvey_server.py --config server_config.yml`
### Panopticon
The server also integrates the _panopticon_ , the monitoring & administration interface to Hugvey.
## Client
To run it: `python hugvey_client.py -c client_config.yml`
## Development
2019-03-07 08:36:05 +01:00
The Panopticon uses gulp to compile SASS into CSS, and to set up browser-sync for css & js. For now, no js user facing dependencies are managed trough node/npm.
2019-03-07 20:19:43 +01:00
After starting the server:
```bash
cd www
gulp
```
2019-03-07 21:10:49 +01:00
To run a command on all hugveys:
```
fab -H rubenvandeven.com,saclab@projects.rubenvandeven.com -- uname
```
2019-03-07 20:19:43 +01:00
2019-03-07 08:36:05 +01:00
## Installation
create and load Python virtualenv
```bash
virtualenv -p python3 --system-site-packages venv
source venv/bin/activate
```
Install requirements
```bash
apt install libasound-dev python3-pyaudio git-lfs
pip install -r requirements.server.txt
pip install -r requirements.txt
```
Install soft requirements (These are hard requirements for the clients!)
```
apt install sox rsync
```
Don't forget to init git submodules
```
git submodule init
git sumodule update
```
2019-03-28 16:26:17 +01:00
2019-03-29 16:20:23 +01:00
2019-04-11 12:42:22 +02:00
copy autossh-hugvey.service to `/etc/systemd/system/` :
```bash
cp autossh-hugvey.service /etc/systemd/system/autossh-hugvey.service
2019-04-27 16:39:20 +02:00
sudo systemctl enable autossh-hugvey.service
2019-04-11 12:42:22 +02:00
```
2019-03-29 16:20:23 +01:00
### clients
```
apt install supervisor
```
Add the following to the first section of `/etc/supervisor/supervisord.conf`
```
chown=pi:pi
```
2019-03-28 16:26:17 +01:00
## Deploy / usefull commands
```bash
for i in {1..6}; do rsync -av ~/hugvey/ pi@hugvey$i.local:/home/pi/hugvey/ --exclude=www --exclude=venv --exclude=local --exclude=*.pyc --exclude=.git; done
```
2019-03-29 16:20:23 +01:00
```bash
for i in {1..6}; do ssh pi@hugvey$i.local "sudo shutdown -h now"; done
```
2019-04-01 16:36:34 +02:00
```bash
lsof -p $(ps aux|grep "[h]ugvey_server.py" |awk '{print $2}')| awk '{print $9}'|sort -rn|uniq -c|sort -rn|head -20
```
or
```bash
lsof | grep $(ps aux|grep "[h]ugvey_server.py" |awk '{print $2}')| awk '{print $11}'|sort -rn|uniq -c|sort -rn|head -20
```