A concise guide for making your Rails/Puma server in WSL accessible from external devices.
Edit config/puma.rb and add:
# Bind the server to all network interfaces to allow external access| # config/initializers/kill_server_pid_if_exists.rb | |
| # | |
| # Terminate the server process if it's running | |
| # Since its a dev env, no big deal | |
| if Rails.env.development? && !defined?(Rails::Console) && !defined?(Rake) | |
| pid_file = Rails.root.join("tmp/pids/server.pid") | |
| if pid_file.exist? | |
| pid = pid_file.read.to_i |
| require "image_processing/mini_magick" | |
| require "zip" | |
| require "ole/storage" | |
| # Basically, we return true if the file is password protected | |
| # We do this by trying to open the file and catching any errors | |
| # Note: if PDF check get too slow, we can replace mini_magick with a faster library like libvips | |
| module PasswordProtectedChecker | |
| class FileChecker |
| # syntax = docker/dockerfile:1 | |
| # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | |
| ARG RUBY_VERSION=3.2.2 | |
| FROM ruby:$RUBY_VERSION-slim as base | |
| # Rails app lives here | |
| WORKDIR /rails | |
| # ENVs are external .env |
Devise subdomain scope has a strategy: https://github.com/heartcombo/devise/wiki/How-to:-Scope-login-to-subdomain
This setup let users be scoped for subdomain, like SASS clients
Register/login in different subdomains ex.: user1.domain.com, user2.domain.com
To use this strategy out of the box with Acts As Tenant gem, we need to adapt it a little