image: repository: ghcr.io/goofball222/unifi tag: 8.1.127@sha256:53c1d3ae87b9c5726f16e219703707c9190b441813bd2f6c7c28063312a832b4 pullPolicy: IfNotPresent service: main: ports: main: protocol: https port: 8443 targetPort: 8443 comm: enabled: true ports: comm: enabled: true port: 8080 targetPort: 8080 stun: enabled: true ports: stun: enabled: true port: 3478 targetPort: 3478 protocol: udp speedtest: enabled: true ports: speedtest: enabled: true port: 6789 targetPort: 6789 guestportal: enabled: true ports: web: enabled: true port: 8880 targetPort: 8880 protocol: http websecure: enabled: true port: 8843 targetPort: 8843 protocol: https persistence: config: enabled: true targetSelector: main: main: mountPath: /usr/lib/unifi/olddata migrate: mountPath: /usr/lib/unifi/olddata data: enabled: true targetSelector: main: main: mountPath: /usr/lib/unifi/data migrate: mountPath: /usr/lib/unifi/data logs: enabled: true mountPath: "/usr/lib/unifi/logs" type: "emptyDir" certs: enabled: true mountPath: "/usr/lib/unifi/cert" portal: open: enabled: true securityContext: container: readOnlyRootFilesystem: false runAsGroup: 0 runAsUser: 0 workload: main: podSpec: containers: main: env: RUN_CHOWN: true DB_MONGO_LOCAL: true initContainers: migrate: enabled: true type: init imageSelector: alpineImage command: - /bin/sh args: - -c - | newdatadir="/usr/lib/unifi/data" olddatadir="/usr/lib/unifi/olddata/data" # Check the dir exists [ ! -d "$newdatadir" ] && echo "$newdatadir missing" && exit 1 # Check if there is a data/data dir to migrate [ ! -d "$olddatadir" ] && echo "No $olddatadir dir found. Migration skipped" && exit 0 # Check if the new data dir is empty, ignoring the old data dir dirs=$(ls -A "$newdatadir" | grep -v "data") if [ -n "$dirs" ]; then echo "New data dir is empty. Migrating data one level up" cp -rf $olddatadir/* $newdatadir || echo "Failed to move data" && exit 1 echo "Data migration complete" fi