shift-org / shift-docs

Shift2Bikes: website and calendar for shift and pedalpalooza
https://shift2bikes.org
Other
22 stars 17 forks source link

figure out and implement a reasonable mapping for eventimages folder, adjusting nginx and docker to handle #633

Closed fool closed 1 month ago

fool commented 8 months ago

This should cover both saving and showing - as of 7 Mar, it looked like new event images are beign saved to /opt/shift-docs/app/eventimages/EVENTID.EXT, but fool thinks nginx doesn't point to that location! Perhaps this storage should also be outside of the container like mysql? Maybe we could use /opt/shift-data/eventimages like /opt/shift-data/mysql in https://github.com/shift-org/shift-docs/issues/630 ?

Should also when we do this update shift_domain as mentioned here to point to beta.shift2bikes.org: https://shift2bikes.slack.com/archives/CCFLDTCF7/p1710189275348339?thread_ts=1709871971.848139&cid=CCFLDTCF7

Once decided and imoplemented, also please copy in images from live server and report back as to how you did it and any permissions changes needed before closing this issue

ionous commented 8 months ago

the old ngnix container points to the images directory via its conf here:

 location ~ /eventimages/(\d+)(?:-\d+).(\w+) {
      alias /opt/backend/eventimages/$1.$2;
      expires max;
  }
 location /eventimages {
      alias /opt/backend/eventimages;
 }

and it looks like docker compose mapped /opt/backed/images to the local host, here:

https://github.com/shift-org/shift-docs/blob/871389a93f491479f0b9569e6c944246590629ad/docker-compose.yml#L14

the EVENTIMAGES env var for local development ( and possibly production? ) gets set via the ./shift script here:

export ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export SERVICES="${ROOT}/services"
export EVENTIMAGES="${ROOT}/backend/eventimages"

it's not an true "volume" i think, but since that directory exists on the host; it still persists across reboots and docker image reinstalls. ( note: changes to files on an image do persist across reboots according to the docker docs; but reinstalls/upgrades of the docker image itself would erases anything that wasn't stored externally -- in an explicit volume or mapped on to the host )