Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Auto start mindcontrol from a singularity container #31

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
dc2fafa
Working nginx singularity container
Shotgunosine Jul 6, 2018
2711bfc
Make work on HPC
Shotgunosine Jul 11, 2018
a7c8225
Fix start_singularity_mindcontrol.py
Shotgunosine Jul 12, 2018
d2e35ed
Fix ribbon display
Shotgunosine Jul 12, 2018
5cadb09
Add freesurfer histograms
Shotgunosine Jul 12, 2018
d059b03
Working nginx singularity container
Shotgunosine Jul 6, 2018
07fc372
Make work on HPC
Shotgunosine Jul 11, 2018
23f2844
Fix start_singularity_mindcontrol.py
Shotgunosine Jul 12, 2018
e5c06b6
Fix ribbon display
Shotgunosine Jul 12, 2018
119afc0
Add freesurfer histograms
Shotgunosine Jul 12, 2018
85e2347
Merge branch 'hpc_compat' of https://github.com/Shotgunosine/mindcont…
Shotgunosine Jul 12, 2018
14af080
Update README.md
Shotgunosine Jul 12, 2018
7c92a37
Update README.md
Shotgunosine Jul 12, 2018
d170e5b
Update README.md
Shotgunosine Jul 12, 2018
312742a
fix: call it wm not ribbon
Shotgunosine Jul 12, 2018
db7f9fe
add nipype plugin option
Shotgunosine Jul 12, 2018
6e033c5
add nipype plugin args option
Shotgunosine Jul 12, 2018
bac9079
use singularity pull and instance.start
Shotgunosine Jul 17, 2018
23dd007
add circleci config
Shotgunosine Jul 18, 2018
dcdf746
fix dockerpath
Shotgunosine Jul 18, 2018
cf8e946
add dockerfile_services
Shotgunosine Jul 18, 2018
6bf146f
fix circlci config
Shotgunosine Jul 18, 2018
39eec6d
Add dockerhub pull to Singularity file
Shotgunosine Jul 18, 2018
3cf4129
Fix capitalization of singularity hub repo
Shotgunosine Jul 19, 2018
c587963
pass string not path object to pybids
Shotgunosine Jul 19, 2018
ec7c408
pullout mindcontrol base dir
Shotgunosine Jul 19, 2018
d39c9e7
allow bids_dir to be optional
Shotgunosine Jul 19, 2018
1e972cb
more general way to find home in startscript
Shotgunosine Jul 19, 2018
abb8112
akeshavan fixing histograms and use_custom
Shotgunosine Jul 20, 2018
65f866a
drop symlink for meteor local and add info if pid namespaces aren't a…
Shotgunosine Jul 24, 2018
0b2f8fe
Update README.md
Shotgunosine Jul 24, 2018
09fc5ef
Update README.md
Shotgunosine Jul 24, 2018
af0c203
Create one homedir per user
Shotgunosine Jul 26, 2018
0390c9e
Merge branch 'master' of https://github.com/Shotgunosine/mindcontrol
Shotgunosine Jul 26, 2018
e70f5da
Fix start script
Shotgunosine Jul 26, 2018
02d0551
add my_readme creation
Shotgunosine Jul 26, 2018
16992fd
add qroup as a required parameter
Shotgunosine Jul 27, 2018
b28689a
Update README.md
Shotgunosine Jul 27, 2018
71c3d2b
change rsync command
Shotgunosine Jul 28, 2018
b4a7d3c
add mongo utilities
Shotgunosine Jul 30, 2018
b88dbdd
fix mongo install commands
Shotgunosine Jul 30, 2018
0a5aa6b
fix mongo install commands
Shotgunosine Jul 30, 2018
7c04a77
fix mongo install commands
Shotgunosine Jul 30, 2018
8669503
fix mongo install commands
Shotgunosine Jul 30, 2018
c97bfc9
database dump and restore
Shotgunosine Aug 1, 2018
ec78b06
Fix bash specific syntax in startscript
Shotgunosine Aug 1, 2018
7767f05
Fix sh bugs
Shotgunosine Aug 1, 2018
0b8c152
For real fix sh bugs
Shotgunosine Aug 1, 2018
db21d65
catch startup case in startscript
Shotgunosine Aug 1, 2018
14a25bf
fix nginx directory permissions
Shotgunosine Aug 2, 2018
2fda516
Update README.md
Shotgunosine Aug 2, 2018
afbff7e
Update README.md
Shotgunosine Aug 2, 2018
9cee36e
point fs_dir at bids_dir if fs_dir not specified
Shotgunosine Aug 2, 2018
d853329
Merge branch 'master' of https://github.com/Shotgunosine/mindcontrol
Shotgunosine Aug 2, 2018
97d58b2
add container name
Shotgunosine Aug 7, 2018
5e03e87
Update README.md
Shotgunosine Aug 7, 2018
80cacc7
Update README.md
Shotgunosine Oct 31, 2018
c169750
explicitly create bindpoint targets
Shotgunosine Oct 31, 2018
7aa5db4
Merge branch 'master' of https://github.com/Shotgunosine/mindcontrol
Shotgunosine Oct 31, 2018
7935efc
explicitly create bindpoint targets
Shotgunosine Oct 31, 2018
6b0bb4e
take files out of /home
Shotgunosine Nov 1, 2018
0d1a360
fix perms
Shotgunosine Nov 1, 2018
624f640
symlink mindcontrol home to mc_files
Shotgunosine Nov 1, 2018
272f8de
fix setting home directory
Shotgunosine Nov 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
jobs:
build:
machine: true
steps:
- checkout
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: cd imports/docker && docker build -t shotgunosine/mindcontrol:$CIRCLE_BUILD_NUM-${CIRCLE_SHA1:0:6} -f Dockerfile_services .
- run: docker tag shotgunosine/mindcontrol:$CIRCLE_BUILD_NUM-${CIRCLE_SHA1:0:6} shotgunosine/mindcontrol:latest
- run: docker push shotgunosine/mindcontrol
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules/
.meteor/dev_bundle
.mindcontrol/
imports/docker/log/
imports/docker/temp_for_nginx/
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![CircleCI](https://circleci.com/gh/Shotgunosine/mindcontrol/tree/master.svg?style=svg)](https://circleci.com/gh/Shotgunosine/mindcontrol/tree/master)
[![https://www.singularity-hub.org/static/img/hosted-singularity--hub-%23e32929.svg](https://www.singularity-hub.org/static/img/hosted-singularity--hub-%23e32929.svg)](https://singularity-hub.org/collections/1293)

# mindcontrol
MindControl is an app for quality control of neuroimaging pipeline outputs.

Expand Down Expand Up @@ -34,6 +37,44 @@ Create a database json file similar to [http://dxugxjm290185.cloudfront.net/hbn/
* Host your database json file on a server and copy/paste its url into the "startup_json" value on `settings.dev.json`
* Define each module in `settings.dev.json` to point to your `entry_type`, and define the module's `staticURL`

## Bulid and deploy with singularity
Connect to the system where you'd like to host mindcontrol with a port forwarded:
```
ssh -L 3000:localhost:3000 server
```
Clone mindcontrol to a directory where you've got ~ 10 GB of free space.
```
git clone https://github.com/Shotgunosine/mindcontrol
cd mindcontrol
```
You'll need to have a python 3 environment with access to nipype, pybids, freesurfer, and singularity.
Run start_singularity_mindcontrol.py. You can see its documentation with `python start_singularity_mindcontrol.py -h`. The script is now set up to take the name of a linux group as it's first argument. Any member of this group will be able to run the mindcontrol instance and access the mindcontrol files.

```
python start_singularity_mindcontrol.py [name of the group you want to own mindcontrol files] [name you want to give container] —freesurfer_dir [path to directory containing subdirectories for all the subjects] --sing_out_dir [path where mindcontrol can output files] --freesurfer
```

This command does a number of things:
1) Prompt you to create users and passwords. I would just create one user for your lab and a password that you don’t mind sharing with others in the lab.creates folders with all the settings files that need to be loaded.
2) Runs mriconvert to convert .mgz to .nii.gz for T1, aparc+aseg, ribbion, and wm. Right now I’m just dropping those converted niftis in the directory beside the .mgzs, let me know if that’s a problem though.
3) Pulls the singularity image.
4) Starts an instance of the singularity image running with everything mounted appropriately.

Inside the image, there’s a fair bit of file copying that has to get done. It takes a while, potentially quite a while if you are on a system with a slow filesystem.
You can check the progress with `cat log/simg_out/out`.
Once that says `Starting mindcontrol and nginx`, you can `cat log/simg_out/mindcontrol.out` to see what mindcontrol is doing.
Once that says `App running at: http://localhost:2998/`, mindcontrol is all set up and running (but ignore that port number, it’s running on port 3000).

Anyone who wants to see mindcontrol can then `ssh -L 3000:localhost:3000` to the server and browse to http://localhost:3000 in their browser. They’ll be prompted to login with the username and password you created way back in step 1.

Once you're done running mindcontrol you can stop it with `/bin/bash stop_mindcontrol.sh`. This command dumps the databse to log/simg_out/mindcontrol.out and compresses any previous database dump if finds there. It also fixes permissions on all of the files in the mindcontrol directory, so it may take a while to run. Killing the script before it finishes may prevent another user from being able to run your mindcontrol instance.

The next time a user in the appropriate group would like to start it, they should just run `/bin/bash start_mindcontrol.sh`. This will start the instance and restore the database from the previously dumped data.

Don't use the `singularity instance.start` and `singularity instance.stop` commands, as the additional permissions fixing and database restoring or dumping won't run.

The startscript should write `my_readme.md` to the output directory you specify with instructions on running and connecting to the mindcontrol instance you've created with all of the appropriate paths and port numbers filled in.

## Demo

Check out the [demo](http://mindcontrol.herokuapp.com/). [This data is from the 1000 Functional Connectomes Project](http://fcon_1000.projects.nitrc.org/fcpClassic/FcpTable.html)
Expand Down
File renamed without changes.
Loading