Preserve assets/GUIDs after updating containers

Found these two very convenient docker-compose commands for updating my Docker containers on my local machine:

docker-compose -f .\docker-compose-noproxy.yml pull

and

docker-compose -f .\docker-compose-noproxy.yml up -d

Recreating standalone_squidex_mongo_1 ... done Recreating standalone_squidex_squidex_1 ... done

The containers get recreated and started, data in mongo gets preserved and everything works fine.

Except:

The images.

All of my images are now “gone”:

They are there, but pointing to a non-existing blob, or if it’s the other way around? That the blob exists but the GUID has been changed automatically during the update.

I could of course change the way I work by not uploading that many images and only have a few so that I don’t have to reupload that many if I ever need to update my container images, but sometimes when working on blogposts for instance I need to upload quite a few (in multiple languages) so this can become a tedious task manually reuploading and settings all of the <img> tags in my content if I ever need to update my container images.

Hope the above makes sense.

PS. Loving the new updates to the UI in this new version!

You need to mount the asset folder to your host machine or you store them in MongoDB

I have that kind of setup on PROD.
I guess I could do something similar on DEV.
It’s a pain though, with docker, kubernetes, volume mounts etc etc etc Did it a long time ago so I have forgotten most of the setup steps…
A lot of moving parts to wrap your head around.
It would be nice to have a step by step tutorial for this one actually.
Someone from the community maybe could provide one?
I would if I had a little more time but I don’t. At least not right now.

There is a volume mount in the dockerfile: https://github.com/Squidex/squidex-docker/blob/master/standalone/docker-compose-production.yml#L34

Thanks, I think that did it.

1 Like

Just adding the following for reference:

version: '2.1'
services:
  squidex_mongo:
    image: mongo:latest
    ports:
      - "27017:27017"
    volumes:
      - vol-for-mongo:/data/db
    networks:
      - internal
    restart: unless-stopped

  squidex_squidex:
    image: "squidex/squidex:dev-3578"
    ports:
      - "80:80"
    environment:
      - URLS__BASEURL=${SQUIDEX_PROTOCOL}://${SQUIDEX_DOMAIN}/
      - URLS__ENFORCEHTTPS=${SQUIDEX_FORCE_HTTPS}
      - EVENTSTORE__CONSUME=true
      - EVENTSTORE__MONGODB__CONFIGURATION=mongodb://squidex_mongo
      - STORE__MONGODB__CONFIGURATION=mongodb://squidex_mongo
      - IDENTITY__ADMINEMAIL=${SQUIDEX_ADMINEMAIL}
      - IDENTITY__ADMINPASSWORD=${SQUIDEX_ADMINPASSWORD}
      - IDENTITY__GOOGLECLIENT=${SQUIDEX_GOOGLECLIENT}
      - IDENTITY__GOOGLESECRET=${SQUIDEX_GOOGLESECRET}
      - IDENTITY__GITHUBCLIENT=${SQUIDEX_GITHUBCLIENT}
      - IDENTITY__GITHUBSECRET=${SQUIDEX_GITHUBSECRET}
      - IDENTITY__MICROSOFTCLIENT=${SQUIDEX_MICROSOFTCLIENT}
      - IDENTITY__MICROSOFTSECRET=${SQUIDEX_MICROSOFTSECRET}
      - LETSENCRYPT_HOST=${SQUIDEX_DOMAIN}
      - LETSENCRYPT_EMAIL=${SQUIDEX_ADMINEMAIL}
    depends_on:
      - squidex_mongo
    volumes:
      - vol-for-squidex:/app/Assets
    networks:
      - internal
    restart: unless-stopped
    
networks:
  internal:
    driver: bridge

volumes:
  vol-for-mongo:
  vol-for-squidex:

I had to actually create persistent volumes in order for Docker Desktop (Win) to persist my data between docker-compose down, and docker daemon restarts, PC reboots etc

Might want to add that to docker-compose-noproxy.yml and all the other docker-compose yml files.

Where is it missing?: https://github.com/Squidex/squidex-docker/tree/master/standalone

I think you do not need a named volume you can just use a path mapping directly.