Skip to content

Commit 28fea19

Browse files
run mongodb as a service
1 parent 7a7ee57 commit 28fea19

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/deploy-changed-samples.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
TEST_MB_DB_PASS: ${{ secrets.TEST_MB_DB_PASS }}
8282
TEST_MB_DB_PORT: ${{ secrets.TEST_MB_DB_PORT }}
8383
TEST_MB_DB_USER: ${{ secrets.TEST_MB_DB_USER }}
84+
TEST_MONGO_INITDB_ROOT_USER: ${{ secrets.TEST_MONGO_INITDB_ROOT_USER }}
85+
TEST_MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.TEST_MONGO_INITDB_ROOT_PASSWORD }}
8486
TEST_NC_DB: ${{ secrets.TEST_NC_DB }}
8587
TEST_NC_S3_ENDPOINT: ${{ secrets.TEST_NC_S3_ENDPOINT }}
8688
TEST_NC_S3_BUCKET_NAME: ${{ secrets.TEST_NC_S3_BUCKET_NAME }}

samples/golang-mongodb-atlas/compose.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@ services:
99
target: 8080
1010
published: 8080
1111
environment:
12-
- MONGO_URI=your mongo db URI connection string
12+
- MONGO_URI=mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@db:27017/
1313
#deploy:
1414
# resources:
1515
# reservations:
1616
# memory: 256M
1717
healthcheck:
1818
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
19+
db:
20+
image: mongo:8.0.3
21+
restart: unless-stopped
22+
ports:
23+
- mode: host
24+
target: 27017
25+
environment:
26+
- MONGO_INITDB_ROOT_USERNAME
27+
- MONGO_INITDB_ROOT_PASSWORD

0 commit comments

Comments
 (0)