Server and client for transferring large files to the CCM's Data Coordination Centre (DCC)
JavaScript Python HTML CSS Mako
Latest commit 55ff65f Oct 5, 2016 @ManaseD ManaseD committed on GitHub Merge pull request #14 from sickkids-ccm/file-archive
File archive
Permalink
Failed to load latest commit information.
config
migrations Merged entrypoints, simplified db creation/migration May 12, 2016
server Querying db files now takes a 'filters' json object comprised of colu… Oct 5, 2016
tests Updated configuration layout to enable env config setting Jul 13, 2016
.gitignore Updated server configuration and logging May 10, 2016
LICENSE
README.md
dcc.wsgi Remove excessive prints Sep 2, 2016
manage.py
requirements.txt Restructured project layout to include a testing folder and moved vie… Jun 6, 2016

README.md

Large file transfer for the DCC

Quickstart

Initialize the database

Initialize the database based on the last migrations:

python manage.py db upgrade

Load the database with a new server and server-token

python manage.py authorize_server "my-server-id" "My Server Name" "my-server-token"

Start up the development server

Start up the development server in one console:

python manage.py runserver --port=8000

Generate a transfer code

Run the following curl command in the console using a valid server token (configurable in config.py) to obtain a transfer code valid for 24 hours

curl -H "X-Server-Token: my-server-token" -H "Content-Type: application/json" -X POST -d '{"user":"your-user-id","name":"your-user-name","email":"your-user-email","duration":7}' http://localhost:8000/transfers/

Upload a file:

For example, create a random 10MB file:

cat /dev/random | head -c 10000000 > test.bin

Open a browser to localhost:8000 , then log in using your transfer code. Add a sample and drop your file to upload the file in chunks of 1MB:

Setting up the environment

Create and active a new virtual environment:

$ virtualenv -p python2.7 .virtualenv
$ source .virtualenv/bin/active

Install the dependencies:

$ pip install -r requirements.txt

Performing database migrations

After modifying the schema, create a new migration script:

$ python manage.py db migrate

Upgrade to the new version:

$ python manage.py db upgrade

Downgrade to the previous version:

$ python manage.py db downgrade

*Note: for OperationalErrors with SQLite when dropping or adding columns, please modify the migration script to use the following workaround:

with op.batch_alter_table("some_table") as batch_op:
    # Add a column
    batch_op.add_column(Column('foo', Integer))
    # Drop a column
    batch_op.drop_column('bar')