diff --git a/podman/init_db.js b/podman/init_db.js new file mode 100644 index 0000000..8dfdfd5 --- /dev/null +++ b/podman/init_db.js @@ -0,0 +1,20 @@ +db.getSiblingDB("unifi").createUser ( + { + user: "unifi", + pwd: "unifi", + roles: [ + { role: "dbOwner", db: "unifi" }, + { role: "dbOwner", db: "unifi_stat" } + ] + } +); +db.getSiblingDB("unifi_stat").createUser ( + { + user: "unifi", + pwd: "unifi", + roles: [ + { role: "dbOwner", db: "unifi_stat" } + ] + } +); + diff --git a/podman/unifi.yaml b/podman/unifi.yaml index aaac563..bde7aa3 100644 --- a/podman/unifi.yaml +++ b/podman/unifi.yaml @@ -1,32 +1,65 @@ -version: 3.7 +version: "3.7" services: - unifi: - image: code.balsillie.net/containers/unifi:latest - container_name: unifi + mongodb: + image: mongo:4-focal + container_name: mongodb + command: ["docker-entrypoint.sh", "mongod", "--bind_ip_all", "--auth"] restart: always - ports: - - "8080:8080" - - "8443:8443" - - "8843:8843" + networks: + mongodb: + aliases: + - mongodb volumes: - - /podman/volumes/unifi:/var/lib/unifi/ + - /docker/volumes/mongodb/db:/data/db + - /docker/volumes/mongodb/init:/docker-entrypoint-initdb.d environment: - TZ=Pacific/Auckland - - UNIFI_DB_PASSWORD=kay9bYJ9TeNDMCHdbTtdtHDH4 + + unifi: + # image: code.balsillie.net/containers/unifi:latest + image: lscr.io/linuxserver/unifi-network-application:latest + container_name: unifi + restart: always + networks: + unifi: + aliases: + - unifi + ipv4_address: 10.192.30.253 + mongodb: + aliases: + - unifi + volumes: + - /docker/volumes/unifi:/config + environment: + - PUID=1000 + - PGID=1000 + - TZ=Pacific/Auckland + - MONGO_USER=unifi + - MONGO_PASS=unifi + - MONGO_HOST=mongodb.mongodb + - MONGO_PORT=27017 + - MONGO_DBNAME=unifi depends_on: - mongodb +networks: + + unifi: + name: unifi + external: false + driver: macvlan + driver_opts: + parent: vlan30 + ipam: + driver: default + config: + - subnet: 10.192.30.0/24 + - gateway: 10.192.30.254 + mongodb: - image: mongo:6-jammy - container_name: mongodb - # command: ["docker-entrypoint.sh", "mongod", "--bind_ip_all", "--ipv6", "--auth"] - command: ["docker-entrypoint.sh", "mongod", "--bind_ip_all", "--auth"] - restart: always - volumes: - - /podman/volumes/mongodb:/data/db - environment: - - TZ=Pacific/Auckland - - MONGO_INITDB_ROOT_USERNAME=admin - - MONGO_INITDB_ROOT_PASSWORD=Vy9hxq5TCQNKZobpkUo5 + name: unifi + external: false + internal: true + driver: bridge