-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-ferretdb.sh
39 lines (31 loc) · 1.03 KB
/
start-ferretdb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
FERRETDB_VERSION=$1
FERRETDB_PORT=$2
FERRETDB_TELEMETRY=$3
USE_POSTGRES=$4
echo "Starting FerretDB version ${FERRETDB_VERSION} on port ${FERRETDB_PORT}"
if [ "$USE_POSTGRES" = "true" ]; then
echo "Starting FerretDB with Postgres"
docker network create ferretdb
docker run --network ferretdb --name postgres \
-e POSTGRES_USER=username \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=ferretdb \
-d postgres
docker run --network ferretdb --name ferretdb \
-p $FERRETDB_PORT:27017 \
-e FERRETDB_POSTGRESQL_URL=postgres://username:password@postgres:5432/ferretdb?pool_max_conns=40 \
-e FERRETDB_TELEMETRY=$FERRETDB_TELEMETRY \
-d ghcr.io/ferretdb/ferretdb:$FERRETDB_VERSION
else
echo "Starting FerretDB with sqlite"
docker run --name ferretdb \
-p $FERRETDB_PORT:27017 \
-e FERRETDB_HANDLER=sqlite \
-e FERRETDB_TELEMETRY=$FERRETDB_TELEMETRY \
-d ghcr.io/ferretdb/ferretdb:$FERRETDB_VERSION
fi
if [ $? -ne 0 ]; then
echo "Error starting FerretDB Docker container"
exit 2
fi