0
votes

After following this tutorial, I tried was able to set up a rails application on an ec2 Ubuntu instance, running nginx web server and puma app server, deployed with capistrano 3. However, none of my assets are showing up, and I'm getting routing errors for basic functions of the Devise gem such as logging out. The chrome dev tool console shows 404 errors for the compiled application.css and application.js files.

I think the assets are there because if I ssh into the instance and go to the folder where my app is, I can see a bunch of files under public/assets. Also, if I check the capistrano logs, I can find the line bundle exec rake assets:precompile, and the status for that is successful. I tried things like going into the production.rb file and changing config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? to config.serve_static_files = true

but still no assets. I think the biggest suspect is that there is some sort of routing error, because I don't really understand how web servers, app servers, and aws instances interact with each other. Could anyone point me in the right direction on debugging this? If you need to see a specific config file please comment below.

1
Do you have a specific need to use Capistrano for deployment? For Rails Apps on AWS deployment with ElasticBeanstalk simplifies things dramatically.hephalump
i like the workflow of Capistrano and also like the fact that it's relatively straight forward to customize your deploy tasks with Capistrano. Also I would just like to understand how to configure a server in general rather than always relying on a platformChaiTea
Fair enough. With ElasticBeanstalk you're able to customize your deployment tasks also, and you're able to configure the container in anyway you need.hephalump

1 Answers

0
votes

Ok it turns out all I had to do is copy the secrets.yml from the local repo for my app to the shared folder that is in [my_app_name]/shared/config. So my app didn't know where to look for the secret key base.

Although I'm still confused on why not having the secret.yml would prevent assets from served...