Skip to content

Commit 7d6e1db

Browse files
nipunn1313Convex, Inc.
authored and
Convex, Inc.
committed
Improve local_backend and self-hosted readmes (#34006)
Reorder / change tone / encourage self-hosting and docker GitOrigin-RevId: 24770f3eb7dca96d45eb7565d1671a61393385e2
1 parent acafaf9 commit 7d6e1db

File tree

2 files changed

+63
-64
lines changed

2 files changed

+63
-64
lines changed

README.md

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
</p>
88

99
[Convex](https://convex.dev) is the open-source reactive database designed to
10-
make life easy for web app developers, whether you're a human or an LLM. Fetch
11-
data and perform business logic with strong consistency by writing pure
12-
TypeScript.
10+
make life easy for web app developers, whether human or LLM. Fetch data and
11+
perform business logic with strong consistency by writing pure TypeScript.
1312

1413
Convex replaces your database, server functions, scheduling, storage, vector
1514
search, etc. It includes
@@ -24,7 +23,8 @@ The best way to get started with Convex is to follow the
2423
The **[Convex managed hosted product](https://www.convex.dev/plans).** includes
2524
a generous free tier and provides a seamless, reliable, cost-effective platform
2625
that allows you to focus on building your application without worrying about
27-
infrastructure.
26+
infrastructure. Many small applications and side-projects can operate entirely
27+
on the free tier with zero cost and zero maintenance.
2828

2929
Development of the Convex backend is led by the Convex team. We
3030
[welcome bug fixes](./CONTRIBUTING.md) and
@@ -33,9 +33,11 @@ synced with any internal development work within a handful of days.
3333

3434
## Self Hosting
3535

36-
You can also opt to self-host Convex. Convex works with a variety of tools
37-
including Neon, Fly.io, RDS, sqlite, postgres, and more. There is a
38-
[self-hosting guide](./self-hosted/SELFHOSTING.md) available with some guidance.
36+
You can also opt to self-host Convex. The self-hosted product includes most
37+
features of the cloud product, including the dashboard and CLI. Self-hosted
38+
Convex works well with a variety of tools including Neon, Fly.io, Vercel,
39+
Netlify, RDS, Sqlite, Postgres, and more. There is a
40+
[self-hosting guide](./self-hosted/SELFHOSTING.md) available with instructions.
3941
Community support for self-hosting is available in the `#open-source` channel in
4042
the [Convex Discord](https://discord.gg/convex).
4143

@@ -57,27 +59,6 @@ To see how to contribute, visit [Contributing.md](./CONTRIBUTING.md).
5759
Instead of self-hosting via docker, you can run the Convex backend locally on
5860
your own machine.
5961

60-
## Using prebuilt binaries
61-
62-
You can download the latest precompiled binary release from
63-
[Releases](https://github.com/get-convex/convex-backend/releases). Only Apple
64-
x64, Apple Arm64 (Apple silicon), and Linux x64 binaries are currently available
65-
for download.
66-
67-
_Note: On MacOS you might need to hold the `option` key and double click the
68-
binary file in Finder once, to circumvent the
69-
[Gatekeeper](https://support.apple.com/en-us/102445) warning._
70-
71-
Then you can run it:
72-
73-
```sh
74-
./convex-local-backend
75-
```
76-
77-
Adjust the path based on where you downloaded the binary to or add it to your
78-
`PATH`. The backend will store its database in the directory where it is
79-
executed **from** (not where the binary file lives).
80-
8162
## Building from source
8263

8364
To get started, clone this repo:

self-hosted/SELFHOSTING.md

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,56 @@ Development of the Convex backend is led by the Convex team. We
2222
[love receiving feedback](https://discord.gg/convex). We keep this repository
2323
synced with any internal development work within a handful of days.
2424

25-
# Self Hosting Guide
26-
27-
First, you'll want to be get the
28-
[convex-local-backend binary](../crates/local_backend/README.md#running-the-convex-backend).
29-
30-
You can either build from source or use the precompiled binaries. Note that in
31-
order to self host properly, you will need to clone the `convex-backend`
32-
repository and get set up with rust, in order to use some of the administrative
33-
executables.
34-
35-
## Select an instance name
25+
# Self Hosting Via Docker [recommended]
3626

3727
Select a name for your instance. In the cloud product, this takes the form of
3828
something like "flying-fox-123". You can select whatever you want here. A good
3929
practice would be to pick something that matches the domain you host from,
4030
though it is not critical.
4131

42-
## Generate a new instance secret
32+
You'll need to have [Docker](https://docs.docker.com/desktop/) installed to run
33+
convex in Docker.
34+
35+
```sh
36+
cd self-hosted
37+
# Pull the latest docker images
38+
docker compose pull
39+
# Run the containers
40+
docker compose up
41+
```
42+
43+
Once your Convex backend is running in Docker, you can ask it to generate admin
44+
keys for use from the dashboard/CLI.
45+
46+
```sh
47+
docker exec convex-local-backend ./generate_admin_key.sh
48+
```
49+
50+
Visit the dashboard at `http://localhost:6791`. Using your admin key, push code
51+
to your backend. Admin key should be kept secure to just the developers who are
52+
administering the application on your backend.
53+
54+
```sh
55+
cd your_project
56+
npm install
57+
npx convex dev --admin-key 'flying-fox-123|01c046ab1512d9306a6abda3eedec5dfe862f1fe0f66a5aee774fb9ae3fda87706facaf682b9d4f9209a05e038cbd6e9b8' --url "http://127.0.0.1:3210"
58+
```
59+
60+
# Self Hosting Via Running Binary Directly
61+
62+
### Get convex-local-backend Binary
63+
64+
You can either [build from source](../README.md) or use the precompiled
65+
binaries. You can download the latest precompiled binary release from
66+
[Releases](https://github.com/get-convex/convex-backend/releases). If your
67+
platform is not supported, leave us a github issue. In the meantime, you can
68+
build from source.
69+
70+
_Note: On MacOS you might need to hold the `option` key and double click the
71+
binary file in Finder once, to circumvent the
72+
[Gatekeeper](https://support.apple.com/en-us/102445) warning._
73+
74+
### Generate a new instance secret
4375

4476
Instance secret is the secret to the backend. Keep very safe and only accessible
4577
from the backend itself. Generate a new random instance secret with
@@ -51,7 +83,7 @@ cargo run -p keybroker --bin generate_secret
5183
It will look like this:
5284
`4361726e697461732c206c69746572616c6c79206d65616e696e6720226c6974`
5385

54-
## Generate a new admin key
86+
### Generate a new admin key
5587

5688
With the instance name and instance secret, generate an admin key. Admin key is
5789
required to push code to the backend and take other administrator operations.
@@ -63,7 +95,11 @@ cargo run -p keybroker --bin generate_key -- flying-fox-123 4361726e697461732c20
6395
It will look like
6496
`flying-fox-123|01c046ab1512d9306a6abda3eedec5dfe862f1fe0f66a5aee774fb9ae3fda87706facaf682b9d4f9209a05e038cbd6e9b8`
6597

66-
## Run your backend instance
98+
### Run your backend instance
99+
100+
Adjust the path based on where you downloaded the binary to or add it to your
101+
`PATH`. The backend will store its database in the current-working-directory
102+
(not where the binary file lives).
67103

68104
Use the instance name and instance secret to start your backend.
69105

@@ -75,30 +111,12 @@ You can run `./convex-local-backend --help` to see other options for things like
75111
changing ports, convex origin url, convex site url, local storage directories
76112
and other configuration.
77113

78-
## Run your backend instance in Docker
79-
80-
You'll need to have [Docker](https://docs.docker.com/desktop/) installed to run
81-
convex in Docker.
82-
83-
```sh
84-
cd self-hosted
85-
# Pull the latest docker images
86-
docker compose pull
87-
# Run the containers
88-
docker compose up
89-
```
90-
91-
Once your Convex backend is running in Docker, you can ask it to generate admin
92-
keys.
93-
94-
```sh
95-
docker exec convex-local-backend ./generate_admin_key.sh
96-
```
114+
### Run the dashboard
97115

98-
Visit the dashboard at `http://localhost:6791` and use the CLI to push functions
99-
with the `--admin-key $ADMIN_KEY` and `--url http://127.0.0.1:3210` flags.
116+
You can run the dashboard locally with `just rush install` and `npm run dev`
117+
from `npm-packages/dashboard-common`.
100118

101-
## Push code to your backend
119+
### Use your backend.
102120

103121
Using your admin key, push code to your backend. Admin key should be kept secure
104122
to just the developers who are administering the application on your backend.

0 commit comments

Comments
 (0)