From 4c064994262605c442b094b9dd6c36a0e54f0978 Mon Sep 17 00:00:00 2001 From: Dilraj Date: Mon, 19 Jun 2023 20:26:26 -0400 Subject: [PATCH] Set `min_machines_running` to 1. No more cold starts. --- config/application.rb | 6 ++---- fly.toml | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/config/application.rb b/config/application.rb index ef9be62..0bd5a52 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,16 +27,14 @@ class Application < Rails::Application config.middleware.insert_before 0, Rack::Cors do allow do - origins 'https://spg.dev/', 'localhost:3000', 'localhost:3001' + origins 'https://spg.dev', /\A.*\.netlify\.app\z/ resource '*', headers: :any, - methods: [:get] + methods: [:get] end end - - # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/fly.toml b/fly.toml index 29b6085..ac37d6a 100644 --- a/fly.toml +++ b/fly.toml @@ -19,15 +19,12 @@ console_command = "/rails/bin/rails console" # This forces all HTTP connections to be redirected to HTTPS for secure communication. # We don't have to worry about setting it to 443, I think Fly.io does that automatically. force_https = true - + # When true, Fly.io will automatically stop instances when they're not needed to save resources. - auto_stop_machines = true - - # When true, Fly.io will automatically start instances when they're needed. - auto_start_machines = true + auto_stop_machines = false # Minimum number of instances running at all times. - min_machines_running = 0 + min_machines_running = 1 # Configuration for static files. In this case, we are serving the files in the /app/public directory at the root URL ("/"). [[statics]]