Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
85e4608
[#30] Add current branch deploy fly workflow
mosharaf13 Jun 16, 2023
c8669a9
[#30] Add env in fly workflow
mosharaf13 Jun 16, 2023
bf98824
[#30] Update fly.toml
mosharaf13 Jun 16, 2023
434a882
[#30] Update fly.toml config
mosharaf13 Jun 16, 2023
f414f98
[#30] Add fly workflow for production
mosharaf13 Jun 16, 2023
1f33aa3
[#30] Remove prod workflow. Use fly deploy wokflow to deploy in prod …
mosharaf13 Jun 16, 2023
80a7646
[#30] Update fly toml config
mosharaf13 Jun 16, 2023
abf6cf8
[#30] Add deployed host
mosharaf13 Jun 16, 2023
263cd98
[#30] Add deployed host for development env
mosharaf13 Jun 16, 2023
830c075
[#30] Change app name in fly toml
mosharaf13 Jun 20, 2023
e5dd6ba
[#30] Add env to fly toml
mosharaf13 Jun 20, 2023
3f4ab68
[#30] Update fly toml
mosharaf13 Jun 20, 2023
7e47807
[#30] Enable logging for production
mosharaf13 Jun 20, 2023
12aadce
[#30] Add force https to fly config
mosharaf13 Jun 22, 2023
d0cbe9b
[#30] Change internal port in fly toml
mosharaf13 Jun 22, 2023
32484ec
[#30] Use github variable instead of secret for port in test producti…
mosharaf13 Jun 22, 2023
feb4b48
[#30] Change fly deploy workflow
mosharaf13 Jun 22, 2023
a0439c9
[#30] Add command to create tmp directory in fly deploy workflow
mosharaf13 Jun 22, 2023
bda8a8c
[#30] Add docker build to fly deploy workflow
mosharaf13 Jun 22, 2023
8192d94
[#30] Change port in fly toml
mosharaf13 Jun 22, 2023
f91a1e5
[#30] Update port in fly toml
mosharaf13 Jun 23, 2023
952352b
[#30] Update port in fly toml
mosharaf13 Jun 23, 2023
64741a8
[#30] Exclude healthcheck route from host authorization
mosharaf13 Jun 23, 2023
de10103
[#30] Add env variables for fly deploy
mosharaf13 Jun 23, 2023
9a18608
[#30] Change deployed host value and key
mosharaf13 Jun 23, 2023
47f32d0
[#30] Disable host authorization
mosharaf13 Jun 23, 2023
e6560a3
[#30] Change config host env access strategy
mosharaf13 Jun 23, 2023
64aebdd
[#30] Allow host authorization for all routes
mosharaf13 Jun 23, 2023
3e609bc
[#30] Change config hosts
mosharaf13 Jun 23, 2023
7cd091e
[#30] Add empty hash for host authorization
mosharaf13 Jun 23, 2023
9015669
[#30] Disable host authorization for all routes
mosharaf13 Jun 23, 2023
7925925
[#30] Consider all request local true in production
mosharaf13 Jun 23, 2023
792a042
[#30] Add asset precompilation step for fly deploy
mosharaf13 Jun 23, 2023
eaa26fc
[#30] Add fallback asset compilation in development.rb
mosharaf13 Jun 29, 2023
226c5ae
[#30] Remove docker precompilation from fly deploy workflow
mosharaf13 Jun 29, 2023
b16e336
[#30] Disable Detailed exceptions in production
mosharaf13 Jun 29, 2023
1bdb9f5
Merge branch 'develop' into chore/30-setup-cicd
mosharaf13 Jun 29, 2023
c614b23
[#30] Enable Detailed exceptions in production
mosharaf13 Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/deploy_fly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,27 @@ on:
branches:
- main
- develop
- chore/30-setup-cicd
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Build Docker image
run: bin/docker-prepare && docker compose build

- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
DOCKER_REGISTRY_HOST: ${{ vars.DOCKER_REGISTRY_HOST }}
DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }}
DOCKER_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_IMAGE: ${{ vars.DOCKER_IMAGE }}
BRANCH_TAG: ${{ vars.BRANCH_TAG }}
PORT: ${{ vars.PORT }}
BUILD_ENV: 'production'
NODE_ENV: 'production'
RUBY_ENV: 'production'
DEPLOYED_HOST: '.fly.dev'
RAILS_SERVE_STATIC_FILES: true
2 changes: 1 addition & 1 deletion .github/workflows/test_production_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
env:
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }}
DOCKER_IMAGE: ${{ github.repository }}
PORT: ${{secrets.PORT}}
PORT: ${{vars.PORT}}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
config.cache_store = :null_store
end

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true

# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local

Expand Down
7 changes: 4 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = true

# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
Expand All @@ -28,7 +28,7 @@
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
config.assets.compile = true

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
Expand Down Expand Up @@ -98,5 +98,6 @@
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

config.hosts << ENV['DEPLOYED_HOST']
config.hosts << '.fly.io'
config.host_authorization = { exclude: ->(_) { true } }
end
28 changes: 16 additions & 12 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# fly.toml app configuration file generated for google-scrapper-ruby on 2023-05-18T11:25:54+07:00
# fly.toml app configuration file generated for google-scrapper-ruby-prod on 2023-06-16T16:27:15+07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
Expand All @@ -7,28 +7,32 @@ app = "google-scrapper-ruby"
primary_region = "sin"
console_command = "/rails/bin/rails console"

[env]
RAILS_ENV = "production"
MAILER_DEFAULT_HOST = "localhost"
MAILER_DEFAULT_PORT = "25"
MAILER_SENDER = "Test <noreply@nimblehq.co>"
AVAILABLE_LOCALES = "en"
DEFAULT_LOCALE = "en"
FALLBACK_LOCALES = "en"
RAILS_LOG_TO_STDOUT = true
DEPLOYED_HOST = '.fly.dev'
RAILS_SERVE_STATIC_FILES = true

[http_service]
internal_port = 3000
internal_port = 80
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
min_machines_running = 1

[checks]
[checks.status]
port = 3000
port = 80
type = "http"
interval = "10s"
timeout = "2s"
grace_period = "5s"
method = "GET"
path = "/health_check"
protocol = "http"

[env]
DEPLOYED_HOST = "google-scrapper-ruby.fly.dev"
PORT = 3000
ASSET_HOST = ""
BUILD_ENV = "production"
NODE_ENV = "production"
RUBY_ENV = "production"