Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/js/Components/CodeBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'prismjs/components/prism-json'
import 'prismjs/components/prism-jsx'
import 'prismjs/components/prism-markup-templating'
import 'prismjs/components/prism-php'
import 'prismjs/components/prism-ini'
import { useState } from 'react'

const CopyIcon = () => (
Expand Down
43 changes: 43 additions & 0 deletions resources/js/Pages/server-side-rendering.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const meta = {
{ url: '#running-the-ssr-server', name: 'Running the SSR server' },
{ url: '#client-side-hydration', name: 'Client side hydration' },
{ url: '#deployment', name: 'Deployment' },
{ url: '#supervisor-configuration', name: 'Supervisor configuration' },
],
}

Expand Down Expand Up @@ -543,6 +544,48 @@ export default function () {
<P>
To run the SSR server on Laravel Cloud, you may use Cloud's <A href="https://cloud.laravel.com/docs/compute#inertia-ssr">native support for Inertia SSR</A>.
</P>
<H3>Supervisor Configuration</H3>
<P>
In production, you should use a process monitor like Supervisor to ensure your SSR server stays running. Supervisor will automatically restart the SSR server if it crashes or stops unexpectedly.
</P>
<P>
First, install Supervisor:
</P>
<CodeBlock
language="bash"
children={dedent`
sudo apt-get install supervisor
`}
/>
<P>
Create a Supervisor configuration file at <Code>/etc/supervisor/conf.d/laravel-ssr.conf</Code>:
</P>
<CodeBlock
language="ini"
children={dedent`
[program:laravel-ssr]
command=php /path/to/your/app/artisan inertia:start-ssr
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-ssr.log
`}
/>
<P>
Update and start the Supervisor process:
</P>
<CodeBlock
language="bash"
children={dedent`
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-ssr
`}
/>
<P>
Your SSR server will now automatically start on boot and restart if it fails.
</P>
<H3>Laravel Forge</H3>
<P>
To run the SSR server on Forge, you should create a new daemon that runs{' '}
Expand Down