- Notifications
You must be signed in to change notification settings - Fork24
Storage and image processing server written in Go
License
aldor007/mort
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An S3-compatible image processing server written in Go. Still in active development.
- HTTP server
- Resize, Rotate, SmartCrop
- Convert (JPEG, PNG , BMP, Webp)
- Multiple storage backends (disk, S3, http)
- Fully modular
- S3 API for listing and uploading files
- Requests collapsing
- Build in rate limiter
- HTTP Range and Conditional requests
- Compression (gzip, brotli)
- Env variables driven configuration
- Write you own transform parser usingtengo
- cloudinary image transformation and upload
And more seechangelog for more info
Click on result image to see URL. More examples can be found inImage Operations list
Mort can be used directly from the Internet and behind any proxy.
go get github.com/aldor007/mort/cmd/
$ ./mortUsage of mort -config string Path to configuration (default"/etc/mort/mort.yml")
Example configuration used for providing demo images:
headers:# add or overwrite all response headers of given status. This field is optional -statusCodes:[200]values:"cache-control":"max-age=84000, public"buckets:# list of available bucketsdemo:# bucket namekeys:# list of S3 keys (optional) -accessKey:"access"secretAccessKey:"random"transform:# config for transformspath:"\\/(?P<presetName>[a-z0-9_]+)\\/(?P<parent>[a-z0-9-\\.]+)"# regexp for transform pathkind:"presets-query"# type of transform or "query"presets:# list of presetssmall:quality:75filters:thumbnail:width:150blur:quality:80filters:thumbnail:width:700blur:sigma:5.0webp:quality:100format:webpfilters:thumbnail:width:1000watermark:quality:100filters:thumbnail:width:1300watermark:image:"https://i.imgur.com/uomkVIL.png"position:"top-left"opacity:0.5smartcrop:quality:80filters:crop:width:200height:200storages:basic:# retrieve originals from s3kind:"s3"accessKey:"acc"secretAccessKey:"sec"region:""endpoint:"http://localhost:8080"transform:# and store it on diskkind:"local-meta"rootPath:"/var/www/domain/"pathPrefix:"transform"
List of all image operations can be found inImage-Operations.md
More details about configuration can be found inConfiguration.md
- Using golang (custom mort version needed)UrlParsers.md
- Using tengoTengoUrlParser.md
SeeDockerfile for image details.
Pull docker image
docker pull ghcr.io/aldor007/mort
Create Dockerfile or use Dockerfile.service
# Dockerfile.service FROM ghcr.io/aldor007/mort:latest# add your configADD config.yml /etc/mort/mort.yml
Build container
docker build -f Dockerfile.service -t myusername/mort
Run docker
docker run -p 8080:8080 myusername/mort
Full example you can findhere
- Make sure you have a Go language compiler >= 1.9 (required) and git installed.
- Install libvips like described onbimg page
- Ensure your GOPATH is properly set.
- Download it
git clone https://github.com/aldor007/mort.git$GOPATH/src/github.com/aldor007/mortcd$GOPATH/src/github.com/aldor007/mort
- Install dependencies:
go mod vendor
Run unit tests:
make unit
Run integration tests:
make integrations
If you encounter following problemgo build gopkg.in/h2non/bimg.v1: invalid flag in pkg-config --cflags: -Xpreprocessor
while running tests in your IDE add this to your environment:
export CGO_CFLAGS_ALLOW="-Xpreprocessor"
Run tests using docker image
make docker-tests
Please readCONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
This project is licensed under the MIT License - see theLICENSE.md file for details
About
Storage and image processing server written in Go