General Installation Guide

I. Architecture Overview

The Prime Spot Grid Trading Bot uses a Client-Server model:

II. ⚠️ CRITICAL: Firewall & Port 8764

IMPORTANT: The Client connects to the Server via TCP Port 8764.
Depending on your cloud provider, you may need to open this port manually.
Cloud Provider Action Required Instruction
AWS EC2 🔴 Manual Open Required You must add a rule to the Security Group to allow Custom TCP 8764.
See EC2 Guide
Google Cloud (GCP)
Microsoft Azure
Oracle Cloud
🔴 Manual Open Required The install script cannot bypass the external Cloud Firewall.
GCP: Go to VPC Network → Firewall → Create Firewall Rule → Allow tcp:8764.
Azure: Go to Networking → Add inbound port rule → 8764.
DigitalOcean
Vultr / Linode
Hetzner
🟢 Automatic No action needed. These providers usually respect the internal OS firewall, which our script configures automatically.

III. Installation Methods

Choose the method that fits your needs:

1️⃣ Linux Installation (Recommended)

2️⃣ Windows Server Installation

3️⃣ AWS EC2 Setup

Specific guide for Amazon EC2 users, focusing on creating the instance and configuring the Security Group (Firewall).

→ Go to EC2 Guide

IV. 🛡️ Linux VPS Optimization: Swap & Memory Guardrails

Note for Auto-Installer (Grid_install.sh) Users:
• Our auto-installer automatically creates a 1GB Swapfile and sets Systemd memory guardrails (MemoryHigh=420M / MemoryMax=500M) tuned for the smallest entry-level 1GB RAM VPS. Even when trading multiple pairs simultaneously, the Grid Bot is highly optimized and runs stably well within this 500MB envelope.
• Using a Larger VPS (2GB+ RAM)? If you run a higher-tier server (e.g., 2GB, 4GB, or 8GB RAM) to host other applications/services alongside the Grid Bot and want to allocate more RAM headroom to the service, see Step 2B below to customize MemoryMax according to your server's hardware allocation.

Why is Swap & Memory Limiting critical on a 1GB RAM VPS?

Step 1: Create a 1GB Persistent Swapfile (Universal: AWS, GCP, DO, Vultr...)

Run the following commands via SSH. We use dd instead of fallocate so it works reliably across both ext4 (Ubuntu/Debian on GCP) and XFS filesystems (Amazon Linux/RHEL on AWS EC2):

# 1. Create a 1GB swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 status=progress

# 2. Restrict permissions (root only) and format as swap
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

# 3. Make swap persistent across VPS reboots/resets
grep -q '/swapfile' /etc/fstab || echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

# 4. Prefer physical RAM; only use Swap when RAM is nearly full
sudo sysctl vm.swappiness=10
grep -q 'vm.swappiness' /etc/sysctl.conf || echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf

Verify with free -m — you should see ~1023MB on the Swap: row.

Step 2: Configure or Customize Systemd Memory Guardrails (MemoryMax)

💡 Hardware Sizing Guide:
• 1GB RAM VPS (Smallest Tier — GCP e2-micro, AWS t2.micro / t3.micro): The default MemoryHigh=420M and MemoryMax=500M are ideal—plenty for running multiple pairs while reserving ~450MB of headroom for the Linux OS and SSH daemon.
• 2GB+ RAM VPS (Multi-Application Servers): If you use a larger VPS to run other applications or bots alongside the Grid Bot, you can optionally raise or customize these limits (e.g., MemoryHigh=800M / MemoryMax=1000M) to match how you want to partition RAM across your services.

2A. Default Setup for 1GB RAM VPS (Manual Installation):

sudo mkdir -p /etc/systemd/system/primespotgrid.service.d
cat << 'EOF' | sudo tee /etc/systemd/system/primespotgrid.service.d/memory.conf
[Service]
MemoryHigh=420M
MemoryMax=500M
MemorySwapMax=0
EOF

sudo systemctl daemon-reload
sudo systemctl restart primespotgrid

2B. Optional Customization for 2GB+ RAM VPS (After Running Grid_install.sh or Manual Setup):

If you ran Grid_install.sh on a larger VPS (2GB+ RAM) where you also run other workloads and wish to adjust the default 500MB ceiling, run the commands below to set your preferred RAM allocation:

# Customize MemoryHigh and MemoryMax on a 2GB+ RAM VPS
sudo mkdir -p /etc/systemd/system/primespotgrid.service.d
cat << 'EOF' | sudo tee /etc/systemd/system/primespotgrid.service.d/memory.conf
[Service]
MemoryHigh=800M
MemoryMax=1000M
MemorySwapMax=0
EOF

sudo systemctl daemon-reload
sudo systemctl restart primespotgrid

# Verify the new limits are active
systemctl show primespotgrid -p MemoryHigh,MemoryMax

Step 3: Throttle Background OS Updates (Ubuntu / Debian Only)

On Ubuntu/Debian servers, daily background apt checks can spike over 250MB of RAM. Run this snippet to cap background updates at 120MB and lowest CPU/disk priority without disabling security updates:

for u in apt-daily apt-daily-upgrade; do
  sudo mkdir -p /etc/systemd/system/$u.service.d
  printf '[Service]
MemoryHigh=120M
Nice=19
IOSchedulingClass=idle
' | sudo tee /etc/systemd/system/$u.service.d/limit.conf >/dev/null
done
sudo systemctl daemon-reload