diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2306ec69..eae6bb5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,6 +80,7 @@ jobs: PLAID_CLIENT_ID: foo PLAID_SECRET: bar DATABASE_URL: postgres://postgres:postgres@localhost:5432 + REDIS_URL: redis://localhost:6379 RAILS_ENV: test services: @@ -92,6 +93,12 @@ jobs: - 5432:5432 options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 + redis: + image: redis + ports: + - 6379:6379 + options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: - name: Install packages run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libvips postgresql-client libpq-dev diff --git a/app/controllers/concerns/self_hostable.rb b/app/controllers/concerns/self_hostable.rb index a863f170..4208e03a 100644 --- a/app/controllers/concerns/self_hostable.rb +++ b/app/controllers/concerns/self_hostable.rb @@ -3,6 +3,8 @@ module SelfHostable included do helper_method :self_hosted?, :self_hosted_first_login? + + prepend_before_action :verify_self_host_config end private @@ -13,4 +15,29 @@ module SelfHostable def self_hosted_first_login? self_hosted? && User.count.zero? end + + def verify_self_host_config + return unless self_hosted? + + # Special handling for Redis configuration error page + if controller_name == "pages" && action_name == "redis_configuration_error" + # If Redis is now working, redirect to home + if redis_connected? + redirect_to root_path, notice: "Redis is now configured properly! You can now setup your Maybe application." + end + + return + end + + unless redis_connected? + redirect_to redis_configuration_error_path + end + end + + def redis_connected? + Redis.new.ping + true + rescue Redis::CannotConnectError + false + end end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index b921f89c..a3694fb9 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,7 +1,8 @@ class PagesController < ApplicationController - skip_before_action :authenticate_user!, only: %i[early_access] include Periodable + skip_authentication only: :redis_configuration_error + def dashboard @balance_sheet = Current.family.balance_sheet @accounts = Current.family.accounts.active.with_attached_logo @@ -47,12 +48,8 @@ class PagesController < ApplicationController render layout: "settings" end - def early_access - redirect_to root_path if self_hosted? - - @invite_codes_count = InviteCode.count - @invite_code = InviteCode.order("RANDOM()").limit(1).first - render layout: false + def redis_configuration_error + render layout: "blank" end private diff --git a/app/views/accountable_sparklines/_error.html.erb b/app/views/accountable_sparklines/_error.html.erb index 70ce745e..f43f609f 100644 --- a/app/views/accountable_sparklines/_error.html.erb +++ b/app/views/accountable_sparklines/_error.html.erb @@ -5,4 +5,4 @@
Error
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/accounts/_sparkline_error.html.erb b/app/views/accounts/_sparkline_error.html.erb index 2f813a0d..dbee8dbf 100644 --- a/app/views/accounts/_sparkline_error.html.erb +++ b/app/views/accounts/_sparkline_error.html.erb @@ -5,4 +5,4 @@Error
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/accounts/new/_method_selector.html.erb b/app/views/accounts/new/_method_selector.html.erb index e30c2463..03beaa92 100644 --- a/app/views/accounts/new/_method_selector.html.erb +++ b/app/views/accounts/new/_method_selector.html.erb @@ -11,7 +11,7 @@ <% if show_us_link %> <%# Default US-only Link %> - <%= link_to new_plaid_item_path(region: "us", accountable_type: accountable_type), + <%= link_to new_plaid_item_path(region: "us", accountable_type: accountable_type), class: "text-primary flex items-center gap-4 w-full text-center focus:outline-hidden focus:bg-gray-50 border border-transparent focus:border focus:border-gray-200 px-2 hover:bg-gray-50 rounded-lg p-2", data: { turbo_frame: "modal" } do %> @@ -23,7 +23,7 @@ <%# EU Link %> <% if show_eu_link %> - <%= link_to new_plaid_item_path(region: "eu", accountable_type: accountable_type), + <%= link_to new_plaid_item_path(region: "eu", accountable_type: accountable_type), class: "text-primary flex items-center gap-4 w-full text-center focus:outline-hidden focus:bg-gray-50 border border-transparent focus:border focus:border-gray-200 px-2 hover:bg-gray-50 rounded-lg p-2", data: { turbo_frame: "modal" } do %> diff --git a/app/views/chats/_chat.html.erb b/app/views/chats/_chat.html.erb index c61c5a04..129cdbe7 100644 --- a/app/views/chats/_chat.html.erb +++ b/app/views/chats/_chat.html.erb @@ -13,12 +13,12 @@ <%= render MenuComponent.new(icon_vertical: true) do |menu| %> <% menu.with_item( - variant: "link", - text: "Edit chat title", - href: edit_chat_path(chat, ctx: "list"), - icon: "pencil", + variant: "link", + text: "Edit chat title", + href: edit_chat_path(chat, ctx: "list"), + icon: "pencil", frame: dom_id(chat, "title")) %> - + <% menu.with_item( variant: "button", text: "Delete chat", diff --git a/app/views/credit_cards/new.html.erb b/app/views/credit_cards/new.html.erb index f6cd7bca..95bca964 100644 --- a/app/views/credit_cards/new.html.erb +++ b/app/views/credit_cards/new.html.erb @@ -1,7 +1,7 @@ <% if params[:step] == "method_select" %> - <%= render "accounts/new/method_selector", - path: new_credit_card_path(return_to: params[:return_to]), - show_us_link: @show_us_link, + <%= render "accounts/new/method_selector", + path: new_credit_card_path(return_to: params[:return_to]), + show_us_link: @show_us_link, show_eu_link: @show_eu_link, accountable_type: "CreditCard" %> <% else %> diff --git a/app/views/cryptos/new.html.erb b/app/views/cryptos/new.html.erb index a803df7b..8e93242f 100644 --- a/app/views/cryptos/new.html.erb +++ b/app/views/cryptos/new.html.erb @@ -1,7 +1,7 @@ <% if params[:step] == "method_select" %> - <%= render "accounts/new/method_selector", - path: new_crypto_path(return_to: params[:return_to]), - show_us_link: @show_us_link, + <%= render "accounts/new/method_selector", + path: new_crypto_path(return_to: params[:return_to]), + show_us_link: @show_us_link, show_eu_link: @show_eu_link, accountable_type: "Crypto" %> <% else %> diff --git a/app/views/depositories/new.html.erb b/app/views/depositories/new.html.erb index c2110726..23bbd79b 100644 --- a/app/views/depositories/new.html.erb +++ b/app/views/depositories/new.html.erb @@ -1,7 +1,7 @@ <% if params[:step] == "method_select" %> - <%= render "accounts/new/method_selector", - path: new_depository_path(return_to: params[:return_to]), - show_us_link: @show_us_link, + <%= render "accounts/new/method_selector", + path: new_depository_path(return_to: params[:return_to]), + show_us_link: @show_us_link, show_eu_link: @show_eu_link, accountable_type: "Depository" %> <% else %> diff --git a/app/views/imports/_table.html.erb b/app/views/imports/_table.html.erb index 5cc3a49c..8de7cea3 100644 --- a/app/views/imports/_table.html.erb +++ b/app/views/imports/_table.html.erb @@ -14,7 +14,7 @@Your self-hosted Maybe installation needs Redis to be properly configured.
+Why is Redis required?
+Maybe uses Redis to power Sidekiq background jobs for tasks like syncing account data, processing imports, and other background operations that keep your financial data up to date.
+Follow our complete Docker setup guide to configure Redis
+Once you've configured Redis, refresh this page to continue.
+ <%= render ButtonComponent.new( + text: "Refresh Page", + variant: "secondary", + icon: "refresh-cw", + type: "button", + full_width: true, + onclick: "window.location.reload()" + ) %> +