-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prepare for deployment * point database yml to database url * add dummy url to dockerfile * new db for prod instead of trying to share * add default host * turn mail sending on * host needs to be set * slightly different option * setup sendgrid for emails * setup mailgun instead * finish setting up mailgun domain correctly with sandbox
- Loading branch information
Showing
12 changed files
with
170 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ | ||
|
||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# generated by dockerfile-rails | ||
|
||
--- | ||
options: | ||
label: | ||
fly_launch_runtime: rails | ||
postgresql: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
# Load the Rails application. | ||
require_relative "application" | ||
require_relative 'application' | ||
|
||
# Initialize the Rails application. | ||
Rails.application.initialize! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
require "active_support/core_ext/integer/time" | ||
# frozen_string_literal: true | ||
|
||
require 'active_support/core_ext/integer/time' | ||
|
||
Rails.application.configure do | ||
# Settings specified here will take precedence over those in config/application.rb. | ||
|
@@ -16,6 +18,19 @@ | |
config.consider_all_requests_local = false | ||
config.action_controller.perform_caching = true | ||
|
||
# mail stuff | ||
config.action_mailer.delivery_method = :mailgun | ||
config.action_mailer.perform_deliveries = true | ||
config.action_mailer.raise_delivery_errors = true | ||
config.action_mailer.mailgun_settings = { | ||
api_key: ENV.fetch('MAILGUN_API_KEY', ''), | ||
domain: ENV.fetch('MAILGUN_DOMAIN', '') | ||
# api_host: 'api.eu.mailgun.net' # Uncomment this line for EU region domains | ||
# timeout: 20 # Default depends on rest-client, whose default is 60s. Added in 1.2.3. | ||
} | ||
config.action_mailer.default_options = { from: '[email protected]' } | ||
config.action_mailer.default_url_options = { host: ENV.fetch('DEFAULT_HOST', '') } | ||
|
||
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment | ||
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). | ||
# config.require_master_key = true | ||
|
@@ -52,17 +67,17 @@ | |
config.force_ssl = true | ||
|
||
# Log to STDOUT by default | ||
config.logger = ActiveSupport::Logger.new(STDOUT) | ||
.tap { |logger| logger.formatter = ::Logger::Formatter.new } | ||
.then { |logger| ActiveSupport::TaggedLogging.new(logger) } | ||
config.logger = ActiveSupport::Logger.new($stdout) | ||
.tap { |logger| logger.formatter = ::Logger::Formatter.new } | ||
.then { |logger| ActiveSupport::TaggedLogging.new(logger) } | ||
|
||
# Prepend all log lines with the following tags. | ||
config.log_tags = [ :request_id ] | ||
config.log_tags = [:request_id] | ||
|
||
# "info" includes generic and useful information about system operation, but avoids logging too much | ||
# information to avoid inadvertent exposure of personally identifiable information (PII). If you | ||
# want to log everything, set the level to "debug". | ||
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") | ||
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info') | ||
|
||
# Use a different cache store in production. | ||
# config.cache_store = :mem_cache_store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
Mailgun.configure do |config| | ||
config.api_key = ENV.fetch('MAILGUN_API_KEY', '') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# fly.toml app configuration file generated for hvtl on 2024-10-06T18:28:19-04:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = 'hvtl' | ||
primary_region = 'ewr' | ||
console_command = '/rails/bin/rails console' | ||
|
||
[build] | ||
|
||
[env] | ||
DATABASE_URL = 'sqlite3:///data/production.sqlite3' | ||
|
||
[[mounts]] | ||
source = 'data' | ||
destination = '/data' | ||
|
||
[http_service] | ||
internal_port = 3000 | ||
force_https = true | ||
auto_stop_machines = 'stop' | ||
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 = '/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :fly do | ||
task :ssh do | ||
sh 'fly ssh console --pty -C "sudo -iu rails"' | ||
end | ||
|
||
task :console do | ||
sh 'fly ssh console --pty -C "/rails/bin/rails console"' | ||
end | ||
|
||
task :dbconsole do | ||
sh 'fly ssh console --pty -C "/rails/bin/rails dbconsole"' | ||
end | ||
end |