Giter Club home page Giter Club logo

upcs's Introduction

CLI to upload to OpenStack Swift

Homepage

https://github.com/chmouel/upcs

Credits

Chmouel Boudjnah <[email protected]>

Licence

BSD

DESCRIPTION

upcs is a simple bash script that use curl on the back-end to upload files quickly to OpenStack swift (v1 & v2 support).

If the container uploaded is a public container then it will give you the public link for easy sharing.

upcs is the acronym to :

[UP]load to [C]loud [S]wiftly.

REQUIREMENT

  • Bash >= 3.0
  • curl
  • xsel (optional)

Operating Systems

This has been tested and developed on MacOSX and Linux system.

USAGE

For the first time running upcs will ask you for your API username and key and which Rackspace data-center to use (us or uk). If connected successfully it will ask you to which container to upload.

Options:

upcs OPTIONS FILES1 FILE2...

Use curl on the backend to upload files to rackspace Cloud Files.

Options are :

-s - Use Servicenet to upload.
-u Username - specify an alternate username than the one stored in config
-k Api_Key - specify an alternate apikey.
-a Auth_URL - specify an alternate auth server.
-c Container - specify the container to upload.
-d - Use the last chosen container to upload.
-C Content/Type - force a specific a content-type for file(s) uploaded.
-m Container - create container.
-z Segment_Size_MB - upload large files in given size segments, in MB (default: 5120 MB)
-t Delete the object after X seconds (default: never)
-x - set debug mode.

Config is inside ~/.config/rackspace-cloud/config.

CNAME

upcs has the ability to use a CNAME of your public containers instead of the CDN url.

Let's say you have a CNAME set like this :

c000.r00.cf0.rackcdn.com CNAME public.mydomain.com

if you set the container header :

X-Container-Meta-Cname: public.mydomain.com

on your container header (see the API documentation for this) it will show you the public.mydomain.com instead of c000.r00.cf0.rackcdn.com for the public url.

Configuration and OpenStack-Swift

If you want to upload to your custom swift installation. You can edit the variable AUTH_SERVER in ~/.config/rackspace-cloud/config to your swift install. This file get generated the first time you run upcs if you specify a URL starting by http:// instead of `us or uk` for auth server it will use that to get tokens. Same goes if you need to update your API key you can easily do that by editing this file.

LICENSE

Unless otherwise noted, all files are released under the MIT license, exceptions contain licensing information in them.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of Rackspace US, Inc. shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Rackspace US, Inc.

Author

Chmouel Boudjnah <[email protected]>

Contributor

Rick Harris <[email protected]>

upcs's People

Contributors

chmouel avatar rconradharris avatar triffid 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

upcs's Issues

List Containers

It would be nice to have an option that lists all contains.

Setting the headers for each file

When uploading each file for the CDN, how can the headers be set?

• Content-Encoding
• Content-Disposition
• X-Object-Manifest
• Access-Control-Allow-Origin
• Access-Control-Allow-Credentials
• Access-Control-Expose-Headers
• Access-Control-Max-Age
• Access-Control-Allow-Methods
• Access-Control-Allow-Headers
• Origin
• Access-Control-Request-Method
• Access-Control-Request-Headers

Stream feature resquest

Hello Chmouel,
Would it be possible to use UPCS to push a stream from taz/gz | gpg for example ?

Thx;
F

Uploading to dfw1 even if container is stored on ord1

Just a small (but breaking) issue.

Im trying to upload files to my container hosted in Chicago (ORD) but it always tries to upload them to https://storage101.dfw1.clouddrive.com/v1/ and not https://storage101.ord1.clouddrive.com/v1/

I notice ${StorageUrl} at https://github.com/chmouel/upcs/blob/master/upcs#L183 but I cant see where it is set.

In ~/.config/rackspace-cloud/config I have:

RCLOUD_API_USER=*******
RCLOUD_API_KEY=**********************************
AUTH_SERVER=https://auth.api.rackspacecloud.com/v1.0

SyntaxError on Arch Linux

I've successfully used this script with ubuntu, but Arch Linux seems to be trickier. I get the following error when I run upcs:
File "", line 1
import os,sys;print os.path.realpath(sys.argv[1])
^
SyntaxError: invalid syntax

A way to add a "folder" to the file name.

Containers have this way to make "folders" where you just put 'yourfoldername/yourfilename.jpg' as the destination name.

./upcs -c container/testfolder file1.jpg <----- This works but then the url shortener does not work.

Seems like it would be nice to support adding folders somehow.

Specify the region

At the moment is not supported to connect to a specific region (ORD, DFW, SYD etc..)

Support rate limiting of the upload

upcs uses curl to perform the upload, which supports limiting the speed of the upload (using the --limit-rate option). It would be good if upcs allowed the setting of this option (if requested) to control the upload rate

UK authentication

I am having issues with uk authentication

US sites work fine but UK, is giving error

You have a bad username or api/key.

John

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.