Hosting heroku.com + custom domain name * setup for beginners
So, I have never seen such material anywhere, so I consider it necessary to publish this information.
We register on Heroku.com a letter with a link comes quickly, it came to me in 30 seconds.
Next, you need to install git, I worked in windows OS ( how to install in linux, I think those who use it know ), here is the version for win , if you use the portable version, then you need to go to the directory ( where unpacked ) in the command line interface git , and run either the git-bash.bat shell ( it’s more convenient for me to work with it ), or use only cmd, git-cmd.bat commands.
Next, you need to install gem heroku with the command ( sudo ) gem install heroku , it has dependencies with other gems, in general, they will be automatically installed, but if not, here are the links for them: rest-client , launchy , json .
Next, create an application, I created the simplest rack application (the rack is automatically installed when we install the heroku gem, but if not, then ( sudo ) gem install rack ), well, you can naturally create what you want, put the config.ru file in any folder with the following content: run lambda { |env| [ 200, {"content-type" => "text/html"}, "hello from russia, time is now #{ Time.now }" ] }
Go to the folder with the application, initialize the command git init , add git add. , we sign git commit -m 'new Rack app' .
We create an application on heroku with the heroku create command any-name-in-English (if you don’t set the last parameter, then it will call the application from the bald, such as blooming-cloud-48), it will ask you to enter an email and password, and then generate RSA keys. git remote will automatically add!
Fill our heroku app with the git push heroku master command .
Heroku Supports user domains, DNS in CNAME format, is a condition of their architecture . I purchased a domain here , for 85 p. in the .ru zone, filled up the balance through yandex money, but they didn’t come right away - I had to write in support, after that the money was credited. Here you can manage DNS records of the CNAME type, but if your domain control panel does not support this function, you can see how this problem is solved using free DNS services.
We buy a domain ( if you don’t have one ), everything is elementary there.
Select the item “use registrar server”, click change, and now zone management is available
Well, here, I think, everything is also intuitively clear, in the first line there is @ so that we can enter the domain without the www prefix, and in the second line with it.
We check if DNS and our domain work with the command host www.example.com , the answer should be something like this (I used SSH access to my application, and checked from there) if it writes something like “not found”, check the DNS settings, ask if someone else will check, or create a GRPS connection and check through it.
Go to the folder with your application on the local computer, using the heroku domains: add www.somedomainname.com command , assign a domain to your application, the result is about
We go to the domain address and everything should work right away ( it worked instantly for me ).
Well that's all oh yes, your RACK | RAILS | MERB application, by default it works in production mode The application works here it-karma.ru and www.it-karma.ru #update pictures reloads on photobucket.com, fixed minor bugs.