jams2 / image-backends-poc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pluggable image backends POC

Setting up imgproxy

  1. Set environment variables for imgproxy

    1. cp .env.example .env
    2. Set values in .env for IMGPROXY_KEY and IMGPROXY_SALT (echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n') will do - see imgproxy docs)

Setting up imgix

  1. Set up a free account on imgix
  2. Follow the quick-start guide
    • use any appropriate name for your subdomain
    • select "web proxy" for your storage location
  3. Add IMGIX_DOMAIN to your .env (e.g. pluggable-rendition-backends.imgix.net)
  4. Take a note of your imgix signature key - this can be retrieved by revealing the "token" in the security section of the dashboard for your source
    • add IMGIX_SIGNATURE_KEY to your .env, with this value

Running the application

  1. Run a reverse proxy targeting port 8000 on your machine, e.g. with ngrok. This is necessary as imgix is a hosted service and needs to query your local application server for the original rendition
  2. Build and run the containers (one for Wagtail, one for imgproxy)
export HOSTUID=$(id -u)  # make web container user ID match host user ID
export PROXY_URL_FOR_IMGIX='e.g. your ngrok URL'
docker-compose up
  1. Create a superuser
docker-compose exec web bash
python manage.py createsuperuser
  1. Create an instance of ImageTestingPage, adding some images to the StreamField

  2. View your new page

About


Languages

Language:Python 79.6%Language:HTML 16.1%Language:Dockerfile 4.3%