This is a web-based version of Robert and Jonas Gifford's "FISH", a fish banks simulator for environmental psychology studies.
More information on the original FISH here: http://web.uvic.ca/~rgifford/fish/
Please ensure these requirements are installed before proceeding to the Installation section.
- Node (and npm)
- Mongodb
- Ruby
- Sass (through
gem install sass
)
- Navigate to the fish directory in a terminal window
- Run the command
npm install
(install dependencies specified in the package.json file)
- Note: You may need escalated privileges to run and will get an error. If so, use the command
sudo npm install
instead. - NOTE: This will run a script post install as well. See: Usage.
- Run the command
npm start
(on Windows or OSX) ornodejs app.js
on Linux to start the server. - Navigate to localhost:8080
These are located in the developer_scripts folder
npm run populatedb
Run post-install.- This populates the database with a user "Admin" and a password "123456789"
npm run cleandb
This will clean all the collections defined in the file (experimenters, microworlds, and sessions)npm run resetdb
runs cleandb then populatedbnpm run devreset
runs cleandb then populate db and then starts up the server.npm run sass
watches for style changes
This project is also dockerized (no official repository available however). This project uses and tested on the following Docker technologies:
- Docker for Mac:
- Client version: 17.03.1-ce
- Server version: 17.03.1-ce
- Docker Compose version 3
The node application is run in a container named fish
and the MongoDB is run in a container
named mongo-fish
. See docker-compose.yml
for more details.
The following volumes are bound from host
to the Docker container
- The whole directory of this repository is mounted on
fish
to/fish/app
- mongo.log is mounted on
mongo-fish
to/logs/mongo.log
You can see more details on Docer setup
The following is a diagram of the Docker setup:
From the above diagram you can infer several things:
- You can access the Fish application from
http://localhost:8080
from your browser - Since all Fish files in this repo is mounted on the Fish container, any changes on the repo will be reflected onto the Fish container. Therefore if you make changes to the application you don't need to re-build the containers. See Building the images for more info
- Since the
/logs/mongo.log
is mounted tomongo.log
, you may see all the mongo logs being saved tomongo.log
so you can check it out in the future
Before trying to run Dockerized application, please run npm run build-docker
first beforehand.
This command only needs to be run once, unless you want to rebuild the containers due to changes.
Several possible changes that needs rebuilding:
- Changing the commands that the containers execute
- Changing the base image of the containers
- Adding things to the containers' Dockerfiles, either
Dockerfile-app
orDockerfile-Db
- Other things that modifies the Dockerfiles
In order to use the Dockerized version do the following
- npm run build-docker
- Run the Docker services, one of
npm run start-docker
(standard mode)npm run start-daemon-docker
(daemon mode a.k.a Docker detached mode)
- After running one of the above you should run
npm run docker-populatedb
. It's the populate DB setup but for the docker setup
If you run in daemon mode then you can do npm run stop-daemon-docker
to stop daemon mode
If Docker was run in non-detached mode then logs will be visible on console stdout.
The node application and MongoDB logs may also be found in fish.log
and mongo.log
respectively.
If Docker was run in detached mode you may see logs by running the following commands:
- node application:
npm run logs-docker-fish
- MongoDB:
npm run logs-docker-mongo-fish
-
Navigate to http://localhost:8080/admin
-
Log in with the following credentials:
- Username:
Admin
- Password:
123456789
- Username:
-
You now have access to the microworlds
-
Create and activate a microworld if you wish to run an experiment with users Note: Look at the Code for the experiment on an active microworld. eg
Active Microworld: QQ5HQP
- Navigate to http://localhost:8080/
- Enter the Experiment number of an active microworld
- Enter an ID number
- Fish!
- Black Fish Icon made by Freepik from www.flaticon.com is licensed under CC BY 3.0
- Lighthouse Icon made by Icons8 from www.flaticon.com is licensed under CC BY 3.0
- Sailboat Icon made by Freepik from www.flaticon.com is licensed under CC BY 3.0
- Fishing Icon made by Icons8 from www.flaticon.com is licensed under CC BY 3.0