help on configuration
Closed this issue · 2 comments
I want to setup Mort to serve webp images on Wordpress on-the-fly.
i.e.
BEFORE: https://mydomain.com/wp-content/filename.jpg
(content type: jpeg)
AFTER: https://mydomain.com/wp-content/filename.jpg
(content type: webp)
My setup is:
Cloudflare -> Docker
- Wordpress (with Apache)
- Mort
Apache ProxyPass passing image request to Mort
ProxyPassMatch "^/(.*\.jpg)$" "http://mort:8080/$1"
ProxyPassMatch "^/(.*\.jpeg)$" "http://mort:8080/$1"
ProxyPassMatch "^/(.*\.png)$" "http://mort:8080/$1"
On Docker-Compose wp-content
is mounted onto Mort container:
version: '3.8'
services:
mort:
container_name: mort
image: ghcr.io/aldor007/mort
volumes:
- type: bind
source: ./misc/mort-config.yml
target: /etc/mort/mort.yml
- type: bind
source: ./wordpress
target: /root
restart: unless-stopped
Hence
# ls -la /root
total 28
drwxrwxrwx 3 1000 1000 4096 Aug 11 04:34 .
drwxr-xr-x 1 root root 4096 Aug 12 02:49 ..
-rwxrwxrwx 1 1000 1000 34 May 16 02:13 .git
-rwxrwxrwx 1 1000 1000 1009 Aug 11 05:43 .gitignore
-rwxrwxrwx 1 1000 1000 5480 May 16 02:13 wp-config-docker.php
drwxr-xr-x 14 www-data www-data 4096 Aug 12 03:14 wp-content
This is configuration of Mort:
#server:
# listen: "0.0.0.0:8080"
# monitoring: ""
# cache:
# type: "memory"
# cacheSize: 50000
# maxCacheItemSizeMB: 50
# requestTimeout: 70
# internalListen: "0.0.0.0:8081"
# plugins:
# - "webp"
headers:
- statusCodes: [200]
values:
"cache-control": "max-age=84000, public"
- statusCodes: [404, 400]
values:
"cache-control": "max-age=60, public"
- statusCodes: [500, 503]
values:
"cache-control": "max-age=10, public"
buckets:
demo:
transform:
path: "\\/(?P<presetName>[a-z0-9_]+)\\/(?P<parent>.*)"
kind: "presets"
parentStorage: "mounted-dir"
presets:
wp-content:
quality: 100
format: webp
filters:
thumbnail:
width: 1000
storages:
basic:
kind: "local-meta"
rootPath: "/root"
mounted-dir:
kind: "local-meta"
rootPath: "/root"
docker logs -f mort
shows this error:
{"level":"warn","ts":"2022-08-12T03:14:45.581Z","caller":"middleware/s3.go:179","msg":"S3Auth no bucket for access key","hostname":"0e2d7b3c2416","pid":1}
May I know if how should I configure it?
Thanks.
Hey @thematrixdev
mort is miming AWS s3, so each request which is going to it has to have bucket name. In your case, you can try something like this
ProxyPassMatch "^/(.*\.jpg)$" "http://mort:8080/demo/$1"
ProxyPassMatch "^/(.*\.jpeg)$" "http://mort:8080/demo/$1"
ProxyPassMatch "^/(.*\.png)$" "http://mort:8080/demo/$1"
demo
it is name of the bucket from config
Mort config that should work (you don't need to set parentStarage
and you need to provide transform
storage - this is a place where images after processing will be saved)
# mort config
#server:
# listen: "0.0.0.0:8080"
# monitoring: ""
# cache:
# type: "memory"
# cacheSize: 50000
# maxCacheItemSizeMB: 50
# requestTimeout: 70
# internalListen: "0.0.0.0:8081"
# plugins:
# - "webp"
headers:
- statusCodes: [200]
values:
"cache-control": "max-age=84000, public"
- statusCodes: [404, 400]
values:
"cache-control": "max-age=60, public"
- statusCodes: [500, 503]
values:
"cache-control": "max-age=10, public"
buckets:
demo:
transform:
path: "\\/(?P<presetName>[a-z0-9_]+)\\/(?P<parent>.*)"
kind: "presets"
presets:
wp-content:
quality: 100
format: webp
filters:
thumbnail:
width: 1000
storages:
basic:
kind: "local-meta"
rootPath: "/root"
transform:
kind: "local-meta"
rootPath: "/root"
pathPrefix: "transform"
Looks like I am using the right tool for my work. Thanks for your help anyway.