Skip to content

Commit

Permalink
insignificant changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Levitas committed Jan 30, 2024
1 parent 3e683be commit 713d65d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 30 deletions.
51 changes: 27 additions & 24 deletions dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,35 @@ export SINGULARITY_CACHEDIR=/tmp

# Approach #1: singularity (individual .sif files)

# Helpful commentary on mongodb container build with Singularity: https://stackoverflow.com/questions/70746228/singularity-mongodb-container-in-background-mode
if [ ! -d $PWD/data/db ]; then
mkdir -p $PWD/data/db
chmod -R 777 $PWD/data/db
fi
# # Helpful commentary on mongodb container build with Singularity: https://stackoverflow.com/questions/70746228/singularity-mongodb-container-in-background-mode
# if [ ! -d $PWD/mongodb/data/db ]; then
# mkdir -p $PWD/mongodb/data/db
# chmod -R 770 $PWD/mongodb/data/db
# fi

if [ ! -f $PWD/mongodb/mongodb.sif ]; then # Will eventually be redundant and can remove
echo "building mongodb"
# build image
singularity build \
--arch "amd64" \
--fakeroot \
--disable-cache \
$PWD/mongodb/mongodb.sif \
$PWD/mongodb/Singularity
# if [ ! -f $PWD/mongodb/mongodb.sif ]; then # Will eventually be redundant and can remove
# echo "building mongodb"
# # build image
# singularity build \
# --arch "amd64" \
# --fakeroot \
# --disable-cache \
# $PWD/mongodb/mongodb.sif \
# $PWD/mongodb/Singularity

# # start the container instance
# singularity instance start \
# --fakeroot \
# --bind $PWD/data/db:/data/db \
# --net \
# --network-args "portmap=27417:27017/tcp" \
# --bind $PWD/mongodb/data/db:/data/db \
# $PWD/mongodb/mongodb.sif \
# brainlife_ezbids-mongodb


# # --net \
# # --network-args "portmap=27417:27017/tcp" \
# # --bind $PWD/data/db:/data/db \ # Might not need this if mongodb/Singularity contains a %files section
# # singularity run instance://brainlife_ezbids-mongodb # This seems to run mongodb in the foreground, meaning can't move on to building other containers.
fi
# fi

# if [ ! -f $PWD/api/api.sif ]; then
# echo "building api"
Expand All @@ -90,10 +93,10 @@ fi



# # Approach #2: singularity-compose
# Approach #2: singularity-compose

# if [ ! -d $PWD/data/db ]; then
# mkdir -p $PWD/data/db
# chmod -R 777 $PWD/data/db
# fi
# singularity-compose --debug up --no-resolv
if [ ! -d $PWD/mongodb/data/db ]; then
mkdir -p $PWD/mongodb/data/db
chmod -R 770 $PWD/mongodb/data/db
fi
singularity-compose --debug up --no-resolv
3 changes: 3 additions & 0 deletions mongodb/Singularity
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Bootstrap: docker
From: mongo:4.4.15

# %environment
# export HOME=$PWD/data/db

%runscript
# mongod --dbpath $PWD/data/db
exec /usr/bin/mongod "$@"
Expand Down
19 changes: 13 additions & 6 deletions singularity-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,22 @@ instances:

mongodb: # FOURTH ATTEMPT
container_name: brainlife_ezbids-mongodb
build:
context: ./mongodb
options:
- fakeroot
image: docker://mongo:4.4.15
# build:
# context: ./mongodb
# options:
# - fakeroot
platform: linux/amd64
volumes:
- ./data/db:/data/db
- ./mongodb/data/db:/data/db
ports:
- 27417:27017 #for local debugging
- "27417:27017" #for local debugging
# start:
# options:
# - fakeroot
post:
command: mongod --dbpath /data/db
# command: echo 'db.runCommand("ping").ok' | mongo localhost:27017/test --quiet
# run:
# background: true # Does this actually run things in the background? Doesn't seem to

Expand Down

0 comments on commit 713d65d

Please sign in to comment.