From 9395ad0a32658cf2aeac140a52b0534838ed94f5 Mon Sep 17 00:00:00 2001 From: Baskin Tapkan Date: Tue, 2 Jul 2024 15:29:48 -0500 Subject: [PATCH] fly-io --- .github/workflows/fly-deploy.yml | 16 ++++++++++++ Gemfile | 5 ++++ Gemfile.lock | 13 +++++++-- config/dockerfile.yml | 8 ++++++ fly.toml | 45 ++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/fly-deploy.yml create mode 100644 config/dockerfile.yml create mode 100644 fly.toml diff --git a/.github/workflows/fly-deploy.yml b/.github/workflows/fly-deploy.yml new file mode 100644 index 0000000..b721e90 --- /dev/null +++ b/.github/workflows/fly-deploy.yml @@ -0,0 +1,16 @@ +name: Fly Deploy +on: + push: + branches: + - main +jobs: + deploy: + name: Deploy app + runs-on: ubuntu-latest + concurrency: deploy-group # optional: ensure only one action runs at a time + steps: + - uses: actions/checkout@v4 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --remote-only + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/Gemfile b/Gemfile index f854315..ae6b9a9 100644 --- a/Gemfile +++ b/Gemfile @@ -47,6 +47,9 @@ gem "bootsnap", require: false # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] # gem "image_processing", "~> 1.2" +# fix until ruby 3.3.4 is release +gem 'net-pop', github: 'ruby/net-pop' + group :development, :test do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem "debug", platforms: %i[ mri windows ] @@ -68,3 +71,5 @@ group :test do gem "capybara" gem "selenium-webdriver" end + +gem "dockerfile-rails", ">= 1.6", :group => :development diff --git a/Gemfile.lock b/Gemfile.lock index d0fe43e..b7f2da6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,9 @@ +GIT + remote: https://github.com/ruby/net-pop.git + revision: e8d0afe2773b9eb6a23c39e9e437f6fc0fc7c733 + specs: + net-pop (0.1.2) + GEM remote: https://rubygems.org/ specs: @@ -99,6 +105,8 @@ GEM debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) + dockerfile-rails (1.6.17) + rails (>= 3.0.0) drb (2.2.1) erubi (1.13.0) globalid (1.2.1) @@ -134,7 +142,6 @@ GEM net-imap (0.4.14) date net-protocol - net-pop (0.1.2) net-protocol (0.2.2) timeout net-smtp (0.5.0) @@ -259,7 +266,7 @@ GEM PLATFORMS aarch64-linux arm-linux - arm64-darwin + arm64-darwin-23 x86-linux x86_64-darwin x86_64-linux @@ -268,8 +275,10 @@ DEPENDENCIES bootsnap capybara debug + dockerfile-rails (>= 1.6) importmap-rails jbuilder + net-pop! pg (~> 1.1) puma (>= 5.0) rails (~> 7.1.3, >= 7.1.3.4) diff --git a/config/dockerfile.yml b/config/dockerfile.yml new file mode 100644 index 0000000..e6e5e56 --- /dev/null +++ b/config/dockerfile.yml @@ -0,0 +1,8 @@ +# generated by dockerfile-rails + +--- +options: + label: + fly_launch_runtime: rails + postgresql: true + prepare: false diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..f627739 --- /dev/null +++ b/fly.toml @@ -0,0 +1,45 @@ +# fly.toml app configuration file generated for board-sports-ror on 2024-07-02T13:26:03-05:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'board-sports-ror' +primary_region = 'ord' +console_command = '/rails/bin/rails console' + +[build] + +[deploy] + release_command = './bin/rails db:prepare' + +[http_service] + internal_port = 3000 + force_https = true + auto_stop_machines = true + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + +[checks] + [checks.status] + port = 3000 + type = 'http' + interval = '10s' + timeout = '2s' + grace_period = '5s' + method = 'GET' + path = '/up' + protocol = 'http' + tls_skip_verify = false + + [checks.status.headers] + X-Forwarded-Proto = 'https' + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 + +[[statics]] + guest_path = '/rails/public' + url_prefix = '/'