Skip to content

Commit

Permalink
feat: added configurations for fly.io deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
dkdeptrai committed Oct 30, 2024
1 parent a5cd9df commit 2a24f09
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 6 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 }}
5 changes: 4 additions & 1 deletion .idea/g-scores.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ end
gem "csv", "~> 3.3"

gem "tailwindcss-rails", "~> 3.0"

gem "dockerfile-rails", ">= 1.6", :group => :development
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ GEM
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
dockerfile-rails (1.6.22)
rails (>= 3.0.0)
drb (2.2.1)
erubi (1.13.0)
globalid (1.2.1)
Expand Down Expand Up @@ -237,6 +239,7 @@ DEPENDENCIES
bootsnap
csv (~> 3.3)
debug
dockerfile-rails (>= 1.6)
importmap-rails
jbuilder
pg (~> 1.1)
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_sidebar.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<nav class="hidden md:flex h-[100vh] w-64 flex-col gap-8 bg-gradient-to-b from-yellow-400 to-cyan-700 px-2 py-8 text-xl"
<nav class="hidden md:flex h-full w-64 flex-col gap-8 bg-gradient-to-b from-yellow-400 to-cyan-700 px-2 py-8 text-xl"
data-navbar-target="menu">
<span class="self-center font-bold">Menu</span>
<%= link_to "Report", student_scores_report_path %>
Expand Down
7 changes: 3 additions & 4 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
<body class="bg-gray-100 h-[100vh] min-w-[400px] overflow-scroll" data-controller="navbar">
<%= render "layouts/header" %>

<main class="flex flex-row w-full">
<main class="flex flex-row h-full w-full">
<div class="hidden absolute inset-0 bg-black bg-opacity-50 z-40" data-navbar-target="overlay" data-action="click->navbar#close"></div>


<div class="fixed">
<div class="h-screen min-h-[1980px]">
<%= render "layouts/sidebar" %>
</div>

<div class="flex flex-col w-full overflow-y-scroll">
<div class="flex flex-col w-full h-screen overflow-y-scroll">
<%= render "layouts/notice" %>
<%= yield %>
</div>
Expand Down
8 changes: 8 additions & 0 deletions config/dockerfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# generated by dockerfile-rails

---
options:
label:
fly_launch_runtime: rails
postgresql: true
prepare: false
45 changes: 45 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# fly.toml app configuration file generated for g-scores on 2024-10-30T13:19:12+07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'g-scores'
primary_region = 'sin'
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 = '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 = '/'

0 comments on commit 2a24f09

Please sign in to comment.