2013-08-06 15:58:47 +00:00
|
|
|
imgsrv
|
|
|
|
======
|
2013-02-12 18:10:59 +00:00
|
|
|
|
2013-08-06 15:54:33 +00:00
|
|
|
[![go v1.1.1](http://b.repl.ca/v1/go-v1.1.1-blue.png)]()
|
2013-08-06 16:00:12 +00:00
|
|
|
[![mongoDB v2.4](http://b.repl.ca/v1/mongo-v2.4-green.png)]()
|
2013-08-06 15:54:33 +00:00
|
|
|
[![license MIT](http://b.repl.ca/v1/license-MIT-red.png)]()
|
|
|
|
|
2013-08-06 15:58:47 +00:00
|
|
|
Overview
|
|
|
|
--------
|
|
|
|
|
2013-02-12 18:10:59 +00:00
|
|
|
Initially, I just wanted a server that I could upload images to, and quickly
|
|
|
|
serve back. While it's mostly that, it is the client and server side tooling.
|
|
|
|
|
|
|
|
The files are stored in mongoDB, using its GridFS.
|
|
|
|
|
2013-08-06 00:32:19 +00:00
|
|
|
Usage
|
|
|
|
-----
|
2013-02-12 18:10:59 +00:00
|
|
|
|
|
|
|
Server side
|
|
|
|
For a basic start, make sure mongo is running on the localhost, and run:
|
|
|
|
./imgsrv -server
|
|
|
|
2013/02/12 13:03:37 0.0.0.0
|
|
|
|
2013/02/12 13:03:37 Serving on 0.0.0.0:7777 ...
|
|
|
|
|
|
|
|
For something a bit more complicated, like an openshift diy-0.1 cartridge,
|
|
|
|
set your .openshift/action_hooks/start to:
|
2013-08-06 00:33:50 +00:00
|
|
|
|
|
|
|
nohup ${OPENSHIFT_REPO_DIR}/bin/server \
|
|
|
|
-server \
|
|
|
|
-ip ${OPENSHIFT_INTERNAL_IP} \
|
|
|
|
-port 8080 \
|
|
|
|
-mongo-host ${OPENSHIFT_NOSQL_DB_URL} \
|
|
|
|
>> ${OPENSHIFT_LOG_DIR}/server.log 2>&1 &
|
2013-02-12 18:10:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
Client side:
|
|
|
|
Either pass the -remotehost flag pointing to your server instance
|
|
|
|
|
2013-08-06 00:33:50 +00:00
|
|
|
imgsrv -remotehost http://hurp.til.derp.com:7777 -put ./lolz.gif -keywords 'cats,lols'
|
2013-02-12 18:10:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
or setup your ~/.imgsrv.yaml, with a the value 'remotehost', like so:
|
2013-08-06 00:33:50 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
remotehost: http://hurp.til.derp.com:7777
|
2013-02-12 18:10:59 +00:00
|
|
|
|
|
|
|
then you can drop that flag out, for quicker lolzing:
|
|
|
|
|
2013-08-06 00:33:50 +00:00
|
|
|
imgsrv -put ./lolz.gif -keywords 'cats,lols'
|
|
|
|
2013/02/12 13:00:28 POSTing: http://hurp.til.derp.com:7777/f/?filename=lolz.gif&keywords=cats,lols
|
|
|
|
2013/02/12 13:00:29 New Image!: http://hurp.til.derp.com:7777/f/lolz.gif
|
2013-02-12 18:10:59 +00:00
|
|
|
|
|
|
|
|
2013-08-06 00:32:19 +00:00
|
|
|
Dependencies
|
|
|
|
------------
|
2013-05-11 03:44:02 +00:00
|
|
|
|
2013-08-06 00:33:50 +00:00
|
|
|
go get launchpad.net/goyaml
|
|
|
|
go get labix.org/v2/mgo
|
2013-05-11 03:44:02 +00:00
|
|
|
|
|
|
|
and put this imgsrv in your GOPATH,
|
|
|
|
since it references itself.
|
|
|
|
|
2013-08-06 00:32:19 +00:00
|
|
|
Building
|
|
|
|
--------
|
2013-02-09 04:32:43 +00:00
|
|
|
|
|
|
|
Either
|
|
|
|
|
2013-08-06 00:33:50 +00:00
|
|
|
git clone git://<host>/imgsrv.git
|
|
|
|
cd imgsrv
|
|
|
|
go build
|
|
|
|
./imgsrv
|
2013-02-09 04:32:43 +00:00
|
|
|
|
|
|
|
or
|
|
|
|
|
2013-08-06 00:33:50 +00:00
|
|
|
go get github.com/vbatts/imgsrv
|
|
|
|
imgsrv
|
2013-02-09 04:32:43 +00:00
|
|
|
|
2013-02-12 18:10:59 +00:00
|
|
|
|