-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now authenticating with the correct database
- Loading branch information
Patrick Meade
committed
Aug 8, 2024
1 parent
2ae4ed9
commit 4f9bd23
Showing
11 changed files
with
112 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
#!/usr/bin/env bash | ||
# build-docker | ||
|
||
# use `docker buildx build` to create a Docker image of the application | ||
# by default the image is `wipac-disk-tracking:latest-SNAPSHOT` unless | ||
# you set the BUILD_TAG environment variable before calling the script | ||
|
||
: ${BUILD_TAG:="latest-SNAPSHOT"} | ||
|
||
docker buildx build \ | ||
--file Dockerfile \ | ||
--tag wipac-disk-tracking:latest-SNAPSHOT \ | ||
--tag wipac-disk-tracking:${BUILD_TAG} \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
#!/usr/bin/env bash | ||
# run-app | ||
|
||
# use `cargo run` to run an instance of the application locally | ||
# when starting this script, you can provide one of the environment | ||
# variables listed below to override the defaults | ||
|
||
export MONGODB_DATABASE=${MONGODB_DATABASE:="disk_tracking"} | ||
export MONGODB_HOSTNAME=${MONGODB_HOSTNAME:="localhost"} | ||
export MONGODB_PASSWORD=${MONGODB_PASSWORD:="hunter2"} | ||
export MONGODB_PORT=${MONGODB_PORT:="27017"} | ||
# export MONGODB_USERNAME=${MONGODB_USERNAME:="disk_tracking"} | ||
export MONGODB_USERNAME=${MONGODB_USERNAME:="root"} | ||
export MONGODB_PORT_NUMBER=${MONGODB_PORT_NUMBER:="27017"} | ||
export MONGODB_USERNAME=${MONGODB_USERNAME:="disk_tracking"} | ||
export PORT=${PORT:="8080"} | ||
export RUST_LOG=${RUST_LOG:="debug"} | ||
|
||
cargo run --bin wipac-disk-tracking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
#!/usr/bin/env bash | ||
# run-app-docker | ||
|
||
# use `docker run` to run an instance of the application in a Docker | ||
# container. when starting this script, you can provide one of the | ||
# environment variables listed below to override the defaults | ||
|
||
: ${DOCKER_CONTAINER_NAME:="disk_tracking"} | ||
: ${DOCKER_MONGO_CONTAINER_NAME:="disk_tracking_mongo"} | ||
: ${MONGODB_DATABASE:="disk_tracking"} | ||
: ${MONGODB_HOSTNAME:="localhost"} | ||
: ${MONGODB_PASSWORD:="hunter2"} | ||
: ${MONGODB_USERNAME:="disk_tracking"} | ||
: ${MONGODB_PORT_NUMBER:="27017"} | ||
: ${PORT:="8080"} | ||
|
||
docker run \ | ||
--detach \ | ||
--env=MONGODB_HOSTNAME=disk_tracking_mongo \ | ||
--env=MONGODB_PASSWORD=hunter2 \ | ||
--env=MONGODB_PORT=27017 \ | ||
--env=MONGODB_USERNAME=disk_tracking \ | ||
--env=MONGODB_DATABASE=${MONGODB_DATABASE} \ | ||
--env=MONGODB_HOSTNAME=${DOCKER_MONGO_CONTAINER_NAME} \ | ||
--env=MONGODB_PASSWORD=${MONGODB_PASSWORD} \ | ||
--env=MONGODB_PORT_NUMBER=${MONGODB_PORT_NUMBER} \ | ||
--env=MONGODB_USERNAME=${MONGODB_USERNAME} \ | ||
--env=PORT=${PORT} \ | ||
--env=RUST_LOG=debug \ | ||
--link disk_tracking_mongo:disk_tracking_mongo \ | ||
--name=disk_tracking \ | ||
--publish 8080:8080 \ | ||
--link ${DOCKER_MONGO_CONTAINER_NAME}:${DOCKER_MONGO_CONTAINER_NAME} \ | ||
--name=${DOCKER_CONTAINER_NAME} \ | ||
--publish ${PORT}:${PORT} \ | ||
--rm \ | ||
wipac-disk-tracking:latest-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
#!/usr/bin/env bash | ||
# run-mongo-docker | ||
|
||
# --detach \ | ||
# --rm \ | ||
# use `docker run` to create a TEMPORARY instance of MongoDB in a | ||
# Docker container for development/testing purposes. when starting | ||
# this script, you can provide one of the environment variables listed | ||
# below to override the defaults | ||
|
||
: ${DOCKER_CONTAINER_NAME:="disk_tracking_mongo"} | ||
: ${MONGODB_DATABASE:="disk_tracking"} | ||
: ${MONGODB_PASSWORD:="hunter2"} | ||
: ${MONGODB_USERNAME:="disk_tracking"} | ||
: ${MONGODB_PORT_NUMBER:="27017"} | ||
|
||
docker run \ | ||
--env=MONGODB_DATABASE=disk_tracking \ | ||
--env=MONGODB_PASSWORD=hunter2 \ | ||
--detach \ | ||
--env=MONGODB_DATABASE=${MONGODB_DATABASE} \ | ||
--env=MONGODB_PASSWORD=${MONGODB_PASSWORD} \ | ||
--env=MONGODB_ROOT_PASSWORD=hunter2 \ | ||
--env=MONGODB_USERNAME=disk_tracking \ | ||
--name=disk_tracking_mongo \ | ||
--publish 27017:27017 \ | ||
--env=MONGODB_USERNAME=${MONGODB_USERNAME} \ | ||
--env=MONGODB_PORT_NUMBER=${MONGODB_PORT_NUMBER} \ | ||
--name=${DOCKER_CONTAINER_NAME} \ | ||
--publish ${MONGODB_PORT_NUMBER}:${MONGODB_PORT_NUMBER} \ | ||
--rm \ | ||
bitnami/mongodb:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
#!/usr/bin/env bash | ||
# run-mongo-shell-docker | ||
|
||
# use `docker run` to create an interactive mongoshell that connects to | ||
# the TEMPORARY instance of MongoDB for development/testing purposes. | ||
# when starting this script, you can provide one of the environment | ||
# variables listed below to override the defaults | ||
|
||
: ${MONGODB_DATABASE:="disk_tracking"} | ||
: ${MONGODB_HOSTNAME:="localhost"} | ||
: ${MONGODB_PASSWORD:="hunter2"} | ||
: ${MONGODB_USERNAME:="disk_tracking"} | ||
: ${MONGODB_PORT_NUMBER:="27017"} | ||
|
||
docker run \ | ||
--interactive \ | ||
--network="host" \ | ||
--rm \ | ||
--tty \ | ||
mongo:latest \ | ||
mongosh --host localhost:27017 -u "root" -p "hunter2" --authenticationDatabase "admin" | ||
mongosh --host ${MONGODB_HOSTNAME}:${MONGODB_PORT_NUMBER} -u "${MONGODB_USERNAME}" -p "${MONGODB_PASSWORD}" --authenticationDatabase "${MONGODB_DATABASE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters