-
-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Cloud66 for deployment (#3309)
* Add back in 'My Profile' nav item for partners to set their name (#3231) * Force node to stay at version 16 to deploy properly * Add all cloud66 migration changes needed * Remove unneccesary work around for turbo-rails since we are not releasing it yet * Attempt fixing database connection on local db on staging
- Loading branch information
1 parent
58814c5
commit 88c2bf2
Showing
9 changed files
with
58 additions
and
40 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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
release: rails db:migrate | ||
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development} | ||
custom_web: bundle exec puma | ||
worker: bundle exec rails jobs:work | ||
clock: bundle exec clockwork clock.rb |
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,20 @@ | ||
require "rake" | ||
require "clockwork" | ||
require "clockwork/database_events" | ||
require_relative "./config/boot" | ||
require_relative "./config/environment" | ||
|
||
module Clockwork | ||
handler do |job| | ||
puts "Running #{job}" | ||
end | ||
|
||
every(1.day, "Periodically reset seed data in staging", at: "00:00") do | ||
if ENV["RAILS_ENV"] == "staging" | ||
rake = Rake.application | ||
rake.init | ||
rake.load_rakefile | ||
rake["reset_demo"].invoke | ||
end | ||
end | ||
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
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 |
---|---|---|
@@ -1,47 +1,39 @@ | ||
# Puma can serve each request in a thread from an internal thread pool. | ||
# The `threads` method setting takes two numbers a minimum and maximum. | ||
# The `threads` method setting takes two numbers: a minimum and maximum. | ||
# Any libraries that use thread pools should be configured to match | ||
# the maximum value specified for Puma. Default is set to 5 threads for minimum | ||
# and maximum, this matches the default thread size of Active Record. | ||
# and maximum; this matches the default thread size of Active Record. | ||
# | ||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i | ||
threads threads_count, threads_count | ||
|
||
# Specifies the `port` that Puma will listen on to receive requests, default is 3000. | ||
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } | ||
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } | ||
threads min_threads_count, max_threads_count | ||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000. | ||
# | ||
port ENV.fetch("PORT") { 3000 } | ||
|
||
# Specifies the `environment` that Puma will run in. | ||
# | ||
environment ENV.fetch("RAILS_ENV") { "development" } | ||
|
||
# Specifies the `pidfile` that Puma will use. | ||
# | ||
pidfile ENV.fetch("PIDFILE") { "/tmp/web_server.pid" } | ||
# Specifies the number of `workers` to boot in clustered mode. | ||
# Workers are forked webserver processes. If using threads and workers together | ||
# Workers are forked web server processes. If using threads and workers together | ||
# the concurrency of the application would be max `threads` * `workers`. | ||
# Workers do not work on JRuby or Windows (both of which do not support | ||
# processes). | ||
# | ||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 } | ||
|
||
workers ENV.fetch("WEB_CONCURRENCY") { 2 } | ||
# Use the `preload_app!` method when specifying a `workers` number. | ||
# This directive tells Puma to first boot the application and load code | ||
# before forking the application. This takes advantage of Copy On Write | ||
# process behavior so workers use less memory. If you use this option | ||
# you need to make sure to reconnect any threads in the `on_worker_boot` | ||
# block. | ||
# | ||
# preload_app! | ||
|
||
# The code in the `on_worker_boot` will be called if you are using | ||
# clustered mode by specifying a number of `workers`. After each worker | ||
# process is booted this block will be run, if you are using `preload_app!` | ||
# option you will want to use this block to reconnect to any threads | ||
# or connections that may have been created at application boot, Ruby | ||
# cannot share connections between processes. | ||
# | ||
# on_worker_boot do | ||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) | ||
# end | ||
|
||
# process behavior so workers use less memory. | ||
# | ||
preload_app! | ||
# Set the directory to Cloud 66 specific environment variable so that puma can follow symlinks to new code on redeployment | ||
# | ||
directory ENV.fetch("STACK_PATH") { "." } | ||
# Make sure to bind to Cloud 66 specific socket so that NGINX can direct traffic here | ||
# | ||
bind ENV.fetch("BIND") { "unix:///tmp/web_server.sock" } | ||
# Allow puma to be restarted by `rails restart` command. | ||
plugin :tmp_restart | ||
# plugin :tmp_restart |
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