Hey for the cool fist, make sure you have eight gems and install support for Mysql:
Customizing Rails Applications
In this section, we will modify the Rails application servers to start working with the database server that we just created.
Install Database Server Libraries
The first thing to do is install the required database libraries. In our case, this is the MySQL development package.
Run the following to install the mysql-devel MySQL development package:
yum install -y mysql-devel
Setting Up .yml Database For Rails
The database settings for Rails applications are stored inside the database.yml file in the / config directory.
Run the following command to edit the database.yml file with a text editor:
As soon as you open this file, you will see the database settings separated by environment names. Since the application must be started using the working environment, edit the configuration for this.
Replace the YML production block as follows, changing the necessary bits according to your own configuration setting, for example. IP address etc.
# Example: # production: # adapter: mysql # encoding: utf8 # database: [database name] # username: [user name] # password: [password] # host: [server IP address] # port: [port number] # protocol: [protocol] # pool: [connection pool] production: adapter: mysql encoding: utf8 database: rails_myapp username: rails_myapp_user password: pwd host: 128.199.233.36 port: 3306 pool: 10
Note. As shown in the example above, you may need to specify a Protocol.
Note. The pool argument contains the number of maximum simultaneous database connection slots available (i.e. pool). You must evaluate your needs and set the number accordingly.
Save and exit by pressing CTRL + X and confirming with Y.
Getting mysql image
Start editing the gemfile with nano using the following:
nano Gemfile
Add the following line to the file:
gem 'mysql'
Save and exit by pressing CTRL + X and confirming with Y.
Install new pearls with the package:
bundle install
And this! From now on, Rails application servers will use your new database server for all operations.
You can find more information at: https://www.digitalocean.com/community/tutorials/scaling-ruby-on-rails-setting-up-a-dedicated-mysql-server-part-2