noisebell/noisebell-pi/deploy.sh
Jet Pham dff2e96947
Update Main to monorepo structure (#5)
* feat: Convert to a webhooks api model!

feat: Update readme with new api docs and images and logo

feat: reoptimize jpgs and add comments to all images for credit

feat: Add database backend implementations
Todo is to update the readme

feat: use memory storage for endpoints

feat: add logging to rest api and remove ctrl override

feat: remove keyboard monitor

delete the discord api from direct reference

* feat: webhook sending with retries and backoff

Also some great readme changes

* feat: add a web based dev mode!

* feat: better error handling for webhook endopoints

* feat: remove verbose logs

* feat: add docs for local dev

* feat: remove complex webhook stuff
config file with endpoints listed instead

* feat: update logo

* feat: set endpoint and remove rest api

* fix: check for negative config numbers

* feat: remove timestamps from webhook
Use Date header instead

* feat: refactor to using one endpoint with env vars

* feat: change logging to be one rolling log
With a max line size of 10k lines

* feat: move config to toml, keep api in env var

* feat: use .env files for managing env vars

* fix: remove log files from dev

* fix: unblock web monitor thread

* feat: merge into a monorepo with noisebridge-status
2025-08-05 00:33:41 -05:00

60 lines
1.8 KiB
Bash
Executable file

#!/bin/bash
# Exit on error
set -e
echo "Building for Raspberry Pi..."
cross build --release --target aarch64-unknown-linux-gnu
# Check if Discord credentials are already set
if [ -z "$DISCORD_TOKEN" ]; then
echo "Please enter your Discord bot token:"
read -s DISCORD_TOKEN
fi
if [ -z "$DISCORD_CHANNEL_ID" ]; then
echo "Please enter your Discord channel ID:"
read -s DISCORD_CHANNEL_ID
fi
# Create service file with credentials
cat > noisebell.service << EOL
[Unit]
Description=Noisebell Discord Notification Service
After=network.target
[Service]
Type=simple
User=noisebridge
WorkingDirectory=/home/noisebridge
Environment=DISCORD_TOKEN=${DISCORD_TOKEN}
Environment=DISCORD_CHANNEL_ID=${DISCORD_CHANNEL_ID}
ExecStart=/home/noisebridge/noisebell
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOL
echo "Copying to Raspberry Pi..."
# Debug remote directory status
ssh noisebridge@noisebell.local "pwd && ls -la ~/ && echo 'Directory permissions:' && stat -c '%A %a %n' ~/"
# Remove existing files
ssh noisebridge@noisebell.local "rm -f /home/noisebridge/noisebell /home/noisebridge/noisebell.service"
# Copy files with absolute paths
scp -v target/aarch64-unknown-linux-gnu/release/noisebell noisebridge@noisebell.local:/home/noisebridge/noisebell
scp -v noisebell.service noisebridge@noisebell.local:/home/noisebridge/noisebell.service
echo "Setting up service..."
# Deploy service
ssh noisebridge@noisebell.local "sudo cp /home/noisebridge/noisebell.service /etc/systemd/system/ && \
sudo systemctl daemon-reload && \
sudo systemctl enable noisebell && \
sudo systemctl restart noisebell"
# Clean up local service file
rm noisebell.service
echo "Deployment complete!"
echo "You can check the service status with: ssh noisebridge@noisebell.local 'sudo systemctl status noisebell'"