The Prime Spot Grid Trading Bot uses a Client-Server model:
| 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. |
Choose the method that fits your needs:
.exe installer to automatically set up the bot, open ports, and configure auto-start.Specific guide for Amazon EC2 users, focusing on creating the instance and configuring the Security Group (Firewall).
Grid_install.sh) Users: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.MemoryMax according to your server's hardware allocation.
Why is Swap & Memory Limiting critical on a 1GB RAM VPS?
apt-daily or snapd) can suddenly spike and consume 200MB–300MB of RAM. Without Swap and memory guardrails, the OS will run out of physical memory and enter Memory Thrashing—freezing both the bot and SSH access until you manually hard-reset the instance.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.
MemoryMax)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.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
MemoryHigh: Soft limit. When reached, the Linux kernel gently reclaims memory cache to keep usage stable.MemoryMax: Hard safety ceiling. Prevents any single service from starving the OS or other applications running on the same VPS.MemorySwapMax=0: Keeps the bot running 100% in fast physical RAM for low-latency order execution (preventing disk swap thrashing), while leaving the 1GB Swapfile for background OS tasks and other applications.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