chore: prepare for deployment
This commit is contained in:
parent
cb78f82d6d
commit
08c08a402c
8 changed files with 83 additions and 2 deletions
18
.github/workflows/fly-deploy.yml
vendored
Normal file
18
.github/workflows/fly-deploy.yml
vendored
Normal file
|
@ -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 }}
|
|
@ -61,7 +61,7 @@ COPY --from=build /rails /rails
|
||||||
# Run and own only the runtime files as a non-root user for security
|
# Run and own only the runtime files as a non-root user for security
|
||||||
RUN groupadd --system --gid 1000 rails && \
|
RUN groupadd --system --gid 1000 rails && \
|
||||||
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
||||||
chown -R rails:rails db log storage tmp
|
chown -R rails:rails db log storage tmp data
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
|
|
||||||
# Entrypoint prepares the database.
|
# Entrypoint prepares the database.
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -36,3 +36,5 @@ group :test do
|
||||||
gem "capybara"
|
gem "capybara"
|
||||||
gem "selenium-webdriver"
|
gem "selenium-webdriver"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
gem "dockerfile-rails", ">= 1.7", :group => :development
|
||||||
|
|
|
@ -101,6 +101,8 @@ GEM
|
||||||
debug (1.10.0)
|
debug (1.10.0)
|
||||||
irb (~> 1.10)
|
irb (~> 1.10)
|
||||||
reline (>= 0.3.8)
|
reline (>= 0.3.8)
|
||||||
|
dockerfile-rails (1.7.9)
|
||||||
|
rails (>= 3.0.0)
|
||||||
drb (2.2.1)
|
drb (2.2.1)
|
||||||
erubi (1.13.1)
|
erubi (1.13.1)
|
||||||
et-orbi (1.2.11)
|
et-orbi (1.2.11)
|
||||||
|
@ -340,6 +342,7 @@ DEPENDENCIES
|
||||||
brakeman
|
brakeman
|
||||||
capybara
|
capybara
|
||||||
debug
|
debug
|
||||||
|
dockerfile-rails (>= 1.7)
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
nanoid
|
nanoid
|
||||||
|
|
|
@ -14,7 +14,11 @@ class InstanceController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@instance = Instance.includes(:pops, :fairies).find_by(public_id: show_instance_params)
|
@instance = Instance.includes(:pops, :fairies).find_by(public_id: show_instance_params)
|
||||||
@forecast = Weather.forecast(@instance.zone.to_sym)
|
if @instance
|
||||||
|
@forecast = Weather.forecast(@instance.zone.to_sym)
|
||||||
|
else
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pop
|
def pop
|
||||||
|
|
|
@ -84,15 +84,19 @@ production:
|
||||||
database: ecoffee_production
|
database: ecoffee_production
|
||||||
username: ecoffee
|
username: ecoffee
|
||||||
password: <%= ENV["ECOFFEE_DATABASE_PASSWORD"] %>
|
password: <%= ENV["ECOFFEE_DATABASE_PASSWORD"] %>
|
||||||
|
url: <%= ENV["DATABASE_URL"] %>
|
||||||
cache:
|
cache:
|
||||||
<<: *primary_production
|
<<: *primary_production
|
||||||
database: ecoffee_production_cache
|
database: ecoffee_production_cache
|
||||||
migrations_paths: db/cache_migrate
|
migrations_paths: db/cache_migrate
|
||||||
|
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_cache" } if ENV["DATABASE_URL"] %>
|
||||||
queue:
|
queue:
|
||||||
<<: *primary_production
|
<<: *primary_production
|
||||||
database: ecoffee_production_queue
|
database: ecoffee_production_queue
|
||||||
migrations_paths: db/queue_migrate
|
migrations_paths: db/queue_migrate
|
||||||
|
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_queue" } if ENV["DATABASE_URL"] %>
|
||||||
cable:
|
cable:
|
||||||
<<: *primary_production
|
<<: *primary_production
|
||||||
database: ecoffee_production_cable
|
database: ecoffee_production_cable
|
||||||
migrations_paths: db/cable_migrate
|
migrations_paths: db/cable_migrate
|
||||||
|
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_cable" } if ENV["DATABASE_URL"] %>
|
||||||
|
|
6
config/dockerfile.yml
Normal file
6
config/dockerfile.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# generated by dockerfile-rails
|
||||||
|
|
||||||
|
---
|
||||||
|
options:
|
||||||
|
label:
|
||||||
|
fly_launch_runtime: rails
|
44
fly.toml
Normal file
44
fly.toml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
# fly.toml app configuration file generated for ecoffee on 2025-03-11T20:11:31+01:00
|
||||||
|
#
|
||||||
|
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
|
||||||
|
#
|
||||||
|
|
||||||
|
app = 'ecoffee'
|
||||||
|
primary_region = 'fra'
|
||||||
|
console_command = '/rails/bin/rails console'
|
||||||
|
|
||||||
|
[build]
|
||||||
|
|
||||||
|
[env]
|
||||||
|
PORT = '8080'
|
||||||
|
|
||||||
|
[processes]
|
||||||
|
app = './bin/rails server'
|
||||||
|
|
||||||
|
[deploy]
|
||||||
|
release_command = "./bin/rails db:prepare"
|
||||||
|
|
||||||
|
[http_service]
|
||||||
|
internal_port = 8080
|
||||||
|
force_https = true
|
||||||
|
auto_stop_machines = 'stop'
|
||||||
|
auto_start_machines = true
|
||||||
|
min_machines_running = 1
|
||||||
|
processes = ['app']
|
||||||
|
|
||||||
|
[[http_service.checks]]
|
||||||
|
interval = '10s'
|
||||||
|
timeout = '2s'
|
||||||
|
grace_period = '5s'
|
||||||
|
method = 'GET'
|
||||||
|
path = '/up'
|
||||||
|
protocol = 'http'
|
||||||
|
tls_skip_verify = false
|
||||||
|
|
||||||
|
[http_service.checks.headers]
|
||||||
|
X-Forwarded-Proto = 'https'
|
||||||
|
|
||||||
|
[[vm]]
|
||||||
|
memory = '1gb'
|
||||||
|
cpu_kind = 'shared'
|
||||||
|
cpus = 1
|
Loading…
Add table
Reference in a new issue