Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/remeh/upd
Upload from the command-line, share with your browsers.
https://github.com/remeh/upd
Last synced: 3 months ago
JSON representation
Upload from the command-line, share with your browsers.
- Host: GitHub
- URL: https://github.com/remeh/upd
- Owner: remeh
- License: apache-2.0
- Created: 2015-01-26T11:59:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-24T16:23:08.000Z (over 7 years ago)
- Last Synced: 2024-06-19T02:02:51.482Z (6 months ago)
- Language: Go
- Homepage:
- Size: 93.8 KB
- Stars: 18
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# upd
Upload from CLI, share with browsers.
## About
upd is a file upload service to quickly share files through http(s) supporting different storage backend (filesystem and Amazon S3).
The server provides a simple API to easily allow the creation of clients and a command-line client is also provided in this repository.
## Features
* Storages backend : Filesystem, Amazon S3
* Daemon listening to receive files
* Daemon serving files (with resize feature on images)
* TTL for expiration of files.
* Tags on files + search by tags API
* Delete link
* HTTPs
* Secret shared key between client / server
* Get last uploaded files
* Routine job cleaning the expired files## How to use
### Basics
First, you need to use the excellent dependency system gom:
```
go get github.com/mattn/gom
```Then, in the main directory of `upd`
```
gom install
```to setup the dependencies.
### Start the daemon
#### Normal server
To start the server:
```
gom build bin/server/server.go
./server
```Available flags for the `server` executable:
```
-c="server.conf": Path to a configuration file.
```The configuration file is well-documented.
#### Docker server
upd daemon is ready to be launched with `Docker`. You must first build the docker container, in the upd directory :
```
docker build -t upd .
```It'll build the upd server docker container. What you must know:
* The `ENTRYPOINT` docker has been binded on the configuration file `/etc/upd/server.conf`, this way, by using a volume, you can provide your configuration file.
* Don't forget to bind a volume for the data directory if you're using the filesystem storage backend. If you don't do so, you'll lost your data when the docker will be stopped/restarted.Example of how to launch the upd container (with the `server.conf` in your host `/home/user/`) :
```
docker run --rm -ti -v /home/user:/etc/upd -v /home/user/data:/tmp -p 9000:9000 upd
```A `upd.service` is available in the repository as an example to use `systemd` to manage the lifecycle of the docker container in the system.
### Upload a file with the client
Now that the server is up and running, you can upload files with this command:
```
gom build bin/client/client.go
./client file1 file2 file3 ...
```it'll return the URL to share/delete the uploaded files. Example:
```
$ ./client --keep -ttl=4h README.md
For file : README.md
URL: http://localhost:9000/upd/README.md
Delete URL: http://localhost:9000/upd/README.md/ytGsotfcIUuZZ6eL
Available until: 2015-01-24 23:01:18.452801595 +0100 CET
```Available flags for the `client` executable:
```
-search-tags="": Search by tags. If many, must be separated by a comma, an 'or' operator is used. Ex: "may,screenshot".
-ca="none": For HTTPS support: none / filename of an accepted CA / unsafe (doesn't check the CA)
-key="": A shared secret key to identify the client.
-tags="": Tag the files. Ex: -tags="screenshot,may"
-ttl="": TTL after which the file expires, ex: 30m. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
-url="http://localhost:9000/upd": The upd server to contact.
```