Codex commited on
Commit
15a348c
·
1 Parent(s): 812314a

Add Oracle deployment assets and alerts ping

Browse files
README.md CHANGED
@@ -93,3 +93,24 @@ The `/bulkadd` modal accepts one bet per line in this format:
93
  Bryan Rocchio 1+ HR | +1450 | $5
94
  3 leg parlay | +1452 | $5
95
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  Bryan Rocchio 1+ HR | +1450 | $5
94
  3 leg parlay | +1452 | $5
95
  ```
96
+
97
+ ## Oracle Cloud Always Free Deployment
98
+
99
+ This bot is a good fit for an Oracle Cloud Always Free Ubuntu VM because it:
100
+
101
+ - runs on Node.js `24+`
102
+ - uses your remote CockroachDB/Postgres-compatible database
103
+ - does not require local persistent bet storage
104
+
105
+ Recommended deployment shape:
106
+
107
+ - Oracle Compute VM with Ubuntu LTS
108
+ - native Node runtime
109
+ - `systemd` for auto-restart and boot persistence
110
+ - SSH exposed publicly on port `22` only
111
+
112
+ Deployment assets included in this repo:
113
+
114
+ - `docs/oracle-always-free.md`
115
+ - `deploy/oracle/roibot.service`
116
+ - `deploy/oracle/roibot.env.example`
deploy/oracle/roibot.env.example ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ DISCORD_TOKEN=your_discord_bot_token_here
2
+ DATABASE_URL=postgresql://username:password@host:26257/database?sslmode=require
3
+ GUILD_ID=optional_guild_id_for_faster_command_registration
4
+ ADMIN_ROLE_NAME=Admin
5
+ PORT=7860
deploy/oracle/roibot.service ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [Unit]
2
+ Description=ROI Bet Tracking Discord Bot
3
+ After=network-online.target
4
+ Wants=network-online.target
5
+
6
+ [Service]
7
+ Type=simple
8
+ User=roibot
9
+ Group=roibot
10
+ WorkingDirectory=/opt/roibot
11
+ EnvironmentFile=/etc/roibot/roibot.env
12
+ ExecStart=/usr/bin/node /opt/roibot/src/index.js
13
+ Restart=always
14
+ RestartSec=5
15
+ TimeoutStopSec=20
16
+
17
+ [Install]
18
+ WantedBy=multi-user.target
docs/oracle-always-free.md ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Oracle Cloud Always Free Deployment
2
+
3
+ This bot runs well on an Oracle Cloud Always Free Ubuntu VM because it only needs:
4
+
5
+ - Node.js `24+`
6
+ - outbound internet access to Discord and CockroachDB
7
+ - your existing `DATABASE_URL`
8
+
9
+ The app does **not** need local persistent storage for bet history because the database is remote.
10
+
11
+ ## Recommended shape
12
+
13
+ - OS: Ubuntu LTS
14
+ - Runtime: native Node.js, not Docker
15
+ - Service manager: `systemd`
16
+ - Public inbound ports: `22/tcp` only
17
+ - Preferred instance: AMD micro if available
18
+ - Fallback instance: Ampere ARM if AMD capacity is unavailable
19
+
20
+ ## 1. Create the Oracle VM
21
+
22
+ Create an Oracle Compute instance in your home region:
23
+
24
+ - image: Ubuntu LTS
25
+ - public IP: yes
26
+ - ingress: allow `22/tcp` only
27
+ - leave outbound internet access enabled
28
+
29
+ Do not expose port `7860` publicly. The health server can stay local to the VM.
30
+
31
+ ## 2. SSH into the VM
32
+
33
+ Replace `YOUR_PUBLIC_IP` with the VM's public IP:
34
+
35
+ ```bash
36
+ ssh ubuntu@YOUR_PUBLIC_IP
37
+ ```
38
+
39
+ ## 3. Bootstrap the machine
40
+
41
+ Update packages and install the basics:
42
+
43
+ ```bash
44
+ sudo apt-get update
45
+ sudo apt-get upgrade -y
46
+ sudo apt-get install -y git curl build-essential ca-certificates
47
+ ```
48
+
49
+ Install Node.js 24:
50
+
51
+ ```bash
52
+ curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
53
+ sudo apt-get install -y nodejs
54
+ node -v
55
+ npm -v
56
+ ```
57
+
58
+ ## 4. Create the bot user and folders
59
+
60
+ ```bash
61
+ sudo useradd --system --create-home --shell /bin/bash roibot
62
+ sudo mkdir -p /opt/roibot
63
+ sudo mkdir -p /etc/roibot
64
+ sudo chown -R roibot:roibot /opt/roibot
65
+ ```
66
+
67
+ ## 5. Clone the repo
68
+
69
+ If the repo is private, use your preferred authenticated Git workflow.
70
+
71
+ ```bash
72
+ sudo -u roibot git clone https://huggingface.co/spaces/Syntrex/ROIBot /opt/roibot
73
+ cd /opt/roibot
74
+ sudo -u roibot npm install
75
+ ```
76
+
77
+ ## 6. Create the runtime env file
78
+
79
+ Copy the example from `deploy/oracle/roibot.env.example` into `/etc/roibot/roibot.env`:
80
+
81
+ ```bash
82
+ sudo cp /opt/roibot/deploy/oracle/roibot.env.example /etc/roibot/roibot.env
83
+ sudo nano /etc/roibot/roibot.env
84
+ ```
85
+
86
+ Set:
87
+
88
+ - `DISCORD_TOKEN`
89
+ - `DATABASE_URL`
90
+ - `GUILD_ID` if you want faster command sync in a single server
91
+ - `ADMIN_ROLE_NAME=Admin`
92
+ - `PORT=7860`
93
+
94
+ Lock down the file:
95
+
96
+ ```bash
97
+ sudo chown roibot:roibot /etc/roibot/roibot.env
98
+ sudo chmod 600 /etc/roibot/roibot.env
99
+ ```
100
+
101
+ ## 7. Smoke test manually
102
+
103
+ Run the bot once before wiring `systemd`:
104
+
105
+ ```bash
106
+ cd /opt/roibot
107
+ sudo -u roibot env $(cat /etc/roibot/roibot.env | xargs) node src/index.js
108
+ ```
109
+
110
+ You want to see:
111
+
112
+ - database initialized successfully
113
+ - Discord login succeeds
114
+ - slash commands register
115
+
116
+ Stop it with `Ctrl+C` after confirming startup.
117
+
118
+ ## 8. Install the systemd service
119
+
120
+ Copy the included service file:
121
+
122
+ ```bash
123
+ sudo cp /opt/roibot/deploy/oracle/roibot.service /etc/systemd/system/roibot.service
124
+ sudo systemctl daemon-reload
125
+ sudo systemctl enable roibot
126
+ sudo systemctl start roibot
127
+ ```
128
+
129
+ Check status:
130
+
131
+ ```bash
132
+ sudo systemctl status roibot
133
+ sudo journalctl -u roibot -n 100 --no-pager
134
+ ```
135
+
136
+ ## 9. Verify the bot is online
137
+
138
+ Check in Discord that:
139
+
140
+ - the bot appears online
141
+ - `/bet` works
142
+ - `/summary` works
143
+ - restricted commands such as `/welcome` still behave correctly
144
+
145
+ ## 10. Update workflow
146
+
147
+ When you deploy a new version:
148
+
149
+ ```bash
150
+ ssh ubuntu@YOUR_PUBLIC_IP
151
+ cd /opt/roibot
152
+ sudo -u roibot git pull
153
+ sudo -u roibot npm install
154
+ sudo systemctl restart roibot
155
+ sudo systemctl status roibot
156
+ sudo journalctl -u roibot -n 100 --no-pager
157
+ ```
158
+
159
+ ## 11. Recovery checks
160
+
161
+ If the bot goes offline:
162
+
163
+ ```bash
164
+ sudo systemctl status roibot
165
+ sudo journalctl -u roibot -n 200 --no-pager
166
+ ```
167
+
168
+ If Oracle reboots the VM, `systemd` should bring the bot back automatically.
169
+
170
+ ## AMD vs Ampere notes
171
+
172
+ - AMD micro is the least fussy option when free capacity is available.
173
+ - Ampere ARM is also valid for this bot if AMD capacity is unavailable.
174
+ - The same Node.js and `systemd` setup works for both; just use the standard Ubuntu Node 24 installation flow.
src/index.js CHANGED
@@ -772,9 +772,14 @@ async function handleAlerts(interaction) {
772
  components: buildAlertsButtonRows(),
773
  });
774
 
 
 
 
 
 
775
  await interaction.reply({
776
  embeds: [
777
- buildErrorEmbed('Alerts panel posted', `Sent the analyst alert panel to <#${ALERTS_CHANNEL_ID}>.`).setColor(0x2563eb),
778
  ],
779
  flags: MessageFlags.Ephemeral,
780
  });
 
772
  components: buildAlertsButtonRows(),
773
  });
774
 
775
+ await channel.send({
776
+ content: '@everyone',
777
+ allowedMentions: { parse: ['everyone'] },
778
+ });
779
+
780
  await interaction.reply({
781
  embeds: [
782
+ buildErrorEmbed('Alerts panel posted', `Sent the analyst alert panel and @everyone ping to <#${ALERTS_CHANNEL_ID}>.`).setColor(0x2563eb),
783
  ],
784
  flags: MessageFlags.Ephemeral,
785
  });