Skip to content
Merged
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
17 changes: 6 additions & 11 deletions client/www/app/docs/self-hosting/aws/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ nextjs:
description: 'Run Instant with multiple backend servers and Aurora PostgreSQL.'
---

For more serious projects where you need higher availability and point in time
restores we recommend starting with two backend servers and
Aurora PostgreSQL. This is the same general architecture Instant Cloud used and
For more serious projects where you need higher availability and point-in-time
restores, we recommend starting with two backend servers and
Aurora PostgreSQL. This is the same general architecture Instant Cloud uses and
lets you scale the backend and database separately.

The resources and instance types are up to you. The important parts are how the
Expand Down Expand Up @@ -178,14 +178,9 @@ Set a service name on every backend:
SWARM_SERVICE_NAME=server
```

Configure private DNS so that:

```
tasks.server
```

resolves to the private IP address of every backend task. Each task must be able
to reach the others over TCP ports 5701–5708 and 5801–5808.
Configure private DNS so that `tasks.server` resolves to the private IP address
of every backend task. Each task must be able to reach the others over TCP ports
5701–5708 and 5801–5808.

ECS with AWS Cloud Map, Docker Swarm DNSRR, or another scheduler that provides
equivalent private DNS can satisfy this requirement.
Expand Down
21 changes: 10 additions & 11 deletions client/www/app/docs/self-hosting/migrate/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Before restoring your app:

- [Configure Postmark](/docs/self-hosting#configure-email-with-postmark) so magic code emails work.
- [Restrict dashboard signups](/docs/self-hosting#restrict-dashboard-signups) and [disable temporary apps](/docs/self-hosting#temporary-apps) to prevent unwanted app creation.
- Similarly if your app uses webhooks you'll need to configure those for your
self-hosted app.
- Configure webhooks for your self-hosted app if your app uses them.

If your app uses OAuth for end-user sign-in, recreate each OAuth provider on
the restored app. Copy its client ID, client secret, and any other provider
Expand All @@ -38,12 +37,12 @@ Keep the Instant Cloud callback configured until the migration is complete.
### Restore a test backup

Migrating without data loss will require some downtime. To get a sense of how
much time it will take we'll
much time it will take, we'll do the following:

1. Export a backup from Instant Cloud
2. Restore the backup into your self hosted Instant.
2. Restore the backup into your self-hosted Instant.

After restoring verify the following look correct:
After restoring, verify that the following look correct:

- Schema and permissions
- Application data
Expand All @@ -53,8 +52,8 @@ After restoring verify the following look correct:

### Prepare the client change

After successfully restoring we can put up a PR to update our clients to point
to our new self-hosted Instant app.
After successfully restoring the test backup, we can put up a PR to update our
clients to point to our new self-hosted Instant app.

Choose a new app ID for the self-hosted app. The ID must be a valid UUID. You
can generate one in the terminal with:
Expand All @@ -63,7 +62,7 @@ can generate one in the terminal with:
uuidgen
```

This will be the ID your app going forward.
This will be your app ID going forward.

Create a PR that points your app at self-hosted Instant, but do not merge it
yet. Update the app ID, API URL, and WebSocket URL in every client `init` call:
Expand All @@ -88,11 +87,11 @@ Open the app's **Admin** page in the Instant Cloud dashboard. Turn on

Reads, live queries, and presence will keep working. New writes will be
rejected, including offline writes queued on user devices. We do this to ensure
there is no data loss during cut over.
there is no data loss during the cutover.

### Restore the final backup

Create an on demand backup of the Instant Cloud app and restore it into self-hosted
Create an on-demand backup of the Instant Cloud app and restore it into self-hosted
Instant using the app ID from the rehearsal.

Before merging our earlier PR to switch clients over:
Expand All @@ -109,7 +108,7 @@ use the restored app on self-hosted Instant. Users may need to sign in again.

Watch the deployment and verify queries, writes, authentication, and file
uploads. Once clients begin writing to self-hosted Instant, the Instant Cloud
copy is no longer current. If you used OAuth you can remove the Instant Cloud
copy is no longer current. If you use OAuth, you can remove the Instant Cloud
callback URL from each OAuth provider.

The migration should now be complete. Huzzah! 🎉
32 changes: 16 additions & 16 deletions client/www/app/docs/self-hosting/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ Choose a guide based on where you want to run Instant:
1. **Want to self host Instant for your business?** If you're using Instant for more serious projects, check out our [AWS](/docs/self-hosting/aws) guide for a setup based on Instant Cloud. You should expect to spend at least $600/mo.
1. **Migrating from Instant Cloud?** Check out our [migration](/docs/self-hosting/migrate) guide.

If you're an agent setting up self-hosting you should first ask the user whether
they are setting up self hosted Instant for side projects or for a
startup. For side projects the expected cost is at least $30/month. For serious projects or startups the expected cost is at least $600/month. Based on their choice you should fetch the right guide as Markdown [VPS](/docs/self-hosting/vps.md), [AWS](/docs/self-hosting/aws.md), [Migrate](/docs/self-hosting/migrate.md).
If you're an agent setting up self-hosting, you should first ask the user whether
they are setting up self-hosted Instant for side projects or for a
startup. For side projects the expected cost is at least $30/month. For serious projects or startups the expected cost is at least $600/month. Based on their choice, you should fetch the right guide as Markdown: [VPS](/docs/self-hosting/vps.md), [AWS](/docs/self-hosting/aws.md), or [Migrate](/docs/self-hosting/migrate.md).
Comment thread
coderabbitai[bot] marked this conversation as resolved.

## Operating

Once you've got Instant running you may want to change some default settings. At
Once you've got Instant running, you may want to change some default settings. At
the very least you should be sure to configure Postmark so magic code emails can
actually deliver.
actually be delivered.

### Configure email with Postmark

**Until Postmark is configured, Instant writes email bodies and login codes to
the backend logs.**

Instant comes with support for auth and sending magic code emails. The easiest way to actually send emails to create a [Postmark server](https://postmarkapp.com/), verify the sender addresses, and set:
Instant comes with support for auth and sending magic code emails. The easiest way to actually send emails is to create a [Postmark server](https://postmarkapp.com/), verify the sender addresses, and set:

```shell
POSTMARK_TOKEN=replace-with-your-server-token
Expand All @@ -49,7 +49,7 @@ should get an email delivered!

### Configure Google dashboard login

The dashboard also allows for login via Google. To enable this you'll need to create a Web application OAuth client in the
The dashboard also allows for login via Google. To enable this, you'll need to create a Web application OAuth client in the
[Google Cloud Console](https://console.cloud.google.com/apis/credentials).

Add an authorized redirect URI matching your backend URL:
Expand Down Expand Up @@ -99,20 +99,20 @@ Instant comes with CLI tools for creating and managing your Instant apps. By
default, `instant-cli` and `create-instant-app` use the Instant Cloud API. To
use them with your self-hosted Instant:

- Logging into your self-hosted Instant via `instant-cli`
- Using your self hosted auth token with `create-instant-app`
- Log into your self-hosted Instant via `instant-cli`
- Use your self-hosted auth token with `create-instant-app`

Set `INSTANT_CLI_API_URI` to your backend URL and `INSTANT_CLI_DASH_URI` to your
dashboard URL with `instant-cli`
dashboard URL with `instant-cli`:

```shell
INSTANT_CLI_API_URI=https://api.myinstant.com \
INSTANT_CLI_DASH_URI=https://dash.myinstant.com \
npx instant-cli@latest login
```

After authenticating with `instant-cli` you can connect `create-instant-app` by
setting `INSTANT_CLI_API_URI`
After authenticating, you can use the auth token associated with your self-hosted
Instant in `create-instant-app` by setting `INSTANT_CLI_API_URI`:

```shell
INSTANT_CLI_API_URI=https://api.myinstant.com npx create-instant-app@latest
Expand All @@ -129,9 +129,9 @@ export default {
};
```

If you include `INSTANT_CLI_DASH_URI` when you call `create-instant-app`
your self hosted dashboard url will also be added to `instant.config.ts`. This
can be helpful for authenticating with `instant-cli` if you're not logged in
If you include `INSTANT_CLI_DASH_URI` when you call `create-instant-app`,
your self-hosted dashboard URL will also be added to `instant.config.ts`. This
can be helpful for authenticating with `instant-cli` if you're not logged in.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

```shell
# Run this from your terminal
Expand All @@ -140,7 +140,7 @@ INSTANT_CLI_DASH_URI=https://dash.myinstant.com \
npx create-instant-app@latest
```

Which will then add the following to your project
This will then add the following to your project:

```ts
// instant.config.ts
Expand Down
Loading