Skip to content

Commit

Permalink
chore(docs): Update Docker and K8S deployment docs (#660)
Browse files Browse the repository at this point in the history
Closes VAX-1357 and VAX-1354.
  • Loading branch information
alco authored Nov 14, 2023
1 parent e92a7e3 commit 51c461f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
8 changes: 6 additions & 2 deletions docs/integrations/deployment/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ sidebar_position: 10

The Electric sync service is [packaged using Docker](https://github.com/electric-sql/electric/blob/main/components/electric/Dockerfile) and published to Docker Hub at [hub.docker.com/r/electricsql/electric](https://hub.docker.com/r/electricsql/electric).

The configuration options are documented at <DocPageLink path="api/service" />. For example:
See <DocPageLink path="usage/installation/service" /> to get familiar with configuring and running the sync service with Docker. An example invocation would be:

```shell
docker run \
-e "DATABASE_URL=postgresql://..." \
-e "LOGICAL_PUBLISHER_HOST=..." \
-e "PG_PROXY_PASSWORD=..." \
-e "AUTH_JWT_ALG=HS512" \
-e "AUTH_JWT_KEY=..." \
-p 5133:5133 \
-p 5433:5433 \
-p 65432:65432 \
electricsql/electric
```

If you'd like to run Electric and Postgres together in Docker, see the example Docker Compose files in [examples/starter/template/backend/compose](https://github.com/electric-sql/electric/tree/main/examples/starter/template/backend/compose).
If you'd like to run Electric and Postgres together in Docker, feel free to use the [Docker Compose file][1] from our starter template as a reference.

[1]: https://github.com/electric-sql/electric/blob/main/examples/starter/template/backend/compose/docker-compose.yaml
6 changes: 5 additions & 1 deletion docs/integrations/deployment/k8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 50

To run the [Electric sync service](../../api/service.md) in [Kubernetes](https://kubernetes.io) deploy the [Docker image](./docker.md) within a [Pod](https://kubernetes.io/docs/concepts/workloads/controllers/pod), usually via a [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment).

The container image needs ports `5133` and `5433` exposed and the environment variables described in <DocPageLink path="api/service" /> configured.
The container image needs ports `5133`, `5433` and `65432` exposed and the environment variables described in <DocPageLink path="api/service" /> configured.

For example:

Expand Down Expand Up @@ -37,6 +37,8 @@ spec:
value: "postgresql://..."
- name: LOGICAL_PUBLISHER_HOST
value: "..."
- name: PG_PROXY_PASSWORD
value: "..."
- name: AUTH_JWT_ALG
value: "HS512"
- name: AUTH_JWT_KEY
Expand All @@ -46,6 +48,8 @@ spec:
containerPort: 5133
- name: logical-publisher-tcp
containerPort: 5433
- name: pg-proxy-tcp
containerPort: 65432
```
You can organise a deployment of Electric with Postgres and any other services using a [Helm chart](https://helm.sh/docs/topics/charts/).
19 changes: 13 additions & 6 deletions docs/usage/installation/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ See <DocPageLink path="api/service" /> for the full list of configuration option
Pre-packaged images are available on Docker Hub at [electricsql/electric](https://hub.docker.com/r/electricsql/electric). Run using e.g.:

```shell
docker pull electricsql/electric:latest
docker run \
-e "DATABASE_URL=postgresql://..." \
-e "LOGICAL_PUBLISHER_HOST=..." \
-e "PG_PROXY_PASSWORD=..." \
-e "AUTH_MODE=insecure" \
-p 5133:5133 \
-p 5433:5433 \
-p 65432:65432 \
electricsql/electric
```

Expand All @@ -48,30 +48,36 @@ docker run \
You can deploy the sync service together with [a Postgres database](./postgres.md) in a Docker Compose file. For example, save below contents to a file named `compose.yaml`:

```yaml
version: '3.1'
version: "3.1"

volumes:
pg_data:

services:
pg:
image: postgres
environment:
POSTGRES_PASSWORD: "pwd"
POSTGRES_PASSWORD: pg_password
command:
- -c
- wal_level=logical
ports:
- 5432:5432
restart: always
volumes:
pg_data:/var/lib/postgresql/data
volumes: pg_data:/var/lib/postgresql/data

electric:
image: electricsql/electric
depends_on:
- pg
environment:
DATABASE_URL: postgresql://postgres:pwd@pg
DATABASE_URL: postgresql://postgres:pg_password@pg/postgres
LOGICAL_PUBLISHER_HOST: electric
PG_PROXY_PASSWORD: proxy_password
AUTH_MODE: insecure
ports:
- 5133:5133
- 65432:65432
restart: always
```
Expand Down Expand Up @@ -99,6 +105,7 @@ docker run \
-e "AUTH_MODE=insecure" \
-p 5133:5133 \
-p 5433:5433 \
-p 65432:65432 \
-it electric:local-build
```

Expand Down

0 comments on commit 51c461f

Please sign in to comment.