Skip to content

Commit 3e6f7ea

Browse files
committed
feat(api): introduce postgres
1 parent e5ba33f commit 3e6f7ea

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.env

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ SHELLHUB_DOMAIN=localhost
4343
# VALUES: A valid network name
4444
SHELLHUB_NETWORK=shellhub_network
4545

46+
# The host for PostgreSQL connection.
47+
SHELLHUB_POSTGRES_HOST=postgres
48+
# The port for PostgreSQL connection.
49+
SHELLHUB_POSTGRES_PORT=5432
50+
# The username for PostgreSQL authentication.
51+
SHELLHUB_POSTGRES_USER=admin
52+
# The password for PostgreSQL authentication.
53+
SHELLHUB_POSTGRES_PASSWORD=admin
54+
# The name of the default PostgreSQL.
55+
SHELLHUB_POSTGRES_DB=main
56+
4657
# Enable tunnels feature.
4758
SHELLHUB_TUNNELS=false
4859

docker-compose.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ services:
5050
- ASYNQ_UNIQUENESS_TIMEOUT=${SHELLHUB_ASYNQ_UNIQUENESS_TIMEOUT}
5151
- REDIS_CACHE_POOL_SIZE=${SHELLHUB_REDIS_CACHE_POOL_SIZE}
5252
- MAXIMUM_ACCOUNT_LOCKOUT=${SHELLHUB_MAXIMUM_ACCOUNT_LOCKOUT}
53+
- POSTGRES_HOST=${SHELLHUB_POSTGRES_HOST}
54+
- POSTGRES_PORT=${SHELLHUB_POSTGRES_PORT}
55+
- POSTGRES_USER=${SHELLHUB_POSTGRES_USER}
56+
- POSTGRES_PASSWORD=${SHELLHUB_POSTGRES_PASSWORD}
57+
- POSTGRES_DB=${SHELLHUB_POSTGRES_DB}
5358
depends_on:
5459
- mongo
5560
- redis
61+
- postgres
5662
links:
5763
- mongo
5864
- redis
65+
- postgres
5966
secrets:
6067
- api_private_key
6168
- api_public_key
@@ -138,6 +145,21 @@ services:
138145
command: ["redis-server", "--appendonly", "no", "--save", "\"\""]
139146
networks:
140147
- shellhub
148+
postgres:
149+
image: postgres:17
150+
healthcheck:
151+
test: ["CMD-SHELL", "pg_isready -U ${SHELLHUB_POSTGRES_USER} -d ${SHELLHUB_POSTGRES_DB}"]
152+
interval: 5s
153+
timeout: 5s
154+
retries: 5
155+
environment:
156+
- POSTGRES_USER=${SHELLHUB_POSTGRES_USER}
157+
- POSTGRES_PASSWORD=${SHELLHUB_POSTGRES_PASSWORD}
158+
- POSTGRES_DB=${SHELLHUB_POSTGRES_DB}
159+
ports:
160+
- "5432:5432"
161+
networks:
162+
- shellhub
141163

142164
secrets:
143165
ssh_private_key:

0 commit comments

Comments
 (0)