Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new recipe how to deploy an Inertia Rails app with Kamal and SSR support #167

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
17 changes: 4 additions & 13 deletions docs/cookbook/deploy-with-kamal.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,10 @@ export default defineConfig({
## Configure SSR URL in the Inertia's Rails adapter

To enable Server-Side Rendering (SSR) in your Inertia Rails application, you need to specify
the correct SSR server URL in the adapter. By default, the adapter points to `http://localhost:13714`,
but this must align with the **_VITE_RUBY_HOST_** value defined in your `deploy.yml` when we deploy it to production.

Update the configuration in `config/initializers/inertia_rails.rb` to dynamically construct the
SSR URL using Vite Ruby's protocol, host, and port settings:

```ruby
InertiaRails.configure do |config|
config.ssr_enabled = ViteRuby.config.ssr_build_enabled
config.ssr_url = "#{ViteRuby.config.protocol}://#{ViteRuby.config.host}:13714" # [!code ++]
config.version = ViteRuby.digest
end
```
the correct SSR server URL in the adapter. It can be set via the `INERTIA_SSR_URL` ENV variable.

Given we are using kamal 2, I would suggest to leverage [kamal secret](https://kamal-deploy.org/docs/commands/secrets/)
brodienguyen marked this conversation as resolved.
Show resolved Hide resolved
configuration at `.kamal/secrets`


## Deploy and enjoy 🎉
Expand Down