This is implementation of the Second Iteration.
The project is powered by Ruby, Node.js, Ruby on Rails, Backbone, and MySQL.
-
Install RVM.
Follow instructions on https://rvm.io/.
-
Install Ruby with the following command:
rvm install 2.2.3 rvm --default use 2.2.3 -
Install bundler with the following command:
gem install bundlerFor details see http://bundler.io.
-
Clone the project repository.
-
Open the project directory.
Currently Node.js 4.x is proven to be sufficient.
For details on how to install Node.js see https://nodejs.org.
-
Install MySQL related components with the following command:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
-
Install PhantomJS from PPA
sudo apt-add-repository ppa:tanguy-patte/phantomjs sudo apt-get update sudo apt-get install phantomjs
-
Install the project related dependencies:
bundle installIn the command above failed, something like the following may be needed:
bundle update <gem>Substitute
<gem>with particular gem name.
-
Generate secret token:
echo SECRET_KEY_BASE=`rake secret` > .env -
Add DB related credentials:
echo DATABASE_USER=user >> .env echo DATABASE_PASS=pass >> .envReplace
userandpasswith appropriate values. -
Add action mailer related credentials:
echo EMAIL_USER=user >> .env echo EMAIL_PASS=pass >> .envReplace
userandpasswith appropriate values. -
Create DB with the following command:
bundle exec rake db:create bundle exec rake db:migrate bundle exec rake db:seed
The application server is to be hosted on Heroku.
The Ruby version must be 2.2.3.
For the list of supported Ruby versions see appropriate Heroku documentation.
-
Create application on Heroku:
heroku create -
Put application on Heroku into maintenance state:
heroku maintenance:on -
Provision ClearDB add-on to provide Heroku dedicated MySQL server:
heroku addons:create cleardb:igniteHINT: For more details about ClearDB, see official documentation.
-
Create DB structure on Heroku:
heroku run rake db:migrate -
Put application on Heroku into operational state:
heroku maintenance:offHINT: It is recommended to put application back into maintenance state after checking that application is up and running.
HINT: It is possible to check logs to get some details about application, with the following command:
heroku logs
It is supposed to dump data from development environment.
All the related credentials are stored in the .env file.
-
Issue the following command:
mysqldump -u user_name -h host_name -p database_name > dump.sqlNOTE: You will be prompted for a password for specified DB
user_name.NOTE: Replace
user_name,host_name, anddatabase_namewith appropriate values.HINT: It is good idea to provide a file name with a human readable time stamp. So the previous command should look like the following:
mysqldump -u user_name -h host_name -p database_name > `date +%F_%k-%M-%S`_dump.sqlAs a result, the file name will look like
2015-11-23_12-27-32_dump.sql.
The application uses ClearDB add-on as a DB service.
-
Ensure the ClearDB is added and configured properly on Heroku.
-
Put application on Heroku into maintenance state:
heroku maintenance:on -
Get ClearDB credentials:
heroku configHINT: The output should contain the line that looks like as follows:
CLEARDB_DATABASE_URL: mysql://user_name:password@host_name/heroku_link?reconnect=true -
Issue the following command:
mysql --host=host_name --user=user_name -p --reconnect heroku_link < dump.sqlNOTE: You will be prompted for a password for specified
user_name.NOTE: Use
user_name,password,host_name, andheroku_linkstored inCLEARDB_DATABASE_URL. See the previous step for details.NOTE: The operation may take some time, at least 3-12 seconds.
-
Put application on Heroku into operational state:
heroku maintenance:off