Asset are not stored

I’m using Docker Compose, and the images from penpotapp are not uploading assets.

Hi. Could you please tell me what is your environment? The operating system you are using, if you are using any container management application or just plain docker commands, etc.

Also are you using the default docker-compose.yaml and config.env files, or have you modified something?

Thanks.

I updated to the latest image and now the images are stored, but not displayed
I’m using Ubuntu with docker, docker-compose,
this is my docker compose file:

version: "3.5"

networks:
  penpot:

volumes:
  penpot_postgres_data:
  penpot_assets_data:

services:
  penpot-frontend:
    container_name: penpot-frontend
    image: penpotapp/frontend:latest
    ports:
      - 9001:80

    environment:
      - PENPOT_FLAGS=${PENPOT_FLAGS}
      - PENPOT_PUBLIC_URI=${PENPOT_PUBLIC_URI}
      - PENPOT_TELEMETRY_ENABLED=${PENPOT_TELEMETRY_ENABLED}
      - PENPOT_TELEMETRY_WITH_TAIGA=${PENPOT_TELEMETRY_WITH_TAIGA}
      - PENPOT_REGISTRATION_ENABLED=${PENPOT_REGISTRATION_ENABLED}
      - PENPOT_ALLOW_DEMO_USERS=${PENPOT_ALLOW_DEMO_USERS}
      # Open ID
      - PENPOT_OIDC_CLIENT_ID=${PENPOT_OIDC_CLIENT_ID}


    depends_on:
      - penpot-backend
      - penpot-exporter

    networks:
      - penpot
    restart: always
  penpot-backend:
    container_name: penpot-backend
    image: penpotapp/backend:latest
    volumes:
      - penpot_assets_data:/opt/data

    depends_on:
      - penpot-postgres
      - penpot-redis
    ports:
      - 6060:6060

    environment:
      - PENPOT_FLAGS=${PENPOT_FLAGS}
      # Public URI
      - PENPOT_PUBLIC_URI=${PENPOT_PUBLIC_URI}
      # Redis
      - PENPOT_REDIS_URI=${PENPOT_REDIS_URI}
      # Telemetry
      - PENPOT_TELEMETRY_ENABLED=${PENPOT_TELEMETRY_ENABLED}
      - PENPOT_TELEMETRY_WITH_TAIGA=${PENPOT_TELEMETRY_WITH_TAIGA}
      # Registration
      - PENPOT_REGISTRATION_ENABLED=${PENPOT_REGISTRATION_ENABLED}
      - PENPOT_ALLOW_DEMO_USERS=${PENPOT_ALLOW_DEMO_USERS}
      # Database
      - PENPOT_DATABASE_URI=${PENPOT_DATABASE_URI}
      - PENPOT_DATABASE_USERNAME=${PENPOT_DATABASE_USERNAME}
      - PENPOT_DATABASE_PASSWORD=${PENPOT_DATABASE_PASSWORD}
      # Open ID
      - PENPOT_OIDC_CLIENT_ID=${PENPOT_OIDC_CLIENT_ID}
      - PENPOT_OIDC_BASE_URI=https://login.microsoftonline.com/${PENPOT_OIDC_TENANT_ID}/v2.0/
      - PENPOT_OIDC_CLIENT_SECRET=${PENPOT_OIDC_CLIENT_SECRET}
      # SMTP
      - PENPOT_SMTP_DEFAULT_FROM=${PENPOT_SMTP_DEFAULT_FROM}
      - PENPOT_SMTP_DEFAULT_REPLY_TO=${PENPOT_SMTP_DEFAULT_REPLY_TO}
      - PENPOT_SMTP_HOST=${PENPOT_SMTP_HOST}
      - PENPOT_SMTP_PORT=${PENPOT_SMTP_PORT}
      - PENPOT_SMTP_USERNAME=${PENPOT_SMTP_USERNAME}
      - PENPOT_SMTP_PASSWORD=${PENPOT_SMTP_PASSWORD}
      - PENPOT_SMTP_TLS=${PENPOT_SMTP_TLS}
      # Assets
      - PENPOT_ASSETS_STORAGE_BACKEND=assets-fs
      - PENPOT_STORAGE_ASSETS_FS_DIRECTORY=/opt/data/assets

    networks:
      - penpot
    restart: always
  penpot-exporter:
    container_name: penpot-exporter
    image: penpotapp/exporter:latest
    environment:
      # Don't touch it; this uses internal docker network to
      # communicate with the frontend.
      - PENPOT_PUBLIC_URI=http://penpot-frontend
    networks:
      - penpot
    restart: always
  penpot-postgres:
    container_name: penpot-postgres
    image: postgres:13
    restart: always
    stop_signal: SIGINT
    environment:
      - POSTGRES_INITDB_ARGS=--data-checksums
      - POSTGRES_DB=${PENPOT_DATABASE_DBNAME}
      - POSTGRES_USER=${PENPOT_DATABASE_USERNAME}
      - POSTGRES_PASSWORD=${PENPOT_DATABASE_PASSWORD}
    volumes:
      - penpot_postgres_data:/var/lib/postgresql/data
    networks:
      - penpot
  penpot-redis:
    container_name: redis
    image: redis:6
    restart: always
    networks:
      - penpot

I have a reverse proxy, pointing to that container at port 9001,
I can see the files being uploaded on the directory I specified: PENPOT_STORAGE_ASSETS_FS_DIRECTORY=/opt/data/assets

but assets are not being displayed:

that request is not on frontend logs or backend logs

Tried also opening the port for the backend and specify the proxy location with the same 404 result:
image

BTW, I’m using nginx proxy manager

Ok. When you use file system storage, the backend uses x-accel-redirect to tell nginx to serve the asset from its physical location.

The nginx proxy included in the standard docker files is already configured to do this. If you have set up your own proxy, perhaps you need to add something. Perhaps you can look at the nginx logs searching for HTTP 204 status answers with x-accel-redirect header.

I don’t think that’s the issue, the logs show:

2023-01-03T18:49:00.334410276Z 2023/01/03 18:49:00 [error] 8#8: *70 open() "/opt/data/assets/e7/32/05335a06450689a864ba74f8ba0f" failed (2: No such file or directory), client: 10.10.100.25, server: _, request: "GET /assets/by-id/e7320533-5a06-4506-89a8-64ba74f8ba0f HTTP/1.1", upstream: "http://172.23.0.4:6060/assets/by-id/e7320533-5a06-4506-89a8-64ba74f8ba0f", host: "penpot.mysite.com", referrer: "https://penpot.mysite.com/"

so, the server app can’t read the file, I can go to that directory on the server and find the file:

root@0e26e2bba4b4:/opt/data/assets/e7/32# ls
05335a06450689a864ba74f8ba0f
root@0e26e2bba4b4:/opt/data/assets/e7/32# 

This log suggests that the nginx you are using for reverse proxy cannot see the file. The penpot server is working well, since the file exists, but there is something that hides it from nginx.

Perhaps it’s related to permissions. What permissions does the file, and all it parent directories, have? Under what linux user is nginx runing? Is there any sandbox or similar involved?

And is the nginx running in the same machine as Penpot backend or a different one?

found the issue, from newest version of your docker compose script, I noticed that the frontend also has a volume to the assets, in other words, the following two lines are in the frontend and in the backend:

    volumes:
      - penpot_assets:/opt/data/assets

Ah ok. So you finally managed to get it working? If so, I’m glad.