Monday, July 31, 2017

Heroku production version: all 14 chapters completed (no mail server)

For the production version, I completed all 14 chapters of Michael Hartl's Ruby on Rails tutorial (https://www.railstutorial.org/) on July 31, 2017. The chapter 11 and 12 are skipped, so the email server is disabled.

The source code of the project is:
https://github.com/jimmy2046/sample_app_heroku_2

The URL hosting address of Heroku production is:
https://warm-ravine-91766.herokuapp.com/

Switch back to Intel Core2 Quad 2.50GHz

Today, I decided to switch back to use my Dell desktop computer with Intel Core2 Quad 2.50GHz CPU and 64-bit Ubuntu Linux 16.04 for Ruby on Rails development. I had put my old laptop with Intel T2080 1.73GHz "into the closet".

Sunday, July 30, 2017

Heroku SendGrid Add-on

The Heroku SendGrid Add-on allows a website to send emails to their members and it does not charge money for 400 emails a day but it needs credit card verification. For current time being, I decided NOT to install the SendGrid add-on. For Heroku production hosting, I shall skip Chapter 11: Account Activation and Chapter 12: Password Reset. And I shall go directly to Chapter 13: User Microposts.

Installing Heroku on 32-bit Ubuntu Linux

For version control, Ubuntu Linux comes with pre-installed git. For production deployment, Heroku CLI needs to be installed in order to push a Ruby on Rails project to Heroku for hosting.

This was what I did on my 32-bit Ubuntu Linux laptop computer.

shell terminal
$ heroku version
heroku: command not found

$ wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh

$ heroku version
heroku-cli/6.13.5 (linux-x86) node-v8.2.1

After I had installed Heroku, I needed to log in and add my public SSH key.
shell terminal
$ heroku login
$ heroku keys:add

Reference:
Heroku CLI | Heroku Dev Center - Debian/Ubuntu
https://devcenter.heroku.com/articles/heroku-cli#debian-ubuntu

Heroku Installation Log on 64-bit Ubuntu (April 2017 version)

I did not post the log file of Heroku installation that I did in April 2017. I just kept it on a text file of my local hard drive. Now, I found Heroku has updated their installation procedure. So, I think that is worth to post what I did for my Heroku installation on my desktop running on 64-bit Ubuntu Linux.

Download the Heroku CLI for Debian/Ubuntu
# Run this from your terminal.
# The following will add our apt repository and install the CLI:

sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install heroku
shell terminal
jimmyc@Jimmy-C-2017:~/gettingstarttedwithrails$ heroku login
Enter your Heroku credentials:
Email: jimmychong_st@yahoo.com
Password:
Logged in as jimmychong_st@yahoo.com
jimmyc@Jimmy-C-2017:~/gettingstarttedwithrails$ heroku keys:add
Found an SSH public key at /home/jimmyc/.ssh/id_rsa.pub
? Would you like to upload it to Heroku? Yes
Uploading /home/jimmyc/.ssh/id_rsa.pub SSH key... done
jimmyc@Jimmy-C-2017:~/gettingstarttedwithrails$ heroku create
Creating app... done, ⬢ immense-cove-17163
https://immense-cove-17163.herokuapp.com/ | https://git.heroku.com/immense-cove-17163.git
jimmyc@Jimmy-C-2017:~/gettingstarttedwithrails$

Installing PostgreSQL database for my 32-bit Linux laptop

I did not aware that, in production environment, Heroku uses PostgreSQL database. Therefore, if I want to deploy the Ruby on Rails project on Heroku, I have to install PostgreSQL on my 32-bit Linux laptop as well.

The procedure for installing PostgreSQL on Ubuntu Linux is explained on GoRails:
https://gorails.com/setup/ubuntu/16.04#postgresql

Setup Ruby On Rails on Laptop

Today, I installed Ruby on Rails on my Dell laptop running on Ubuntu Linux 16.04 (32-bit/i386). I just following the instructions on GoRails (https://gorails.com/setup/ubuntu/16.04) and everything seemed going smoothly. I also generated a new RSA SSH key in my laptop for Github account. So, my Github account has 2 public keys one. One key is for my desktop and another one is for my laptop computer. For my laptop, I just use the default Sqlite database and I did NOT install MySQL for my laptop. Because I think that I won't host the Ruby on Rails server and the database in a laptop computer.

Update: I have to install PostgreSQL database for Heroku production environment. Please see my next article. 


References:
Setup Ruby On Rails on Ubuntu 16.04 Xenial Xerus
https://gorails.com/setup/ubuntu/16.04


How to kill an abandoned process in Linux/Unix

I remembered it, then I forgot, then I remembered it, and then I forgot again. In case of a Linux/Unit process hang, I have to figure out ...