Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hakobera/transfer
Simple file transfer service.
https://github.com/hakobera/transfer
Last synced: about 1 month ago
JSON representation
Simple file transfer service.
- Host: GitHub
- URL: https://github.com/hakobera/transfer
- Owner: hakobera
- Created: 2014-01-10T09:30:08.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-15T10:56:33.000Z (almost 10 years ago)
- Last Synced: 2024-04-14T09:15:54.754Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 551 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Transfer [![Build Status](https://travis-ci.org/hakobera/transfer.png?branch=master)](https://travis-ci.org/hakobera/transfer)
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](https://github.com/koajs/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 [email protected]: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.- [Mailgun | Add-ons | Heroku](https://addons.heroku.com/mailgun)
- [Sentry | Add-ons | Heroku](https://addons.heroku.com/sentry)
- [New Relic](https://addons.heroku.com/newrelic)
- [Papertrail](https://addons.heroku.com/papertrail)### 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]
```