Skip to content

Commit

Permalink
Fix hosted application (#339)
Browse files Browse the repository at this point in the history
**This PR:**
- Fixes a number of issues with the hosted application:
  - Restores key lines in `puma.rb`, which is how the hosting service knows what application to run
  - Seeds the database with data in production
  - Adds a `favicon.ico`
  • Loading branch information
louis-antonopoulos authored Aug 23, 2024
1 parent a4ef78f commit 8e6bf15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ FileUtils.chdir APP_ROOT do
end

puts "\n== Preparing database =="
system! "bin/rails db:drop db:create db:migrate"
output = `bin/rails db:drop db:create db:migrate`
puts output.lines.grep(/database|migrated/)

puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"

if ENV["RAILS_ENV"] == "production"
system! "bin/rails db:seed"
end

puts "\n== Tips =="
puts "- To seed the database, run `rails db:seed`. You must have the TMDB_API_KEY environment variable set."
puts "- To seed the database in development, run `rails db:seed`. You must have the TMDB_API_KEY environment variable set."
puts "- To run the example_app server, run `rails s`."

puts
Expand Down
2 changes: 2 additions & 0 deletions spec/example_app/config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
port ENV.fetch("PORT", 3000)
environment ENV.fetch("RAILS_ENV") { "development" }
rackup File.expand_path("../config.ru", __dir__)

# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
Expand Down
Binary file modified spec/example_app/public/favicon.ico
Binary file not shown.

0 comments on commit 8e6bf15

Please sign in to comment.