Skip to content

Commit c93a3d1

Browse files
emmaling27Convex, Inc.
authored andcommitted
Move docker instructions to docker directory (#34158)
GitOrigin-RevId: 45a05440903ecbb75eba8d243824a41158970275
1 parent ca05252 commit c93a3d1

File tree

12 files changed

+69
-62
lines changed

12 files changed

+69
-62
lines changed

.github/workflows/release_local_backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
DOCKER_BUILD_RECORD_UPLOAD: false
4646
with:
4747
context: .
48-
file: self-hosted/Dockerfile.backend
48+
file: self-hosted/docker-build/Dockerfile.backend
4949
tags: |
5050
ghcr.io/get-convex/self-hosted-backend
5151
cache-from: |

.github/workflows/release_local_dashboard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
DOCKER_BUILD_RECORD_UPLOAD: false
4343
with:
4444
context: .
45-
file: self-hosted/Dockerfile.dashboard
45+
file: self-hosted/docker-build/Dockerfile.dashboard
4646
tags: |
4747
ghcr.io/get-convex/self-hosted-dashboard
4848
cache-from: |

npm-packages/js-integration-tests/Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test-self-hosted *ARGS:
4646
just rush build -t .
4747
cargo build -p backend_harness --bin backend-harness
4848
just _test self-hosted-backend "$@"
49-
docker compose -f ../../self-hosted/docker-compose.yml down
49+
docker compose -f ../../self-hosted/docker/docker-compose.yml down
5050

5151
# Run tests without building the NPM packages or binaries
5252
_test *ARGS:

self-hosted/README.md

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,62 +24,7 @@ repository synced with any internal development work within a handful of days.
2424

2525
# Self Hosting Via Docker
2626

27-
You'll need to have [Docker](https://docs.docker.com/desktop/) installed to run
28-
convex in Docker.
29-
30-
```sh
31-
cd self-hosted
32-
# Pull the latest docker images
33-
docker compose pull
34-
# Run the containers
35-
docker compose up
36-
```
37-
38-
Note: if you see permissions issues, try `docker logout ghcr.io`.
39-
40-
Once your Convex backend is running in Docker, you can ask it to generate admin
41-
keys for use from the dashboard/CLI.
42-
43-
```sh
44-
docker exec convex-local-backend ./generate_admin_key.sh
45-
```
46-
47-
Using your admin key, push code to your backend. Admin key should be kept secure
48-
to just the developers who are administering the application on your backend.
49-
50-
Visit the dashboard at `http://localhost:6791`. The backend listens on
51-
`http://127.0.0.1:3210`. The backend's http actions are available at
52-
`http://127.0.0.1:3211`.
53-
54-
In your Convex project, add your url and admin key to a `.env.local` file (which
55-
should not be committed to source control):
56-
57-
```sh
58-
CONVEX_SELF_HOST_URL='http://127.0.0.1:3210'
59-
CONVEX_SELF_HOST_ADMIN_KEY='<your deploy key>'
60-
```
61-
62-
Now you can run commands in your Convex project, to push code, run queries,
63-
import data, etc. To use these commands, you'll need the latest alpha version of
64-
Convex.
65-
66-
```sh
67-
npm install convex@alpha
68-
```
69-
70-
```sh
71-
npx convex self-host dev
72-
npx convex self-host run <run args>
73-
npx convex self-host import <import args>
74-
npx convex self-host --help # see all available commands
75-
```
76-
77-
By default, the backend will store its data in a volume managed by Docker. Note
78-
that you'll need to set up persistent storage on whatever cloud hosting platform
79-
you choose to run the Docker container on (e.g. AWS EBS). The default database
80-
is SQLite, but for production workloads, we recommend running Convex backed by
81-
Postgres. Follow [these instructions](#self-hosting-on-postgres-with-neon) to
82-
connect to Postgres.
27+
See the [Docker instructions](./docker/README.md)
8328

8429
# Self Hosting with [Fly.io](https://fly.io/)
8530

self-hosted/docker-build/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Building docker images
2+
3+
The contents of this directory are used to build the docker images for the
4+
self-hosted backend and dashboard. If you're looking for ways to run self-hosted
5+
Convex, see the [these instructions](../README.md). You may build the images
6+
locally from here, but we recommend using the images we provide on GHCR.
File renamed without changes.

self-hosted/docker/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Self Hosting Via Docker
2+
3+
You'll need to have [Docker](https://docs.docker.com/desktop/) installed to run
4+
convex in Docker.
5+
6+
```sh
7+
cd self-hosted
8+
# Pull the latest docker images
9+
docker compose pull
10+
# Run the containers
11+
docker compose up
12+
```
13+
14+
Note: if you see permissions issues, try `docker logout ghcr.io`.
15+
16+
Once your Convex backend is running in Docker, you can ask it to generate admin
17+
keys for use from the dashboard/CLI.
18+
19+
```sh
20+
docker exec convex-local-backend ./generate_admin_key.sh
21+
```
22+
23+
Using your admin key, push code to your backend. Admin key should be kept secure
24+
to just the developers who are administering the application on your backend.
25+
26+
Visit the dashboard at `http://localhost:6791`. The backend listens on
27+
`http://127.0.0.1:3210`. The backend's http actions are available at
28+
`http://127.0.0.1:3211`.
29+
30+
In your Convex project, add your url and admin key to a `.env.local` file (which
31+
should not be committed to source control):
32+
33+
```sh
34+
CONVEX_SELF_HOST_URL='http://127.0.0.1:3210'
35+
CONVEX_SELF_HOST_ADMIN_KEY='<your deploy key>'
36+
```
37+
38+
Now you can run commands in your Convex project, to push code, run queries,
39+
import data, etc. To use these commands, you'll need the latest alpha version of
40+
Convex.
41+
42+
```sh
43+
npm install convex@alpha
44+
```
45+
46+
```sh
47+
npx convex self-host dev
48+
npx convex self-host run <run args>
49+
npx convex self-host import <import args>
50+
npx convex self-host --help # see all available commands
51+
```
52+
53+
By default, the backend will store its data in a volume managed by Docker. Note
54+
that you'll need to set up persistent storage on whatever cloud hosting platform
55+
you choose to run the Docker container on (e.g. AWS EBS). The default database
56+
is SQLite, but for production workloads, we recommend running Convex backed by
57+
Postgres. Follow
58+
[these instructions](../README.md#self-hosting-on-postgres-with-neon) to connect
59+
to Postgres.

self-hosted/docker-compose.yml renamed to self-hosted/docker/docker-compose.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ services:
2323
start_period: 5s
2424

2525
dashboard:
26-
build:
27-
context: .
28-
dockerfile: Dockerfile.dashboard
2926
image: ghcr.io/get-convex/self-hosted-dashboard:latest
3027
ports:
3128
- "${DASHBOARD_PORT:-6791}:6791"

0 commit comments

Comments
 (0)