Skip to content

LuisFros/rails-dockerizado

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rails Dockerizado Circle CI

This is a Rails application, initially generated using Potassium by Platanus.

Local installation

First, make sure you have docker and docker-compose installed

Assuming you've just cloned the repo, run the following commands:

  1. Build the images
docker-compose build
  1. Run the setup binstub
docker-compose run runner ./bin/setup

It assumes you have a machine equipped Docker

The script will do the following among other things:

  • Install the dependecies
  • Prepare your database
  • Adds heroku remotes
  1. After the app setup is done you can run it with
docker-compose up <service_name1> <service_name2> ...

For example to run with only Rails and Webpacker:

docker-compose up rails webpacker

Run with Rails, Webpacker and Sidekiq:

docker-compose up rails webpacker sidekiq
  • To run any commands for the rails app, use the runner service.
docker-compose run runner <command_name>

Deployment

This project is pre-configured to be (easily) deployed to Heroku servers, but needs you to have the Potassium binary installed. If you don't, then run:

$ gem install potassium

Then, make sure you are logged in to the Heroku account where you want to create the app and run

$ potassium install heroku --force

this will create the app on heroku, create a pipeline and link the app to the pipeline.

You'll still have to manually log in to the heroku dahsboard, go to the new pipeline and 'configure automatic deploys' using Github You can run the following command to open the dashboard in the pipeline page

$ heroku pipelines:open

Hint

Remember to connect each stage to the corresponding branch:

  1. Staging -> Master
  2. Production -> Production

That's it. You should already have a running app and each time you push to the corresponding branch, the system will (hopefully) update accordingly.

Continuous Integrations

The project is setup to run tests in CircleCI

You can also run the test locally simulating the production environment using docker. Just make sure you have docker installed and run:

bin/cibuild

Style Guides

The style guides are enforced through a self hosted version of Hound CI. The style configuration can also be used locally in development runing rubocop or just using the rubocop integration for your text editor of choice.

You can add custom rules to this project just adding them to the .ruby-style.yml file.

Sending Emails

The emails can be send through the gem send_grid_mailer using the sendgrid delivery method. All the action_mailer configuration can be found at config/mailer.rb, which is loaded only on production environments.

All emails should be sent using background jobs, by default we install sidekiq for that purpuse.

Testing in staging

If you add the EMAIL_RECIPIENTS= environmental variable, the emails will be intercepted and redirected to the email in the variable.

Internal dependencies

Authorization

For defining which parts of the system each user has access to, we have chosen to include the Pundit gem, by Elabs.

Authentication

We are using the great Devise library by PlataformaTec

Active Storage

For managing uploads, this project uses Active Storage.

Rails pattern enforcing types

This projects uses Power-Types to generate Services, Commands, Utils and Values.

Presentation Layer

This project uses Draper to add an object-oriented layer of presentation logic

Error Reporting

To report our errors we use Sentry

Scheduled Tasks

To schedule recurring work at particular times or dates, this project uses Sidekiq Scheduler

Queue System

For managing tasks in the background, this project uses Sidekiq

Seeds

To populate your database with initial data you can add, inside the /db/seeds.rb file, the code to generate only the necessary data to run the application. If you need to generate data with development purposes, you can customize the lib/fake_data_loader.rb module and then to run the rake load_fake_data task from your terminal.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published