ReforMeter uses the following technologies:
- Ruby: 2.3
- Rails: 4.2.6
- Authentication: Devise 3.5.6
- Authorization: CanCanCan 1.10.1
- Model/Data Translations: Globalize 5.0
- Responsive Design: Twitter Bootstrap Rails 3.2.0
- Error Emails: Exception Notification 4.1
- Database: MySQL (mysql2 0.3.18)
- Deploy: Mina 0.3.8
- Rails Server: Puma 3.4.0
- HTML Server: Nginx
The following software/apps should be installed in order to use the application:
- git
- rbenv
- Ruby 2.x
- nginx - for staging/production server
Run the following from the command line:
- git clone git@github.com:JumpStartGeorgia/ReforMeter.git
- bundle install
- rake db:create
- rake db:seed load_test_data=true (this loads test data into the tables)
- create .env file from .env.example and fill in the variable values
bundle exec annotate --exclude fixtures
Add your stage-specific deploy variables to the files in config/deploy.
- Run
mina setup
- The default stage is set to
staging
, so this command is equivalent to the commandmina staging setup
- Run
mina rails:edit_env
and add your project secrets - Run
mina deploy first_deploy=true --verbose
- If you get the error “Host key verification failed” when mina tries to clone the git repository, you may have to add your repository’s host to known_hosts on your server. You can run one of these two commands on the server to fix that (works for github):
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- Adds github to user’s known hosts
ssh-keyscan -H github.com >> etc/ssh/ssh_known_hosts
- Adds github to known hosts for all users
- Run
mina post_setup sudo_user=<username>
, where<username>
is a user with sudo permissions on your server. You will need to enter the user’s password a number of times to execute the sudo commands. - Deploy further changes with
mina deploy
ormina deploy --verbose
- Repeat these steps for your other stages, simply by inserting the stage name into the command after
mina
. Examples:
mina setup
-->mina production setup
mina deploy precompile=true --verbose
-->mina production deploy precompile=true --verbose
[precompile=true] forces precompile assets [verbose=true] outputs more information (default is quieter and prettier)
Run mina -T
for a list of mina's commands.
Unlike in the standard Mina deploy, assets are precompiled locally and rsynced up to the server in this starter-template. The method is as follows:
- Determine whether to precompile the assets a. If the flag 'precompile=true' is set, then precompile assets b. Use git to view difference in the assets files between the commit on the server and the commit on the local machine. If there is a difference, precompile assets c. If cannot determine the commit on the server, show error and ask user to run deploy with 'precompile=true' d. If git diff gives an error, precompile assets
- If not precompiling assets, skip to step 3. Otherwise... a. precompile assets locally b. sync tmp/assets on server with local precompiled assets
- During deploy, copy assets from tmp/assets to current/public/assets
Setting up the Puma Jungle on the server allows you to run commands such as start, stop, status, etc. for multiple puma apps at one time. You can also configure it to restart all apps whenever the server reboots.
In order to setup the jungle, follow these steps. You may have to modify the default scripts to work on your server; if things don't work out of the box, try consulting this guide.
If your primary puma jungle script is stored at the default location /etc/init.d/puma
, here are some commands you can use (you may have to run with sudo):
/etc/init.d/puma start
/etc/init.d/puma stop
/etc/init.d/puma status
/etc/init.d/puma restart
This starter template provides access to the puma jungle through mina commands, such as mina puma:jungle:start
. Run mina -T puma:jungle
to see all these commands.