Skip to content

Commit

Permalink
CI/CD: add FLY_API_TOKEN to github
Browse files Browse the repository at this point in the history
  • Loading branch information
x-tropy committed Dec 16, 2024
1 parent 18e7cc3 commit 333371a
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
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 }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.3.4
ARG RUBY_VERSION=3.3.6
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base

# Rails app lives here
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ group :test do
gem "capybara"
gem "selenium-webdriver"
end

gem "dockerfile-rails", ">= 1.6", :group => :development

Check failure on line 67 in Gemfile

View workflow job for this annotation

GitHub Actions / lint

Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ GEM
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
dockerfile-rails (1.6.25)
rails (>= 3.0.0)
dotenv (3.1.6)
drb (2.2.1)
ed25519 (1.3.0)
Expand Down Expand Up @@ -375,6 +377,7 @@ DEPENDENCIES
brakeman
capybara
debug
dockerfile-rails (>= 1.6)
importmap-rails
jbuilder
kamal
Expand Down
2 changes: 1 addition & 1 deletion app/views/scripts/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<div class="flex justify-between items-center">
<h1 class="font-bold text-4xl">Scripts</h1>
<%= link_to "New script", new_script_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
<%= link_to "New script", new_script_path, class: "rounded-lg py-3 px-5 bg-fuchsia-600 text-white block font-medium" %>
</div>

<div id="scripts" class="min-w-full">
Expand Down
4 changes: 4 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ production:
primary:
<<: *default
database: storage/production.sqlite3
url: <%= ENV["DATABASE_URL"] %>
cache:
<<: *default
database: storage/production_cache.sqlite3
migrations_paths: db/cache_migrate
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_cache" } if ENV["DATABASE_URL"] %>
queue:
<<: *default
database: storage/production_queue.sqlite3
migrations_paths: db/queue_migrate
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_queue" } if ENV["DATABASE_URL"] %>
cable:
<<: *default
database: storage/production_cable.sqlite3
migrations_paths: db/cable_migrate
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_cable" } if ENV["DATABASE_URL"] %>
6 changes: 6 additions & 0 deletions config/dockerfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# generated by dockerfile-rails

---
options:
label:
fly_launch_runtime: rails
52 changes: 52 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# fly.toml app configuration file generated for docroll on 2024-12-16T16:37:48+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'docroll'
primary_region = 'cdg'
console_command = '/rails/bin/rails console'

[build]

[env]
DATABASE_URL = 'sqlite3:///data/production.sqlite3'
PORT = '8080'

[processes]
app = './bin/rails server'

[[mounts]]
source = 'data'
destination = '/data'
auto_extend_size_threshold = 80
auto_extend_size_increment = '1GB'
auto_extend_size_limit = '10GB'

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 1
processes = ['app']

[checks]
[checks.status]
port = 8080
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 = '512mb'
cpu_kind = 'shared'
cpus = 1

0 comments on commit 333371a

Please sign in to comment.