Code Monkey home page Code Monkey logo

pathfinder-rails's People

Contributors

artero avatar dvdgs88 avatar fjsanpedro avatar mariotux avatar pablorc avatar xredo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pathfinder-rails's Issues

AssetSync gem is missing

For high-traffic sites we configure a CDN to serve static assets. The CDN is configured to point an Amazon S3 bucket instead of accessing directly to the application compiled assets.

AssetSync is our tool of choice to upload assets to Amazon S3 when deploying new versions of our software.

We need to make it compatible with the Pathfinder Cloud66 configuration: #6

Add Docker configuration files for standalone server deploys

Context

There are some projects with low traffic that can run in a standalone server or clients that prefer to have the application in their own infrastructure.

For some of this projects we are using Docker to manage the installation.

###Β Task description

Include in the PathFinder the required configuration files (Dockerfile, docker-compose) to be able to deploy the project to an standalone Docker server.

We are using an incorrect branch

We are always using the feature/modularize branch. We need to fix this to use the master branch.

path = if File.exists? @rails_template
          File.dirname(@rails_template)
        else
          @tmp_dir = Dir.mktmpdir
          run "git clone -b 'feature/modularize' [email protected]:MarsBased/pathfinder.git #{@tmp_dir}"
          @tmp_dir
        end

Add some instructions after prompt update

We need to add some gems instructions/info when asking for them to share repo url, explain what they do, prevent issues (like double compression: middleware gzip + nginx zip)...

Rails template doesn't work with Rails 5.x

Problem

Currently Rails template is not working for Rails 5.x projects.

  • There are gems not listed in the Gemfile
  • Installation of the Gemfile's Rails version doesn't work
  • Default Rails version in the Gemfile is 4.x
  • Sinatra is not working properly with Rails 5 because of some dependecy problems
  • Quiet assets can be removed for Rails 5 because it's already included

Proposed solution

We don't need to support both Rails 5 & Rails 4 in our generator. I suggest changing it to support Rails 5 only.

Replace Mailcatcher with Letter Opener Web

We are currently planning to open emails in the development environment using Mailcatcher. However, I find that Letter Opener Web has some advantages over Mailcatcher.

See gem documentation for more info: https://github.com/fgrehm/letter_opener_web

Don't confuse with letter_opener, that we discarded in the past because it opened a new browser tab every time an email was sent.

The advantages that I see to change are:

  • You don't need to start the Mailcatcher daemon.
  • In the environment development.rb file you clearly show that you are using letter_opener_web. With Mailcatcher you are sending to localhost:25
  • In staging environments, it's easier to show the letter opener web UI, as it's mounted in the application routes.

WDYT?

Review the default application_mailer

Review this model and think about how we should start working with it. After that, we should modify the variable config.mailer in the devise config file.

Status controller to monitor if the application is alive or not

Some of the code is depending on sidekiq. I'm leaving the code required to implement this.

Routes

resource :status, only: :show

Controller

class StatusesController < ApplicationController

  def show
    check_database
    check_sidekiq_redis
    head :ok
  end

  private

  def check_database
    ActiveRecord::Migrator.current_version
  end

  def check_sidekiq_redis
    Sidekiq.redis(&:info)
  end

end

Add Cloud66 deploy configuration files

At MarsBased we usually work with Cloud66. However, there are some configurations that need to be performed when deploying to Cloud66 with the Pathfinder tech stack.

This is a list of common features that we require:

  • Bower configuration
  • Node configuration
  • Fix carrierwave cache permissions
  • New relic configuration

We need to add them as an option to the Pathfinder.

Test feature setup

I think we should create a test codebase to check that every recipe works. This is a nice to have when we update rails gems, or perform a refactor in the code.

I suggest:

  • A way to run the wizard in a headless mode to generate a valid app
  • Make simple tests to be sure that the dependencies are properly setted up (for example, that rspec doesn't fail, or /admin returns a 200 response for active_admin)

What do you think?

Write README.md

Problem

Currently we have an empty README file. We need to improve it to add relevant information to the project.

Solution

Write a README file covering the following topics:

  • Brief description
  • Installation instructions
  • Options available

Write CONTRIBUTING.md

There is no contributing guide for MarsBased public repositories. We need to create one and then apply it to different projects.

Update the template with changes not in git

Problem

During one of our development projects we made changes to the rails_template.rb file but they weren't moved to the repository.

Proposed solution

Update the current Rails template with those changes.

Pocket doesn't load the images

Seems like our blog posts don't have sufficient information for Pocket to load the images.

Dunno what else to write, it's 3.19am ffs

It fails when executing generators

Steps to reproduce

Run the whole installation with default values.

Expected behavior

After creating the rails project, generators like rails generate devise:install should work.

Actual behavior

Generators launch this error:

config/environments/development.rb:59:in 'block in <top (required)>': uninitialized constant ActiveSupport::EventedFileUpdateChecker (NameError)

Maybe because something related to Rails 5: http://stackoverflow.com/questions/37978091/uninitialized-constant-activesupporteventedfileupdatechecker-in-env-config-fil

System configuration

Rails version: 5.0

Ruby version: 2.3.1

Add recovery from CSRF Exceptions

Use case

Sometimes Rails fails with a CSRF Exception. If the request is not AJAX we show an ugly error. If the request is AJAX it is even worse. The application fails silently.

These errors sometimes happen (without a malicious behaviour) when the browser is using a cached page to send a form.

Solution

To prevent this, we need to implement a workaround for these 2 situations. For the Ajax one, I recommend doing this:

Inside ApplicationController
rescue_from ActionController::InvalidAuthenticityToken, with: :recover_from_csrf_ajax_error

def recover_from_csrf_ajax_error
    fail ActionController::InvalidAuthenticityToken unless request.xhr?
    render :refresh_window
  end

and inside application/refresh_window.js

location.reload();

For the other one, maybe we want to render a flash.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.