Skip to content

Commit

Permalink
Updating docker-related files on the self-hosting page
Browse files Browse the repository at this point in the history
	modified:   docs/sdk/resources/self-hosting.md
  • Loading branch information
abernatskiy committed Dec 17, 2024
1 parent 693fc48 commit c996810
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions docs/sdk/resources/self-hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ Many tips from our [best practices guide](/cloud/resources/best-practices) apply
To deploy a squid locally or on-premises, use the following Dockerfile template to build a single image for both `api` and `processor` services:

```dockerfile title="Dockerfile"
FROM node:16-alpine AS node
FROM node:20-alpine AS node
FROM node AS node-with-gyp
RUN apk add g++ make python3
FROM node-with-gyp AS builder
WORKDIR /squid
ADD package.json .
ADD package-lock.json .
# remove if needed
ADD assets assets
ADD assets assets
# remove if needed
ADD db db
# remove if needed
Expand Down Expand Up @@ -69,20 +68,17 @@ if you're using an older Docker version.
Once can the run the squid services with the freshly built image. Here is a sample `docker-compose` file:

```yaml
version: "3"

services:
db:
image: postgres:15
environment:
POSTGRES_DB: squid
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"]
interval: 30s
timeout: 60s
test: ["CMD-SHELL", "pg_isready", "-d", "squid"]
interval: 5s
timeout: 5s
retries: 5
start_period: 80s
# Uncomment for logging all SQL statements
# command: ["postgres", "-c", "log_statement=all"]
api:
Expand All @@ -98,20 +94,23 @@ services:
- "4350:4350"
command: ["sqd", "serve:prod"]
depends_on:
- db
db:
condition: service_healthy
processor:
image: my-squid
environment:
- DB_NAME=squid
- DB_PORT=5432
- DB_HOST=db
- DB_PASS=postgres
# any other variables that your squid processor may be using
ports:
# prometheus metrics exposed at port 3000
- "3000:3000"
command: ["sqd", "process:prod"]
depends_on:
- db
db:
condition: service_healthy
```
Note that `sqd serve:prod` and `sqd process:prod` commands are defined in the [`commands.json` file](/squid-cli/commands-json).

0 comments on commit c996810

Please sign in to comment.