I spent hours on this railscast, http://railscasts.com/episodes/335-deploying-to-a-vps and this tutorial, https://coderwall.com/p/yz8cha(which is based on the railscast)
I successfully deployed my rails application to a vps. However things are not working properly I am trying to access my appliation log, in heroku is simply heroku log but where can I find this in my digital ocean vps? also heroku has specific instruction in storing pictures up in s3 do I need to configure the vps to talk to amazon s3?
Tail your production log at log/development.log
There are many tutorials via the Googles to answer your second question. Please attempt these before asking on SO.
Related
When I was developing my Rails app I noticed that it got extremely slow as soon as I included some background File creation via Amazon S3.
When I uploaded my site to Heroku the load time dropped a lot.
On my local server a page load takes about ~12s, on Heroku just ~1s.
Why does my app run that much slower on my local computer?
Does the Heroku server have a faster connection to the Amazon S3 servers?
To answer to your last question, yes, Heroku almost certainly has a faster connection to the AWS servers. According to the Heroku support page:
Heroku’s physical infrastructure is hosted and managed within Amazon’s secure data centers and utilize the Amazon Web Service (AWS) technology
Since they are both physically near and probably use the same datacenters as Amazon, any uploading / downloading to Amazon servers will be fast.
EDIT:
And as #Stefan noted, running rails in production mode speeds up a lot of stuff, including assets serving. You can try to run your server locally in production mode to see if that's the issue by running
$ rails s -e production
Trying to add SendGrid functionality to my heroku rails app by running heroku addons:create sendgrid:starter from my app's directory, but getting an error message each time:
Error Provisioning User - Whitelabel domain could not be located when creating customer
I'm also getting the exact same error when trying to add SendGrid Starter add-on directly through the Heroku web interface for my app.
My heroku account does have a credit card on file, so that shouldn't be the issue. This heroku app is on the free heroku tier, but I believe all the add-ons are supposed to be supported even for free heroku apps.
Has anyone run into this before? If so, any pointers on how to fix it?
It just worked. I believe it may have been the result of temporary service outage on the part of SendGrid (even though their system status pages indicated all services were up and running).
Sorry for the false alarm.
My problem is similar to AWS: None of the Instances are sending data but has a slightly different error message.
I have a Rails application running on ElasticBeanstalk, and it appears to be running correctly. Periodically, Enhanced Health Monitoring sends me error messages such as:
Environment health has transitioned from Ok to Degraded. 20.0 % of the
requests are failing with HTTP 5xx.
where the percentage varies up to 100%. Even though I've made no changes, a minute later I get a followup message telling me that everything is back to normal:
Environment health has transitioned from Degraded to Ok.
I've downloaded the full logs from ElasticBeanstalk but I don't know exactly where to look (there are around 20 different log files in various directories).
I'm currently using the free AWS tier with the smallest instances of database, server, etc. Could this be the cause? Which of the log files should I be looking in, and what should I be looking for?
I run rails apps on Elastic Beanstalk and have found it helpful to think about Beanstalk as a computer (in this case an Amazon EC2 instance) running your rails app and a web server (either Passenger or Puma). When you get a 500 error, it could be because your rails app didn't properly deploy–in which case Passenger or Puma will return an error—or your app is deployed properly but encountered an error just like it might on your local machine.
In either case, to diagnose an error, download the full logs from your AWS console (open the correct app environment and then choose Logs > Request Logs > Full logs > Download). Deployment errors are harder to diagnose, but I recommend starting by looking in var-XX/logs/log/eb-activity.log. I suspect your error is coming from your rails app itself, in which case I recommend looking in var-XX/app/support/logs/passenger.log and production.log. To find a 500 error, search for "500 Internal" and then treat the error like you would any other rails error.
You can go to the EC2 instance and run the application just like you would run on your local machine and see the logs.
You can ssh into your EC2 instance using the command eb ssh and go to /opt/python/ directory (It will be different for Ruby or other programming languages).
/opt/python/run is the directory where you will find the version of your application which is run from the EC2 instance. Look for the directory venv and app inside run directory.
Note: The above folder structure is for Python but a similar folder structure post deployment can be found for any other programming language. Just look for the standard directory structure for the deployment environment for your programming language.
For Python:
/opt/python: Root of where you application will end up.
/opt/python/current/app: The current application that is hosted in the environment.
/opt/python/on-deck/app: The app is initially put in on-deck and then, after all the deployment is complete, it will be moved to current. If you are getting failures in your container_commands, check out out the on-deck folder and not the current folder.
/opt/python/current/env: All the env variables that eb will set up for you. If you are trying to reproduce an error, you may first need to source /opt/python/current/env to get things set up as they would be when eb deploy is running.
/opt/python/run/venv: The virtual env used by your application; you will also need to run source /opt/python/run/venv/bin/activate if you are trying to reproduce an error.
I know it is a little late but I wanted to comment the trick I use to find the error, I use to connect via ssh and then, once in the app I try to enter "rails console" It uses to fail, but it shows normally the error you´re making. This little trick saved my life several times. Hope it helps!
I'm trying to deploy to an AWS EC2 staging instance.
I'm following these instructions:
http://alexbachuk.com/launch-rails-4-application-with-passenger-and-nginx/
When I create a test app and point to it via my local host, AWS successfully recognises the test page.
When I change the nginx conf to point to the actual app and try to point to it with my nginx server, I get a failure.
Does anyone know what's wrong with these instructions (or have any ideas what I could be doing wrong)?
The AWS deployment documentation is lacking. I can't get anything useful from there. Tearing my hair out and ready to use heroku.
Thank you.
There is a good tutorial here:
Setup a Ruby on Rails, Passenger, Nginx running on an AWS EC2 with RDS.
I have been testing an app and have all of the functionality worked out. Being my first go with ror I have a few questions about my next step; grateful for direction on this.
Should I do all of the design and UI before putting my app online, or after?
In trying to research this I have found three things that keep coming up as great tools to help deploy - Heroku, Capistrano, and Phusion Passenger. I know Heroku let's you deploy quickly and easily, but is this the option if I want my app at it's own URL? I currently host other websites (Wordpress) at Hostmonster, but they aren't supporting Rails 3 yet.
What is the difference between the functionality of Passenger and Capistrano? I have been searching, but not knowing some of the terminology, I'm not sure how to decipher all of it.
Go with Heroku — there's no need to clutter your brain with all of the hosting stuff since you don't already know it. Heroku is great, and you can easily have your own domain name. Point your nameservers to a.ns.zerigo.net and b.ns.zerigo.net and run…
heroku addons:add zerigo_dns
heroku domains:add example.com
heroku domains:add www.example.com
Set your domain's DNS servers to a.ns.zerigo.net and b.ns.zerigo.net.
And done deal, you're ready to deploy on Heroku. Your first dyno (app instance) is free, Zerigo's basic dns is free. You're rolling with 2TB/bandwidth (soft limit) and a whole lotta request-serving for a grand total of $0 and 15 minutes.
And for deployment, from start to finish here (provided you develop within the limitations of Heroku's platform [ie. read-only filesystem, PostgreSQL, bundler-dependent]):
heroku create yourapp
git push heroku master
heroku open # opens yourapp.herokuapp.com in your default browser
If you need to configure your DNS records:
heroku addons:open zerigo_dns
It's like magic, but it's all just solid engineering.
And to be clear, I don't work for Heroku.
Whether to finish your UI designing before going live is a decision you have to make. I don't think this will have any rails - deployment related consequences. So if you want to deploy and release fast in a rapid manner, go ahead.
You should be able to use your own domain name even if you are hosting with heroku. Take a look at this
Capistrano lets you deploy your apps with ease. So you don't have to login to your remote server and pull code from git, restart services...etc etc. You can just run cap deploy from your workstation and everything will be deployed on your server and all services will be restarted..etc.
While passenger is something like mod_php. It hosts your application. It works with apache or nginx. You will most probably end up using both capistrano and passenger. I don't think they are comparable because they do two different things.