Skip to content

Commit

Permalink
some more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Levitas committed Feb 5, 2024
1 parent 56c6981 commit 5013569
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 71 deletions.
23 changes: 9 additions & 14 deletions Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,24 @@ Stage: spython-base
%environment
MONGO_CONNECTION_STRING=mongodb://mongodb:27017/ezbids
BRAINLIFE_AUTHENTICATION=false
SINGULARITY_PWD=/app/api # Not sure this is being properly set (or at least adhered to)
PORT=8082
export MONGO_CONNECTION_STRING BRAINLIFE_AUTHENTICATION PORT
export MONGO_CONNECTION_STRING BRAINLIFE_AUTHENTICATION PORT SINGULARITY_PWD


%post
mkdir -p /app
cd /app

npm install -g pm2 typescript tsc-watch
npm install


%files
. /app


%runscript
# cd /app
cd /app/api
exec /bin/bash "$@"
echo "Current working directory: $PWD"
./dev.sh

%files
. /app

%startscript
# cd /app
cd /app/api
exec /bin/bash "$@"
./dev.sh # Need this, right?
%test
# curl -f http://localhost:8082/health
8 changes: 4 additions & 4 deletions dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ export SINGULARITY_CACHEDIR=/tmp

# Approach #2: singularity-compose

# if [ ! -d $PWD/mongodb/data/db ]; then
# mkdir -p $PWD/mongodb/data/db
# chmod -R 770 $PWD/mongodb/data/db
# fi
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
2 changes: 2 additions & 0 deletions handler/Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Stage: spython-base
npm -g install pm2

%environment
export MONGO_CONNECTION_STRING=mongodb://mongodb:27017/ezbids
export DEBIAN_FRONTEND=noninteractive
export FSLDIR=/usr/local/fsl
export PATH=$PATH:$FSLDIR/bin
Expand All @@ -110,6 +111,7 @@ Stage: spython-base
%runscript
cd /app/handler
exec /bin/bash "$@"
pm2 start handler.js --attach --watch --ignore-watch "ui **/node_modules"

%startscript
cd /app/handler
Expand Down
16 changes: 6 additions & 10 deletions mongodb/Singularity
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
Bootstrap: docker
From: mongo:4.4.15

%setup
mkdir -p /data/db

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

%runscript
# mongod --dbpath $PWD/data/db
cd $HOME
exec /usr/bin/mongod "$@"
export SINGULARITY_PWD=/

%startscript
# mongod --dbpath $PWD/data/db
cd $HOME
exec /usr/bin/mongod "$@"
%post
echo "Current working directory: $PWD"
80 changes: 37 additions & 43 deletions singularity-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,52 +48,46 @@ instances:
volumes:
- ./mongodb/data/db:/data/db
ports:
- "27417:27017" #for local debugging
# start:
# options:
# - fakeroot
- 27417:27017 #for local debugging
run:
options:
- fakeroot
command: "mongod --dbpath /data/db"
# run:
# background: true # Does this actually run things in the background? Doesn't seem to
# background: true

api: # This seemss good, just needs mongodb up and running properly
container_name: brainlife_ezbids-api
build:
context: .
options:
- fakeroot
platform: linux/amd64
volumes:
- ./api:/app/api
- /tmp:/tmp
ports:
- 8082:8082 #localhost runs on local browser to it needs to access api via host port

# api:
# container_name: brainlife_ezbids-api
# build:
# context: .
# options:
# - fakeroot
# platform: linux/amd64
# volumes:
# # - ./api:/app/api
# - .:/app
# - /tmp:/tmp
# # depends_on:
# # mongodb:
# # condition: service_healthy
# post:
# command: ["/bin/bash", "./api/dev.sh"] # This seems to cause the npm install to freeze
# ports:
# - 8082:8082 #localhost runs on local browser to it needs to access api via host port

# handler:
# container_name: brainlife_ezbids-handler
# build:
# context: ./handler
# options:
# - fakeroot
# platform: linux/amd64
# volumes:
# - .:/app
# - /tmp:/tmp
# depends_on:
# mongodb:
# condition: service_healthy
# api:
# condition: service_healthy
# environment:
# MONGO_CONNECTION_STRING: mongodb://mongodb:27017/ezbids
# tty: true #turn on color for bids-validator output
# command: pm2 start handler.js --attach --watch --ignore-watch "ui **/node_modules"
handler:
container_name: brainlife_ezbids-handler
build:
context: ./handler
options:
- fakeroot
platform: linux/amd64
volumes:
- .:/app
- /tmp:/tmp
# depends_on:
# mongodb:
# condition: service_healthy
# api:
# condition: service_healthy
environment:
MONGO_CONNECTION_STRING: mongodb://mongodb:27017/ezbids
tty: true #turn on color for bids-validator output
command: pm2 start handler.js --attach --watch --ignore-watch "ui **/node_modules"

# ui:
# container_name: brainlife_ezbids-ui
Expand Down

0 comments on commit 5013569

Please sign in to comment.