This doc is written for you (the operator of the VPS). It walks through:
- copying
.env.example→.env, - editing config safely on the server, and
- rebuilding + deploying updated binaries,
using VSCode Remote - SSH.
In our setup, the source tree and the runtime directory are the same folder:
DEPLOY_REMOTE_DIR=/opt/poly-gocopy
That means /opt/poly-gocopy contains:
- Source code (this repo, including
.env.exampleand./cmd/...) - Runtime config at
/opt/poly-gocopy/.env(loaded by the Go programs at startup) - Binaries at
/opt/poly-gocopy/bin/arbitrage,/opt/poly-gocopy/bin/arbitrage-equal,/opt/poly-gocopy/bin/arbitrage-weighted, and/opt/poly-gocopy/bin/balance - Logs/output at
/opt/poly-gocopy/out/(JSONL, etc.)
Note: cmd/copytrade is deprecated and no longer supported; the deploy/restart
scripts target arbitrage services only.
If you’re not sure what your service is using, run:
systemctl cat poly-gocopy-arbitrage | sed -n 's/^[[:space:]]*\\(WorkingDirectory\\|EnvironmentFile\\|ExecStart\\)=/\\1=/p'The systemd services created by the deploy scripts typically use:
WorkingDirectory=/opt/poly-gocopyEnvironmentFile=/opt/poly-gocopy/.env
So the .env you edit should usually be:
/opt/poly-gocopy/.envEdit the file directly in VSCode or use a terminal editor:
nano /opt/poly-gocopy/.envExamples (do not copy secrets from here; use your real values):
# RPC endpoints
RPC_WS_URL=wss://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
# Polymarket CLOB
CLOB_URL=https://clob.polymarket.com
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
FUNDER=0xYOUR_FUNDING_WALLET
CLOB_SIGNATURE_TYPE=2
# Arbitrage slugs file
EVENT_SLUGS_FILE=/opt/poly-gocopy/slugs.txt
# Arbitrage edge threshold (strict: priceA + priceB < threshold)
ARBITRAGE_MAX_PAIR_COST=0.96
# Enable live trading (default is dry-run)
ENABLE_TRADING=trueImportant:
- After changing
.env, you must restart the service for changes to take effect.
If .env doesn't exist yet:
cd /opt/poly-gocopy
mkdir -p /opt/poly-gocopy/bin /opt/poly-gocopy/out
cp -n /opt/poly-gocopy/.env.example /opt/poly-gocopy/.env
chmod 600 /opt/poly-gocopy/.envNotes:
cp -nwill not overwrite an existing/opt/poly-gocopy/.env..env.examplecontains both "deploy settings" and "runtime settings". On the VPS you can delete the deploy section (SSH_*,DEPLOY_*) if you want; the bots only care about runtime keys.- Never commit
.envto git.
Restart arbitrage:
systemctl restart poly-gocopy-arbitrage
systemctl status poly-gocopy-arbitrage --no-pagerRestart arbitrage-equal:
systemctl restart poly-gocopy-arbitrage-equal
systemctl status poly-gocopy-arbitrage-equal --no-pagerRestart arbitrage-weighted:
systemctl restart poly-gocopy-arbitrage-weighted
systemctl status poly-gocopy-arbitrage-weighted --no-pagerView logs:
journalctl -u poly-gocopy-arbitrage -n 200 --no-pager
journalctl -u poly-gocopy-arbitrage-equal -n 200 --no-pager
journalctl -u poly-gocopy-arbitrage-weighted -n 200 --no-pagerFollow logs live:
journalctl -u poly-gocopy-arbitrage -f --no-pager
journalctl -u poly-gocopy-arbitrage-equal -f --no-pager
journalctl -u poly-gocopy-arbitrage-weighted -f --no-pagerRun the build script:
/opt/poly-gocopy/scripts/build_and_deploy.shThis script pulls the latest code, runs tests, builds the binaries, installs them, and restarts the services.
Edit the slugs file:
nano /opt/poly-gocopy/slugs.txtThen reload the arbitrage service (this triggers SIGHUP when configured with ExecReload):
systemctl reload poly-gocopy-arbitrageIf reload is not configured on your unit, just restart:
systemctl restart poly-gocopy-arbitrage