[![Codestats](http://codestats-url/organizations/your-organization/projects/elasticsearch-rails-demo/badge)](http://codestats-url/organizations/your-organization/projects/elasticsearch-rails-demo/badge)
You can modify the pre-push.sh script to run different scripts before you git push
(e.g Rspec, Linters). Then you need to run the following:
chmod +x script/pre-push.sh
sudo ln -s ../../script/pre-push.sh .git/hooks/pre-push
You can skip the hook by adding --no-verify
to your git push
.
- Clone the repository by running
git clone [email protected]:Wolox/elasticsearch-rails-demo.git
- Go to the project root by running
cd elasticsearch-rails-demo
- Download and install Rbenv.
- Download and install Ruby-Build.
- Install the appropriate Ruby version by running
rbenv install [version]
whereversion
is the one located in .ruby-version
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt remove cmdtest # Some Ubuntu systems comes with cmdtest installed by default.
sudo apt-get update && sudo apt-get install yarn
- Install Bundler.
gem install bundler --no-ri --no-rdoc
rbenv rehash
- Install basic dependencies if you are using Ubuntu:
sudo apt-get install build-essential libpq-dev nodejs
- Install all the gems included in the project.
bundle install
Your app is ready. Happy coding!
Run in terminal:
sudo -u postgres psql
CREATE ROLE "elasticsearch-rails-demo" LOGIN CREATEDB PASSWORD 'elasticsearch-rails-demo';
Log out from postgres and run:
bundle exec rake db:create db:migrate
Your server is ready to run. You can do this by executing rails server
and going to http://localhost:3000. Happy coding!
Run in a terminal to install Webpacker dependencies:
rails webpacker:install
Install react dependencies running:
./script/react
Read more here
If you want to deploy your app using Heroku you need to do the following:
- Add the Heroku Git URL to your remotes
git remote add heroku-prod your-git-url
- Configure the Heroku build packs and specify an order to run the npm-related steps first
heroku buildpacks:clear
heroku buildpacks:set heroku/nodejs
heroku buildpacks:add heroku/ruby --index 2
- Push to Heroku
git push heroku-prod your-branch:master
Rollbar
is used for exception errors report. To complete this configuration setup the following environment variables in your server
ROLLBAR_ACCESS_TOKEN
with the credentials located in the rollbar application.
If you have several servers with the same environment name you may want to difference them in Rollbar. For this set the ROLLBAR_ENVIRONMENT
environment variable with your environment name.
Health check is a gem which makes an endpoint to check the status of the instance where this is running. It is configured for checking sidekiq and redis status, in addition to the migrations and the database. The first two default features in this bootstrap, but if you want to disable them, you should keep an eye on the configuration file of this gem and do not forget to remove them from the checks.
Add your code climate token to .travis.yml or docker-compose.yml
For the staging environment label to work, set the TRELLO_URL
environment variable.
Modified the XX-XXXXXXX-X
code in the _google_analytics.html.slim file
Just add a the meta
element to your view.
For example
= meta title: "My Title", description: "My description", keywords: %w(keyword1 keyword2)
You can read more about it here
To run the static analyzer for security vulnerabilities run:
bundle exec brakeman -z -i config/brakeman.ignore
We use dotenv to set up our environment variables in combination with secrets.yml
.
For example, you could have the following secrets.yml
:
production: &production
foo: <%= ENV['FOO'] %>
bar: <%= ENV['BAR'] %>
and a .env
file in the project root that looks like this:
FOO=1
BAR=2
When you load up your application, Rails.application.secrets.foo
will equal ENV['FOO']
, making your environment variables reachable across your Rails app.
The .env
will be ignored by git
so it won't be pushed into the repository, thus keeping your tokens and passwords safe.
It is a simple and useful way to look at Rails logs without having to look at the console, it also show queries executed and response times. Install the Rails Panel Extension (https://chrome.google.com/webstore/detail/railspanel/gjpfobpafnhjhbajcjgccbbdofdckggg). This is recommended way of installing extension, since it will auto-update on every new version. Note that you still need to update meta_request gem yourself.
You can find more documentation in the docs folder. The documentation available is:
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Run rspec tests (
bundle exec rspec spec -fd
) - Run scss lint (
bundle exec scss-lint app/assets/stylesheets/
) - Run rubocop lint (
bundle exec rubocop app spec -R
) - Push your branch (
git push origin my-new-feature
) - Create a new Pull Request
This project is maintained by Esteban Guido Pintos and it is written by Wolox.