Git Product home page Git Product logo

pavo's Introduction

Pavo

Server-side upload service for jQuery-File-Upload written in Golang.

Usage

Running from the console by using the command:

$ bin/pavo --host=localhost:9078 --storage=/path/to/root/storage

Example

After build run application:

$ bin/pavo --storage=dummy/root_storage

Open example page in your browser:

open http://localhost:9073/example/jfu-basic.html

Install

Install golang

Install Golang. Set the GOPATH environment variable. For example for MacOS:

brew install go
mkdir $HOME/go
# Add this line in your .zshrc or .bash_profile
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Install a project based build tool

Installing, or upgrading gb is super simple (assuming you’ve already got Go installed)

go get github.com/constabulary/gb/...

Install application:

Clone a repository and build the project:

git clone [email protected]:kavkaz/pavo.git
cd pavo
gb build

Setup nginx

When used in a production environment it is recommended to use a web server nginx. Configure the web server is reduced to specifying a directory for distribution static, location for the files, and optional authentication.

server {
    listen 80;
    server_name pavo.local;
    
    access_log /usr/local/var/log/nginx/pavo/access.log;
    error_log /usr/local/var/log/nginx/pavo/error.log notice;
    
    location /auth {
        internal;
        proxy_method GET;
        proxy_set_header Content-Length "";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass_request_body off;
        proxy_pass http://localhost:3000/auth/url/in/your/app;
        proxy_set_header X-Original-URI $request_uri;
        client_max_body_size 0;
    }

    location /files {
        auth_request /auth;
    
        client_body_temp_path     /tmp;
        client_body_in_file_only  on;
        client_body_buffer_size   521K;
        client_max_body_size      10G;
    
        proxy_pass_request_headers on;
        proxy_set_header X-FILE $request_body_file;
        proxy_pass_request_body off;
        proxy_set_header Content-Length 0;
        proxy_pass http://127.0.0.1:9073;
    }
    
    location / {
        root /Path/To/Root/Of/Storage;
    }
}

These settings allow you to save the request body into a temporary file and pass on our application link to the file in the header X-File.

License

MIT license. Copyright (c) 2014 Zaur Abasmirzoev.

pavo's People

Contributors

izaurio avatar kavkaz avatar kosmodromov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pavo's Issues

Upload other files

For video, audio, etc use base Covert - rename original file, without processing

Roadmap v2

  • Middleware for set cookie pavo
  • Handlers
  • Serializers
  • Controllers
  • Params
  • #8 Format slug of version
  • #7 Set thumbnail sizes from CLI options
  • #6 Replace version
  • #4 Header Range
  • HTTP API docs

documentation improvement

The built-in Nginx core upload functionality (aka client_body_in_file_only) is not well known way to go due to lack of knowledge base. It does not support multipart/form-data, but AJAX or direct binary upload from mobile devices. In your case AJAX upload with conjunction of client_body_in_file_only is the best solution. The second advantage is to having authentication check before the request is being processed.

I would like to recommend to extend README file or Wiki to spread knowledge how to use it. I shared few bits and bobs on Coderwall, maybe useful: https://coderwall.com/p/swgfvw/nginx-direct-file-upload-without-passing-them-through-backend

Upload images

  • upload images from multipart
  • upload image from binary body
  • converts image
  • use X-File for define body

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.