Remote Deployment Guide

This guide provides step-by-step instructions to deploy the whale-alerting service on a remote Linux server.

Prerequisites

Before you begin, ensure:

  • You are using a Debian-based Linux system (e.g., Ubuntu)
  • You have sudo privileges
  • systemd is available and enabled

Step 1: Install Required Dependencies

Install build tools:

sudo apt-get update && sudo apt-get install -y \
  build-essential \
  cmake \
  pkg-config \
  libudev-dev

Install Rust:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup install nightly

Step 2: Build the Project

Navigate to project root directory and build binary:

cargo build --package coin-tracker --release

The compiled binary will be located in target/release/.

Step 3: Create Environment File

Create a dedicated environment file for systemd:

sudo touch /etc/systemd/whale-alerting-env

Add the following environment variables to the file:

WHALE_ALERT_CHANNEL_SLACK_WEBHOOK=<SLACK_WEBHOOK_URL>
RPC_URL=<RPC_URL>

Note: Replace <SLACK_WEBHOOK_URL> with your actual Slack webhook URL and <RPC_URL> with actual rpc_url.

Set proper permissions:

sudo chmod 600 /etc/systemd/whale-alerting-env

Step 4: Copy Service file

Copy whale-alerting.service service file (located in deployment/services) into /etc/systemd/system directory.

Step 5: Start the Service and View Logs

Reload systemd, enable and start the service:

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable whale-alerting
sudo systemctl restart whale-alerting

Check logs in real time:

journalctl -fu whale-alerting

Verification

Ensure service is running:

systemctl status whale-alerting

If you see active (running), the Whale Alerting service is deployed successfully.