Heroku app moving to VPS, dns fails - ruby-on-rails

I've removed my app from Heroku, but I forgot to remove my custom domain from heroku. Now i'm stuck with two versions of one site. .nl is working correctly, www..nl is giving me the error message "Heroku | No such app"
What to do? I've already edited my DNS records, but still doesn't fix this problem,
Many thanks,

If you are getting a Heroku message, then your DNS is still pointing to Heroku. There is no Heroku setting that could cause it to take control unless your DNS is sending traffic there.
If http://something.nl is working, but http://www.something.nl is not, then you probably didn't change all of your DNS settings properly.
The only other option I can think of is that your webserver on your VPS is routing traffic from www to the Heroku app, that is very unlikely though.
Last option... wait longer for DNS propagation if everything is correct.

Related

Rails Heroku SSL and Network Solutions

Last night I migrated a site to Heroku with Network Solutions. The process went well for WEBSITE.com and www.WEBSITE.com, but https://WEBSITE.com does not work. I have the CName "*.WEBSITE.com" set to "WEBSITE.com.herokudns.com." and www.WEBSITE.com set to www.WEBSITE.com.herokudns.com.
Network Solutions said it will take time for the root URL to work through the system.

www.sample.com automatically redirected to sample.com

I'm running two sites on Linode. Testing server.
I have one Wordpress site running on sample.com
I have another Ghost site that I want to run on www.sample.com
Note: the first one doesn't have www prefix
However when I try to access www.sample.com my browser instantly shows my Wordpress site at sample.com ( the one without www )
I can not narrow down where this setting is being enforced at.
I figure it either has to be in the Linode DNS settings -OR- in the nginx server settings. I can't find anything indicating that there should be a redirect of any kind.
Ammendment: On the nginx side, there is are two configuration files. The default server config file is pointing to the Wordpress installation which is loading for both www and non-www cases.
Ammendment: The remaining 1 configuration file is pointing to the Ghost installation.
Ammendment: When using the same two configuration files, but only changing the hostname to be "mail." instead of "www." the ghost installation loads just fine. The "mail." host was already registered in the dns settings, so I just borrowed it as a test.
What am I not consdering?
I'm not quite sure what happened. But, 24 hours later, the problem went away. Somewhere in the pipeline, old host/ip/port sets were getting cached and I couldn't resolve where. But, now it's working fine.
Thanks Richard Smith for taking time to talk me through it.

How can I automatically restart my Heroku app when there's a server error?

I have a Rails 4.2 app running on Heroku. Occasionally there is an issue that causes most incoming requests to get a server error. For example, there could be a memory leak or a max database connection issue. How can I setup a script or service to automatically restart the server when it detects errors?
I think this service could ping the app every few minutes and if it detects an error, it should confirm there's really a problem and then run heroku restart. How could this be set up?
After Googling this topic, I came across Neptune.io, which seems to provide a useful service for this task.

Rails environment deployment issue?

I'm trying to deploy my first Rails app here, and I've been stuck on something since last night. I'm encountering some weird behaviors I can't explain.
I'm running Rails, Apache, Phusion Passenger, and for the moment, SQLite 3. (I'll move that over to MySQL shortly.) Currently this is being hosted on a too-small EC2 slice running Ubuntu Server 11.04 (Natty).
When I visit the address of the EC2 slice in the browser, I get the default Rails 500 notice. Here's what's weird, though. When I tail /log/production.log, I see the following error:
ActionView::Template::Error (SQLite3::SQLException: no such table: offers: SELECT "offers".* FROM "offers" WHERE (code = '') ORDER BY created_at desc LIMIT 25 OFFSET 0):
So, I manually opened up the development database in SQLite3, and saw that table in there. The production database, however, does not have that table.
OK, so I'm getting errors with the production database logged in the production log. The application has to be running in production mode, right?
That is what's throwing me. First of all, it's running in development mode on my development machine, and I didn't change any of the files when I deployed it. Neither did I use any fancy deployment tools to deploy it (which may have switched something without my knowledge) - I just did a simple git push.
Furthermore, I added the following to my httdp.conf VirtualHost config:
RailsEnv development
Also, when I run rails console, I can get the following:
irb(main):002:0> Rails.env
=> "development"
So, the application really should be running in development mode, right? In fact, it seems to think (partially) that it is, right?
I'm really not sure what's happening here, and I'd really appreciate some expert advice.
Thanks everyone.
Edit - A few server reboots later, and now the thing just hangs when I try to view it in a browser. Also, Apache seems to hang when I try to restart it (hence the server reboots), related problem, or different problem altogether?
Well, this isn't a 100% satisfactory answer for me, but I did two things, and I think I got it working.
First, I re-installed the passenger Apache module. That may or may not have been necessary.
This was the big thing, though: after I had added the line to httpd.conf to pass the Rails Environment over to Passenger, I believe Apache restarted incorrectly. (Rather, I believe I've been restarting Apache incorrectly for my whole life!)
I was trying to restart Apache this way:
sudo /etc/init.d/apache2 restart
That has always worked for me (when programming PHP), but it simply wasn't working here. Apache would just stall on the restart.
This, however, works fine:
sudo apachectl restart
I'll have to ask Server Fault what the significant difference is between the two.
I hope that helps someone out.

When to start thinking about deploying my rails app

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.

Resources