Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ateliware/uploader
The uploader service you desperately need!
https://github.com/ateliware/uploader
gcs google-cloud-storage upload uploader
Last synced: about 1 month ago
JSON representation
The uploader service you desperately need!
- Host: GitHub
- URL: https://github.com/ateliware/uploader
- Owner: ateliware
- License: mit
- Created: 2017-05-03T13:18:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-01-16T16:47:06.000Z (11 months ago)
- Last Synced: 2024-03-27T07:39:47.956Z (9 months ago)
- Topics: gcs, google-cloud-storage, upload, uploader
- Language: JavaScript
- Size: 13.7 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# uploader
[![Build Status](https://travis-ci.org/ateliware/uploader.svg?branch=master)](https://travis-ci.org/ateliware/uploader)
The ateliware default uploader app. This is a simple web app with
two routes:- `GET /token` - this route gives the user a unique authentication
token to upload one file. The tokens are automatically expired in 3
hours. You can optionally make this an authenticated route, for more
information see the [configuration section](#configuration) below.
- `POST /upload` - this route uploads a file to the storage service
configured. This route takes two required params: `file`, which is
the file you want to upload, and `token` which is the authentication
token to your upload (generated by `GET /token`).## Configuration
All the configuration for the app is done through environment variables,
so here we go:- `NODE_ENV` - the environment to run the app. Can be one of:
- `development` - to use on your local environment only
- `test` - to use on your test environment and CI
- `production` - to use on your production deployed app
- `PORT` - the port used to start the server on
- `UPLOADER_USER` - the username to use in the authentication system for
the `GET \token` route.
- `UPLOADER_PSWD` - the password to use in the authentication system for
the `GET \token` route.The following keys are required only in production environment:
- `BUCKET` - the storage bucket to upload to
- `PROJECT_ID` - the project id where the bucket is on
- `KEYFILE` - the credentials for your storage server## Contribute to the app
Here is how to install and contribute for this project. But before
thinking in anything new to place in this app:PLEASE, KEEP IT SIMPLE. ;)
### Installing the app in dev mode
Here is a step by step for installing the app and running its main
tasks:- First of all `git clone [email protected]:ateliware/uploader.git`
- Then `cd uploader`
- Now you can choose from doing it with our without docker so the
next steps will have details for both
- Install the dependencies
- **docker** - `docker build . -t uploader`
- **no-docker** - `npm install`
- Running the server (with monitoring):
- **docker** - `docker run -e NODE_ENV=development -p 3000:3000
-v .:/app uploader`
- **no-docker** - `npm start`
- If you want to start the server monitoring file changes:
- **docker** - `docker run -e NODE_ENV=development -p 3000:3000
-v .:/app uploader nodemon index.js`
- **no-docker** - `nodemon index.js`
- The default port of the project is `3000`, so you can use the
server in [`http://localhost:3000`](http://localhost:3000)
- Running the tests:
- **docker** - `docker run -e NODE_ENV=test uploader npm test`
- **no-docker** - `npm test`### Workflow
1. Create a new branch for your feature of fix and checkout to it
2. Do your code
3. Run the tests
4. Add a commit to it (only if the tests passed, and prefer tiny
chunks of code per commit, it's easier to review this way)
5. Repeat 2 to 4 until it's done
6. Open a PR
7. Someone else will review it
1. If needed, fix what the reviewer asked for
8. DONE!### Deploying
The deploy of this app consists in building and pushing a docker
image to hub.docker.com.#### Building and pushing the image
- Upgrade the version in [`package.json`](./package.json) with:
- `VERSION=$(npm version major | cut -c 2-)` when you make incompatible API changes
- `VERSION=$(npm version minor | cut -c 2-)` when you add functionality in a
backwards-compatible manner
- `VERSION=$(npm version patch | cut -c 2-)` when you make backwards-compatible
bug fixes
- For more details in about versioning, [read this](http://semver.org)
- Build the docker image `docker build -t ateliware/uploader:$VERSION .`
- Publish to docker hub `docker push ateliware/uploader:$VERSION`
- SHIP IT! :shipit: