1
0

unifi working with db init

This commit is contained in:
michael 2024-01-05 02:41:50 +13:00
parent 8d71ff222a
commit 9e07845208
2 changed files with 74 additions and 21 deletions

20
podman/init_db.js Normal file
View File

@ -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" }
]
}
);

View File

@ -1,32 +1,65 @@
version: 3.7 version: "3.7"
services: services:
unifi: mongodb:
image: code.balsillie.net/containers/unifi:latest image: mongo:4-focal
container_name: unifi container_name: mongodb
command: ["docker-entrypoint.sh", "mongod", "--bind_ip_all", "--auth"]
restart: always restart: always
ports: networks:
- "8080:8080" mongodb:
- "8443:8443" aliases:
- "8843:8843" - mongodb
volumes: volumes:
- /podman/volumes/unifi:/var/lib/unifi/ - /docker/volumes/mongodb/db:/data/db
- /docker/volumes/mongodb/init:/docker-entrypoint-initdb.d
environment: environment:
- TZ=Pacific/Auckland - 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: depends_on:
- mongodb - 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: mongodb:
image: mongo:6-jammy name: unifi
container_name: mongodb external: false
# command: ["docker-entrypoint.sh", "mongod", "--bind_ip_all", "--ipv6", "--auth"] internal: true
command: ["docker-entrypoint.sh", "mongod", "--bind_ip_all", "--auth"] driver: bridge
restart: always
volumes:
- /podman/volumes/mongodb:/data/db
environment:
- TZ=Pacific/Auckland
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=Vy9hxq5TCQNKZobpkUo5