Code Monkey home page Code Monkey logo

neurostore's Introduction

neurostuff

Build Status

Requirements: Docker and docker-compose.

Configuration

First, set up the main environment variables in .env (see: .env.example).

cp .env.example .env

Next, set up the Flask server's environment variables:

cp neurostuff/example_config.py neurostuff/config.py

Edit both of these template files to set the correct variables

Initalizing backend

Build the containers and start services using the development configuration:

docker-compose build
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d

The server should now be running at http://localhost/

Next, migrate and upgrade the database migrations.

docker-compose exec neurostuff \
    bash -c \
        "python manage.py db merge heads && \
         python manage.py db stamp head && \
         python manage.py db migrate && \
         python manage.py db upgrade"

Note: python manage.py db merge heads is not strictly necessary unless you have multiple schema versions that are not from the same history (e.g., multiple files in the versions directory). However, python manage.py db merge heads makes the migration more robust when there are multiple versions from different histories.

Finally, add an admin user, and ingest data

docker-compose exec neurostuff \
    bash -c \
        "python manage.py add_user [email protected] password && \
         python manage.py ingest_neurosynth"

Maintaining docker image and db

If you make a change to /neurostuff, you should be able to simply restart the server.

docker-compose restart neurostuff

If you need to upgrade the db after changing any models:

docker-compose exec neurostuff python manage.py db migrate
docker-compose exec neurostuff python manage.py db upgrade

Running tests

To run tests, after starting services, create a test database:

docker-compose exec postgres psql -h postgres -U postgres -c "create database test_db"

NOTE: This command will ask you for the postgres password which is defined in the .env file.

and execute:

docker-compose run -e "APP_SETTINGS=neurostuff.config.DockerTestConfig" --rm -w /neurostuff neurostuff python -m pytest neurostuff/tests

neurostore's People

Contributors

tyarkoni avatar adelavega avatar jdkent avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.