Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 43 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Build image, lint, and run tests

on: [push]
on:
push:
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: [3.12]

steps:
- uses: actions/checkout@v4
Expand All @@ -29,6 +32,32 @@ jobs:
source .venv/bin/activate
pytest

build_tmp:
runs-on: ubuntu-latest
steps:
- uses: pguyot/arm-runner-action@v2
id: build_image
with:
base_image: https://downloads.raspberrypi.com/raspios_armhf/images/raspios_armhf-2024-03-15/2024-03-15-raspios-bookworm-armhf.img.xz
bootpartition: 1
rootpartition: 2
image_additional_mb: 4000
commands: |
ls

- name: Compress the release image
run: |
sudo fdisk -l
sudo ls /etc/xdg/autostart/
mv ${{ steps.build_image.outputs.image }} go-note-go.img
xz -0 -T 0 -v go-note-go.img
- name: Upload release image
uses: actions/upload-artifact@v4
with:
name: Release image
path: go-note-go.img.xz


build_image:
runs-on: ubuntu-latest
steps:
Expand All @@ -44,7 +73,9 @@ jobs:
sudo apt update

echo "Installing dependencies!"
sudo apt install -y git firefox-esr xvfb portaudio19-dev libatlas-base-dev redis-server espeak rustc python3-dev libopenblas-dev iptables iptables-persistent
sudo apt install -y git firefox-esr xvfb portaudio19-dev libatlas-base-dev redis-server \
espeak rustc python3-dev libopenblas-dev iptables iptables-persistent cmake autoconf \
build-essential gfortran

echo "Installing Go Note Go!"
mkdir -p /home/pi/code/github/dbieber
Expand All @@ -55,15 +86,16 @@ jobs:
git checkout $GITHUB_SHA

echo "Setting up Python environment"
python3 -m venv env
./env/bin/pip install -e . # Install Python dependencies
python3 -m venv .venv
./.venv/bin/pip install uv
./.venv/bin/python3 -m uv pip install -e . # Install Python dependencies

echo "Start on boot"
sudo cat /etc/rc.local
sudo sed '/^exit 0/i \
sudo -u pi mkdir -p /home/pi/out \
bash /home/pi/code/github/dbieber/GoNoteGo/scripts/install_settings.sh \
/home/pi/code/github/dbieber/GoNoteGo/env/bin/supervisord -c /home/pi/code/github/dbieber/GoNoteGo/gonotego/supervisord.conf \
/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/supervisord -c /home/pi/code/github/dbieber/GoNoteGo/gonotego/supervisord.conf \
' /etc/rc.local > ./rc.local.modified && sudo mv ./rc.local.modified /etc/rc.local
sudo chmod +x /etc/rc.local

Expand Down Expand Up @@ -233,15 +265,16 @@ jobs:
cat /etc/dhcpcd.conf
cat /etc/dnsmasq.conf
python -m http.server
python3 -m http.server
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -t nat -L
sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
nano /home/pi/code/github/dbieber/GoNoteGo/gonotego/settings/secure_settings.py
/home/pi/code/github/dbieber/GoNoteGo/env/bin/python
/home/pi/code/github/dbieber/GoNoteGo/env/bin/supervisord -c /home/pi/code/github/dbieber/GoNoteGo/gonotego/supervisord.conf
/home/pi/code/github/dbieber/GoNoteGo/env/bin/supervisorctl -u go -p notego status
/home/pi/code/github/dbieber/GoNoteGo/env/bin/supervisorctl -u go -p notego restart all
/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/python
/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/supervisord -c /home/pi/code/github/dbieber/GoNoteGo/gonotego/supervisord.conf
/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/supervisorctl -u go -p notego status
/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/supervisorctl -u go -p notego restart all
cd /home/pi/code/github/dbieber/GoNoteGo/
EOF

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ screenshot-*.png
geckodriver.log
scratch
env
.venv
tmp-say
auth_url
build
Expand Down
2 changes: 1 addition & 1 deletion gonotego/command_center/system_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def update():

@register_command('restart')
def restart():
shell('./env/bin/supervisorctl -u go -p notego restart all')
shell('./.venv/bin/supervisorctl -u go -p notego restart all')


@register_command('reboot')
Expand Down
12 changes: 6 additions & 6 deletions gonotego/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,33 @@ username=go
password=notego

[program:GoNoteGo-audio-listener]
command=/home/pi/code/github/dbieber/GoNoteGo/env/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/audio/runner.py
command=/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/audio/runner.py
directory=/home/pi
user=root

[program:GoNoteGo-command-center]
environment=XDG_RUNTIME_DIR="/run/user/1000"
command=/home/pi/code/github/dbieber/GoNoteGo/env/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/command_center/runner.py
command=/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/command_center/runner.py
directory=/home/pi
user=pi

[program:GoNoteGo-text-listener]
command=/home/pi/code/github/dbieber/GoNoteGo/env/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/text/runner.py
command=/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/text/runner.py
directory=/home/pi
user=root

[program:GoNoteGo-transcription]
environment=GOOGLE_APPLICATION_CREDENTIALS="/home/pi/secrets/google_credentials.json",LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0
command=/home/pi/code/github/dbieber/GoNoteGo/env/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/transcription/runner.py
command=/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/transcription/runner.py
directory=/home/pi
user=pi

[program:GoNoteGo-uploader]
command=/home/pi/code/github/dbieber/GoNoteGo/env/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/uploader/runner.py
command=/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/uploader/runner.py
directory=/home/pi
user=pi

[program:GoNoteGo-settings-server]
command=/home/pi/code/github/dbieber/GoNoteGo/env/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/settings_server/runner.py
command=/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/python /home/pi/code/github/dbieber/GoNoteGo/gonotego/settings_server/runner.py
directory=/home/pi
user=pi
6 changes: 5 additions & 1 deletion gonotego/uploader/blob/blob_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ def upload_blob(filepath, client):
dropbox_path = f'/{filepath}'
with open(filepath, 'rb') as f:
unused_file_metadata = client.files_upload(f.read(), dropbox_path) # noqa
link_metadata = client.sharing_create_shared_link(dropbox_path)
try:
link_metadata = client.sharing_create_shared_link(dropbox_path)
except dropbox.exceptions.ApiError as e:
print(e)
return None
return link_metadata.url.replace('www.', 'dl.').replace('?dl=0', '')
10 changes: 6 additions & 4 deletions installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ These instructions assume you're starting from a clean install of Raspbian,
and that your Raspberry Pi is connected to an external monitor.
Once you are set up, an external monitor will no longer be necessary.

Update 2024: Newer, better instructions are in the works. Stay tuned!

1. Clone GoNoteGo

```bash
Expand Down Expand Up @@ -39,9 +41,9 @@ sudo apt install firefox-esr xvfb portaudio19-dev libatlas-base-dev redis-server
cd /home/pi/code/github/dbieber/GoNoteGo
mkdir out
pip3 install virtualenv
/home/pi/.local/bin/virtualenv env -p python3
./env/bin/pip install grpcio -U --no-binary=grpcio
./env/bin/pip install -e .
/home/pi/.local/bin/virtualenv .venv -p python3
./.venv/bin/pip install grpcio -U --no-binary=grpcio
./.venv/bin/pip install -e .
```

5. Start on boot
Expand All @@ -50,7 +52,7 @@ pip3 install virtualenv
sudo nano /etc/rc.local
```
Add this line to rc.local:
`/home/pi/code/github/dbieber/GoNoteGo/env/bin/supervisord -c /home/pi/code/github/dbieber/GoNoteGo/gonotego/supervisord.conf`
`/home/pi/code/github/dbieber/GoNoteGo/.venv/bin/supervisord -c /home/pi/code/github/dbieber/GoNoteGo/gonotego/supervisord.conf`

6. Install geckodriver to /usr/local/bin

Expand Down
32 changes: 16 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ classifiers = [
]

dependencies = [
'absl-py',
'apscheduler',
'dropbox',
'fire>=0.4.0',
'flask',
'keyboard',
'numpy',
'openai',
'parsedatetime',
'python-dateutil',
'redis',
'absl-py<=2.1.0',
'apscheduler<=3.10.4',
'dropbox<=12.0.2',
'fire<=0.7.0',
'flask<=3.0.3',
'keyboard<=0.13.5',
'numpy<=2.1.3',
# 'openai<=1.52.2',
'parsedatetime<=2.6',
'python-dateutil<=2.8.2',
'redis<=4.3.4',
# selenium 4.0 breaks with arm geckodriver.
'selenium==3.141.0',
'setuptools-rust',
'sounddevice',
'setuptools-rust<=1.5.2',
'sounddevice<=0.4.5',
'soundfile',
'supervisor',
'twython',
'supervisor<=4.2.4',
'twython<=3.9.1',
"urllib3==1.26.16", # For compatibility with selenium==3.141.0
]

Expand All @@ -62,5 +62,5 @@ lint.ignore = ["E722"]
exclude = ["scratch"]

[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
requires = ["setuptools>=43.0.0", "setuptools-rust", "wheel"]
build-backend = "setuptools.build_meta"