All threads / Hatchbox deployment. public/index.html not found

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Hatchbox deployment. public/index.html not found

Tom Dringer asked in Servers

Hi,

I am deploying to hatchbox and everything appears fine until i load the site up in the browser. Looking at the logs there is no public/index.html. On my development environment there is also no index file in public. I am using Rails 6 which apparently doesn't build a public index.html file?

The Rails root path is what will be rendered first. If that isn't found, it'll fall back and look for index.html in the public folder. Normally you have a Rails root so the index.html would never be used.

Cool can i set this somewhere? My path should be pretty default. Its just app/

You'd define it in config/routes.rb

root to: "controller#action"

In development, Rails will show the "welcome to Rails" screen, but in production that disappears and would 404 without a root route.

Ok i made a staging enviroment in my app, which i guess could be the issue. I have environment variables on Hatchbox using staging, rather than p[roduction. I'll dig deeper. Thanks

To run staging on your server, make sure you have RAILS_ENV=staging set in the env vars. 👍

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 38,558+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.