Simple file transfer service.
JavaScript CSS Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
locales
mails
public/stylesheets
scripts
test
views
.gitignore
.travis.yml
Makefile
README.md
app.js
newrelic.js
package.json
transfer-cloudformation.json

README.md

Transfer Build Status

Transfer is a simple file sharing service.

How to work

  1. Reserve a file transfer. It will return its id and endpoint to upload file. File info is stored in DynamoDB.
  2. Upload the file to the endpoint. It will be uploaded to S3.
  3. An email will be sent to the address which was used at reservation.
  4. Emails includes an url and the user can download file from there.

How to run on your local machine

Install Node.js 0.11.9 or higher.

This app is build by Koa. Koa use generator so, this app must be running Node.js 0.11.9 or higher.

Create Amazon Web Service account

This app use Amazon S3 and Amazon DynamoDB. So you must create AWS account and get you own access key.

Create Amazon S3 bucket for store files

Create S3 buckect for store uploaded file. You can use any buckect name if you want.

Create Amazon DynamoDB table for store file meta data

Create DynamoDB a table for store file meta data. You can use any table name if you want, but Primary Key must be following settings.

  • Primary Key Type: Hash
  • Hash Attribute Type: String
  • Hash Attribute Name: id

Clone this repository

$ git clone git@github.com:hakobera/transfer.git
$ cd transfer
$ npm install

Edit scripts/.env

Copy scripts/.env.template to 'scripts/.env'.

$ cp scripts/.env.template scripts/.env

Then edit to fill in environment value. Prefix AWS_ is required value and others are optional.

export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_REGION=
export AWS_S3_BUCKET=
export AWS_DYNAMODB_TABLE=
# If you want to test mail feature, set followings.
#export MAIL_FROM=
#export MAILGUN_SMTP_LOGIN=
#export MAILGUN_SMTP_PASSWORD=

Run app

$ ./scripts/start.sh

How to run test on local

Set environment value in ./scripts/.env, then run this:

$ ./scripts/test.sh

How to run on Heroku

Create heroku app

$ heroku create [your-app-name]

Add addons

$ heroku addons:add mailgun
$ heroku addons:add sentry          # optional
$ heroku addons:add newrelic:stark  # optional
$ heroku addons:add papertrail      # optional

Above setup is only use free/development add-on plans. You should upgrade the plan of each add-on if you want. You can show which plan is avaiable in following pages.

Set config variables

$ heroku config:set \
    NODE_ENV=production \
    MAIL_FROM=[your-email-address] \
    HOST="https://[your-app-name].herokuapp.com" \
    AWS_ACCESS_KEY_ID=[your-aws-access-key] \
    AWS_SECRET_ACCESS_KEY=[your-aws-secret-access-key] \
    AWS_REGION=[your-aws-region such as 'us-east-1', 'ap-northeast-1'] \
    AWS_DYNAMODB_TABLE=[your-aws-dynamodb-table-name-for-transfer] \
    AWS_S3_BUCKET=[your-aws-s3-bucket-name-for-transfor] \
    -a [your-app-name]