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

Uploaded images do not persist across restarts #51

Open
apanagio opened this issue Oct 1, 2022 · 5 comments
Open

Uploaded images do not persist across restarts #51

apanagio opened this issue Oct 1, 2022 · 5 comments
Labels
status: accepted This issue has been accepted by the maintainers team for implementation type: documentation

Comments

@apanagio
Copy link

apanagio commented Oct 1, 2022

If you stop and restart nautobot instance, you cannot view the uploaded images

Way to reproduce

  • Start nautobot using docker-compose
  • Upload an image to a site
  • Restart nautobot
  • Notice the previously uploaded files are missing

Explanation

If I understand correctly this happens because the uploaded images are stored in the file system within the container and the filesystem is purged when the container stops

Proposed Fix

Mount a volume from the host system to store uploaded files

@jvanderaa jvanderaa added status: accepted This issue has been accepted by the maintainers team for implementation type: documentation labels Oct 3, 2022
@jvanderaa
Copy link
Contributor

@apanagio do you have a proposed standard of where to mount the volumes back to on the host? I feel like that may be something that we can add on via documentation unless we have a standard to adhere to?

@apanagio
Copy link
Author

apanagio commented Oct 3, 2022

I don't have a proposal based on standards. I would suggest to do it as it is done with the "db_data" volume for the "db" service.

@glennmatthews glennmatthews changed the title Images do not persist across restarts Uploaded images do not persist across restarts Oct 6, 2022
@EdificomSA
Copy link

I did set

    volumes:
    - nautobot-media-files:/opt/nautobot/media

in docker-compose.override.yml for the "main" nautobot service

@rlad78
Copy link

rlad78 commented Oct 2, 2023

@EdificomSA how did you set up your permissions so that the nautobot user can write to that volume? I'm getting the following while trying to stand up Nautobot v1.6.2:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/nautobot/core/runner/runner.py", line 117, in settings_callback
    initializer(
  File "/usr/local/lib/python3.10/site-packages/nautobot/core/cli.py", line 123, in _configure_settings
    os.makedirs(os.path.join(settings.MEDIA_ROOT, "devicetype-images"))
  File "/usr/local/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/opt/nautobot/media/devicetype-images'

@EdificomSA
Copy link

Yeah you might need to chown the folder in the named volume, look at :
docker/compose#3270 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted This issue has been accepted by the maintainers team for implementation type: documentation
Projects
None yet
Development

No branches or pull requests

4 participants