saltyorg / Sandbox

Saltbox Sandbox
GNU General Public License v3.0
73 stars 101 forks source link

Notifiarr: Starr app Database Checks Requirement #329

Closed Nypheena closed 9 months ago

Nypheena commented 9 months ago

The database corruption check requires a folder to move and then examine a backup file from the Starr apps which is /tmp by default it doesn't have access to that obviously so this will allow it to use its appdata folder for this purpose

I'm not sure if I did it entirely right I probably did not

https://notifiarr.wiki/en/Client/Configuration#tmp-not-found

saltydk commented 9 months ago

Just mount a real tmpfs, you can see an example of that in privatebin.

Nypheena commented 9 months ago

My main idea was mainly containment to the one folder for the app itself, there is a TMPDIR env which I suppose could mount a tmpfs if that is how you'd prefer it I could look into such

saltydk commented 9 months ago

Anything that uses /tmp paths usually isn't meant to exist past a reboot. So if that is the goal here mount tmpfs

Nypheena commented 9 months ago

Looking into privatebin it seems to make it a whole lot more complicated and even making a docker volume to act as the tmpfs, I know linux makes a few tmpfs by default already but I don't know which would be universal besides /run or /dev/shm but if tmpfs is the only way I guess I can try to look into how to accomplish it

saltydk commented 9 months ago

It is just:

notifiarr_docker_mounts_default:
  - target: /tmp
    type: tmpfs
Nypheena commented 9 months ago

Ah didn't know if that was enough, if not obvious by now I'm definitely not very smart in all this and I overcompliccated with these

- name: Create a volume with options
  community.docker.docker_volume:
    name: "{{ lookup('vars', role_name + '_docker_container') }}_tmpfs_run"
    driver_options:
      type: tmpfs
      device: tmpfs
privatebin_docker_volumes_default:
  - "{{ privatebin_paths_location }}:/srv/data"
  - "{{ privatebin_paths_location }}/conf.php:/srv/cfg/conf.php:ro"
  - "{{ lookup('vars', role_name + '_docker_container') }}_tmpfs_run:/run"

I thought it was using these in the mounts bit

Although I don't seem to have a /tmp mount as tmpfs on my filesystem but maybe its not even mounting something on host system?

saltydk commented 9 months ago

You can google tmpfs to get an understanding of what it means. The reason we mount them as opposed to mounting the hosts /tmp folder is to avoid collision, Emby for instance cannot run multiple instances if they share a /tmp folder.

saltydk commented 9 months ago
# Mounts
notifiarr_docker_mounts_default:
  - target: /tmp
    type: tmpfs
notifiarr_docker_mounts_custom: []
notifiarr_docker_mounts: "{{ notifiarr_docker_mounts_default
                             + notifiarr_docker_mounts_custom }}"

You need the whole block, as the create container task loads the _docker_mounts variable.

Nypheena commented 9 months ago
# Mounts
notifiarr_docker_mounts_default:
  - target: /tmp
    type: tmpfs
notifiarr_docker_mounts_custom: []
notifiarr_docker_mounts: "{{ notifiarr_docker_mounts_default
                             + notifiarr_docker_mounts_custom }}"

You need the whole block, as the create container task loads the _docker_mounts variable.

Oh okay, makes sense as I was about to say I tested with inventory real quick and it couldn't access /tmp lemme try with this

Nypheena commented 9 months ago

Okay tested with inventory and it worked the check was successful, sorry for the overcomplication and missing that, I do see the whole block has the defaults input which is obviously the whole point to actually add the mounts