An image server based mongodb gridfs.
$ go get github.com/alsey/mongo-image-server
Use envionment variables to config this server.
- PORT0 : port, default is 3000
- MONGO_ADDR : mongodb address, default is 127.0.0.1:27017
- MONGO_DB : mongodb database name
- MONGO_USER : mongodb authenticate user
- MONGO_PASS : the user's password
- While some image files saved at mongodb with gridfs format, you can access this images by URL with this server.
The URL is
http://<host>:<port>/images/<filename>
- You can change image size by url query parameters while access the image file.
http://<host>:<port>/images/<filename>?w=<width>&h=<height>
The url variables w
and h
is image's width and height, in pixels.
- I wrote a Dockerfile for you, you can make a Docker image, and put it in Kubernetes or Mesos.
$ docker build -t 'mongo-image-server' .
- The server includes a health check endpoint for microservice scenario.
http://<host>:<port>/health
http://<host>:<port>/env