rails-templates icon indicating copy to clipboard operation
rails-templates copied to clipboard

Remove the Figaro gem dependency

Open malparty opened this issue 2 years ago • 6 comments

Why

In order to unlock #316 (Update Ruby 3.1).

  • The Figaro gem did not receive any update since 3 years and prevents us from updating the Ruby version
  • Rails 7 projects now use default fallback values in the database.yml file (in case the ENV variable is not set). See this example
  • We already have a .env file for other default non-sensitive variables (the application.yml is actually confusing)

Resources

See https://github.com/nimblehq/rails-templates/pull/400 as reference of a first tentative.

Who Benefits?

Developers will be less confused about where the ENV default should go. Developers with the future possibility of using the next Ruby versions.

malparty avatar Feb 23 '23 04:02 malparty

@malparty any update on this issue

andyduong1920 avatar May 30 '23 07:05 andyduong1920

@andyduong1920 I'm struggling with tests, the containers won't build and I'm yet to understand why. Looking for debugging this when I have free time 🏃

malparty avatar Jun 02 '23 04:06 malparty

@andyduong1920 Update: I'm still struggling. I moved forward as the tests can execute to a much further step. But I still get errors about containers not reachable (even if previous tests where working with these containers).

The 2 main issues:

  • False negative on: https://github.com/nimblehq/rails-templates/actions/runs/5185231094/jobs/9344920937?pr=400 (when I rerun the job, it worked ><)
     Docker::Error::ConflictError:
       {"message":"Container 7e1f7573816916e3985b90b670453c7417575c03cc97928c9baa03ecc06b50b5 is not running"}
       
     # ./spec/base/config/environments/development_spec.rb:15:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Excon::Error::Conflict:
     #   Expected([200, 201, 202, 203, 204, 301, 304]) <=> Actual(409 Conflict)
     #   ./spec/base/config/environments/development_spec.rb:15:in `block (2 levels) in <top (required)>'
  • DB container not reachable on https://github.com/nimblehq/rails-templates/actions/runs/5185279454/jobs/9345169611
# ./spec/rails_helper.rb:13:in `<top (required)>'
# ./spec/codebase/codebase_spec.rb:3:in `require'
# ./spec/codebase/codebase_spec.rb:3:in `<top (required)>'
# ------------------
# --- Caused by: ---
# PG::ConnectionBad:
#   could not connect to server: Connection refused
#   	Is the server running on host "127.0.0.1" and accepting
#   	TCP/IP connections on port 5432?
#   could not connect to server: Cannot assign requested address
#   	Is the server running on host "::1" and accepting
#   	TCP/IP connections on port 5432?
#   /bundle/ruby/3.0.0/gems/pg-1.5.3/lib/pg/connection.rb:696:in `async_connect_or_reset'
No examples found.

I should admit that the current structure of the template (full containerized without a command to run this locally) makes debugging really time consuming 🥲

malparty avatar Jun 06 '23 06:06 malparty

In case we merged the https://github.com/nimblehq/rails-templates/pull/419 which use the new Figaro fork version, not sure we would need to remove the Figaro gem or not ;)

andyduong1920 avatar Jul 03 '23 07:07 andyduong1920

@andyduong1920 as this forked version has no guarantee to be maintained and has only a few stars, I think it might be better to use DotEnv in the long run.

I see the forked version as a transient improvement only: it is much better than the old Figaro, yet it does not solve the root issue of poor maintenance and a small community.

malparty avatar Jul 04 '23 03:07 malparty

@malparty yeah, we can remove the Figaro way @malparty 👍

andyduong1920 avatar Jul 04 '23 04:07 andyduong1920