Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media files disappeard from volume after Upgrade to 4.1.7 #1357

Open
baccenfutter opened this issue Dec 3, 2024 · 1 comment
Open

Media files disappeard from volume after Upgrade to 4.1.7 #1357

baccenfutter opened this issue Dec 3, 2024 · 1 comment

Comments

@baccenfutter
Copy link

Current Behavior

When I load any media file, I get:

/media/image-attachments/$FILENAME
The requested page does not exist.

Looking at Customizations->Image-Attachments, I see the list of all previously uploaded images, but clicking on any of them leads to the same error as above.

I then docker-compose exec netbox bash:

# ls -ls /media
total 0

# ls -ls /opt/netbox/netbox/media
total 8
4 drwxrwxr-x 2 unit root 4096 Jul 18 21:36 devicetype-images
4 drwxrwxr-x 2 unit root 4096 Oct 23 11:55 image-attachments

# ls -ls /opt/netbox/netbox/media/image-attachments/
total 464
104 -rw-r--r-- 1 unit root 105919 Oct 23 11:55 device_1224_Veeam_Ipconfig.png
 72 -rw-r--r-- 1 unit root  73698 Oct 23 11:53 device_1224_Windows_Network_Config.png
288 -rw-r--r-- 1 unit root 292955 Oct 23 11:53 device_1224_Windows_Network_Config_H2nOpNB.png

So it seems that all my media files have been deleted from the named volume. Not sure if this happened during upgrade of Docker itself or while upgrading to netbox-4.1.7.

My upgrade routine is:

vim docker-compose.yml
(adjust version tag)
docker-compose pull
docker-compose up -d

I've been doing this routine for over a year new, without any issues. Now, suddenly, all my media files disappeared.

Expected Behavior

Media files in named volume persist across upgrades and do not get deleted without any further notice.

Docker Compose Version

1.25

Docker Version

Client:
 Version:           20.10.5+dfsg1
 API version:       1.41
 Go version:        go1.15.15
 Git commit:        55c4c88
 Built:             Sun Oct 13 16:05:55 2024
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.5+dfsg1
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.15.15
  Git commit:       363e9a8
  Built:            Mon May 30 18:34:49 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.13~ds1
  GitCommit:        1.4.13~ds1-1~deb11u4
 runc:
  Version:          1.0.0~rc93+ds1
  GitCommit:        1.0.0~rc93+ds1-5+deb11u5
 docker-init:
  Version:          0.19.0

The git Revision

b47e85a

The git Status

On branch release
Your branch is up to date with 'origin/release'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   configuration/plugins.py
        modified:   docker-compose.yml
        modified:   env/netbox.env
        modified:   env/postgres.env
        modified:   env/redis-cache.env
        modified:   env/redis.env
        modified:   requirements-container.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        netbox.env
        netbox.sql
        plugin_requirements.txt

no changes added to commit (use "git add" and/or "git commit -a")

Startup Command

docker-compose up -d

NetBox Logs

Attaching to netbox_netbox_1
netbox_1               | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox_1               | 💡 Superuser Username: admin, E-Mail: [email protected]
netbox_1               | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox_1               | ✅ Initialisation is done.
netbox_1               | ⏳ Waiting for control socket to be created... (1/10)
netbox_1               | 2024/11/29 10:57:14 [warn] 7#7 Unit is running unprivileged, then it cannot use arbitrary user and group.
netbox_1               | 2024/11/29 10:57:14 [info] 7#7 unit 1.33.0 started
netbox_1               | 2024/11/29 10:57:14 [info] 109#109 discovery started
netbox_1               | 2024/11/29 10:57:14 [notice] 109#109 module: python 3.12.3 "/usr/lib/unit/modules/python3.12.unit.so"
netbox_1               | 2024/11/29 10:57:14 [info] 7#7 controller started
netbox_1               | 2024/11/29 10:57:14 [notice] 7#7 process 109 exited with code 0
netbox_1               | 2024/11/29 10:57:14 [info] 111#111 router started
netbox_1               | 2024/11/29 10:57:14 [info] 111#111 OpenSSL 3.0.13 30 Jan 2024, 300000d0
netbox_1               | ⚙ Applying configuration from /etc/unit/nginx-unit.json
netbox_1               | 2024/11/29 10:57:15 [info] 114#114 "netbox" prototype started
netbox_1               | 2024/11/29 10:57:15 [info] 115#115 "netbox" application started
netbox_1               | ✅ Unit configuration loaded successfully
netbox_1               | 2024/11/29 10:57:17 [notice] 7#7 process 107 exited with code 0
netbox_1               | 2024/11/29 10:57:26 [info] 157#157 "netbox" application started
netbox_1               | 127.0.0.1 - - [29/Nov/2024:10:57:31 +0000] "GET /api/ HTTP/1.1" 200 549 "-" "curl/8.5.0"
netbox_1               | 127.0.0.1 - - [29/Nov/2024:10:57:44 +0000] "GET /api/ HTTP/1.1" 200 549 "-" "curl/8.5.0"
[...]
netbox_1               | 172.19.0.5 - - [03/Dec/2024:11:08:08 +0000] "GET /media/image-attachments/device_223_Rack_A1.1-Front_SW-001-FRA.jpg HTTP/1.1" 404 106738 "https://netbox.inx.de/extras/image-attachments/" "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0"
netbox_1               | 172.19.0.5 - - [03/Dec/2024:11:08:08 +0000] "GET /static/netbox_touch-icon-180.png HTTP/1.1" 200 6832 "https://netbox.inx.de/media/image-attachments/device_223_Rack_A1.1-Front_SW-001-FRA.jpg" "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0"
netbox_1               | 127.0.0.1 - - [03/Dec/2024:11:08:09 +0000] "GET /api/ HTTP/1.1" 200 549 "-" "curl/8.5.0"

Content of docker-compose.override.yml

version: '3.4'

networks:
  lb:
    external:
      name: lb

services:
  netbox:
    restart: unless-stopped
    networks:
      - lb
      - default
    ports:
      - 8000:8080
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.netbox.rule=Host(`netbox.inx.de`)"
      - "traefik.http.services.netbox.loadbalancer.server.port=8080"
      - "traefik.http.routers.netbox.entrypoints=websecure"
      - "traefik.http.routers.netbox.tls=true"
      #- "traefik.http.routers.netbox.tls.certresolver=selfsigned"
      - "traefik.docker.network=lb"
      # http to https redirection:
      - "traefik.http.routers.netbox.middlewares=https-redirect@docker"
      - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.netbox-http.rule=Host(`netbox.inx.de`)"
      - "traefik.http.routers.netbox-http.entrypoints=web"
      - "traefik.http.routers.netbox-http.middlewares=https-redirect"
@baccenfutter
Copy link
Author

Clarification: The three images found are those added after the last upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant