Imgproxy is a standalone server for resizing images. It is optional and you do not need it to start Forem locally. We are currently only using it in Forem Cloud.
brew install imgproxy.
For more options not covered here, please take a look at the official installation documentation.
Generate a key/salt pair by running the following in your terminal twice. Copy those values to your
.env in the next step
echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
.env, add the following.
export IMGPROXY_ENDPOINT='http://localhost:8080' export IMGPROXY_KEY='1b1c9aae804e070b0864f2547fba7ce8ff31bf7..........' export IMGPROXY_SALT='8c6d449d4fc2cada5bab538826cae709d2ade9f.........'
Start the Forem app server normally.
Start Imgproxy in a terminal with the key and salt.
# If you installed via homebrew or using the binary. > IMGPROXY_KEY='your key' IMGPROXY_SALT='your salt' imgproxy # If you are using Docker or Podman. The commands are identical for both > docker run -p 8080:8080 \ -e IMGPROXY_KEY="your key" \ -e IMGPROXY_SALT="your salt" \ -it darthsim/imgproxy
That's it :)
You should verify it's working by starting the Forem app locally and see that each image is loaded properly, or run the following command while the Forem app is running:
> curl -I http://localhost:8080/unsafe/aHR0cDovL2xvY2Fs/aG9zdDozMDAwL2Fz/c2V0cy8xLnBuZw HTTP/1.1 200 OK Server: imgproxy X-Request-Id: GYvCGXb98JUwL3ujwpjzh Date: Tue, 27 Oct 2020 16:11:37 GMT
--network="host") so Imgproxy can properly access the localhost.