Skip to content

Commit 36f103e

Browse files
committed
Configure app
1 parent 1dd2b26 commit 36f103e

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ COPY --chown=ruby:ruby . .
3838

3939
# Start the server
4040
EXPOSE 8080
41-
CMD ["bundle", "exec", "rackup", "--host", "0.0.0.0", "--port", "8080"]
41+
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]

config/puma.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Puma configuration for Fly.io deployment
2+
# Optimized for low memory usage on shared-cpu-1x (256MB RAM)
3+
4+
# Use the PORT environment variable, default to 8080
5+
port ENV.fetch("PORT", 8080)
6+
7+
# Single worker process (no forking) to save memory
8+
workers 0
9+
10+
# Minimal threads for light MCP traffic
11+
threads 2, 2
12+
13+
# Preload application for faster startup and lower memory footprint
14+
preload_app!
15+
16+
# Bind to all interfaces
17+
bind "tcp://0.0.0.0:#{ENV.fetch("PORT", 8080)}"
18+
19+
# Disable stats since we're running a single worker
20+
activate_control_app false

fly.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,15 @@ primary_region = 'iad'
2020
min_machines_running = 0
2121
processes = ['app']
2222

23+
[http_service.concurrency]
24+
type = "requests"
25+
soft_limit = 200
26+
hard_limit = 250
27+
2328
[[vm]]
2429
size = 'shared-cpu-1x'
30+
memory = 256
31+
32+
[vm]
33+
kill_signal = "SIGTERM"
34+
kill_timeout = "5s"

0 commit comments

Comments
 (0)