{"id":16935949,"url":"https://github.com/nathanejohnson/docker_compose_unifi_mongo","last_synced_at":"2026-04-05T22:03:03.006Z","repository":{"id":251848162,"uuid":"838621472","full_name":"nathanejohnson/docker_compose_unifi_mongo","owner":"nathanejohnson","description":"docker compose for spinning up unifi-network-application and mongodb along with a custom acme.sh deployment hook","archived":false,"fork":false,"pushed_at":"2024-08-12T16:07:41.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-26T01:42:15.975Z","etag":null,"topics":["acme-sh","docker","docker-compose","unifi-network-application"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nathanejohnson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-06T03:05:15.000Z","updated_at":"2024-08-12T16:07:44.000Z","dependencies_parsed_at":"2024-08-06T06:11:48.344Z","dependency_job_id":"8a9ea798-2527-4637-8996-1332cac125f0","html_url":"https://github.com/nathanejohnson/docker_compose_unifi_mongo","commit_stats":null,"previous_names":["nathanejohnson/docker_compose_unifi_mongo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanejohnson%2Fdocker_compose_unifi_mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanejohnson%2Fdocker_compose_unifi_mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanejohnson%2Fdocker_compose_unifi_mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanejohnson%2Fdocker_compose_unifi_mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathanejohnson","download_url":"https://codeload.github.com/nathanejohnson/docker_compose_unifi_mongo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244739958,"owners_count":20501992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acme-sh","docker","docker-compose","unifi-network-application"],"created_at":"2024-10-13T20:55:43.110Z","updated_at":"2025-12-31T00:03:39.068Z","avatar_url":"https://github.com/nathanejohnson.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## unifi application with mongodb docker-compose.yml that runs on raspberry pi (among others)\n\nUses the [linuxserver.io unifi image ](https://docs.linuxserver.io/images/docker-unifi-network-application/) as well as the [official mongo docker image](https://hub.docker.com/_/mongo)\n\nclone this into a directory\n\ncopy env.template to .env\n\nedit .env file and populate variables appropriately\n\nThis expects that the unifi controller will run on a dedicated externally defined docker network created with\n\n    docker network create\n\nand specify the name of the network created as `MANAGEMENT_NETWORK` in .env .  This is meant to run with a static IP within the subnet defined in the network, defined as `UNIFI_ADDRESS` in the .env.  I use an ipvlan network for this, as all of my APs run on a management vlan that doesn't have internet access through the firewall.  Tweak as necessary.  You'll also want the user id and group id to be accurate for the `PUID` and `PGID` fields, using values from the `id` command.\n\n\nAs an example, this is how I created my vlan network for my management network, vlan 2, with 192.168.2.0/24 as the subnet, and 192.168.2.1 as the gateway, and a ipam range of 192.168.2.176-192.168.2.192, hung off interface eth0 vlan 2 (eth0.2) - it will create eth0.2 for you, no need to worry about it existing beforehand.  I have a dhcp server on this same vlan, but I make sure both the --ip-range specified as well as the `UNIFI_ADDRESS` are outside of this range, for obvious reasons.  `UNIFI_ADDRESS` should also be outside of the --ip-range specified.\n\n    docker network create -d ipvlan --gateway 192.168.2.1 --subnet '192.168.2.0/24' --ip-range '192.168.2.176/28' -o 'parent=eth0.2' ipvlan2\n\n\ndocker compose up -d and enjoy!\n\n\nIncluded also is an [acme.sh](https://github.com/acmesh-official/acme.sh) [deploy hook](unifi_docker.sh) meant to be run on the docker host without requiring the docker container to have network access.  This allows us to use zerossl / letsencrypt to generate TLS certificates for our web UI.\n\nIn order to use the deploy hook, first make sure you have created a certificate for the domain you plan to use for your unifi controller.  Next you'll need to symlink the `unifi_docker.sh` script into the acme deploy hook directory.  For example:\n\n    ln -s $(pwd)/unifi_docker.sh ~/.acme.sh/deploy/\n\nThere are three optional environment / configuration variables that can influence behavior.  The first is \n\n    UNIFI_DOCKER_DIR\n\nThis is used to indicate the location on disk where this repository is cloned.  If this variable isn't set, it will attempt to use pull the docker compose file location out of the output from a docker inspect command, and failing that,  `${HOME}/docker_compose_unifi_mongo` if it exists.  Otherwise it will error out, unless `UNIFI_HOST_DATA_DIR` is set explicitly.  Normally the docker inspect should do the right thing.\n\n    UNIFI_HOST_DATA_DIR\nSet this if you're moved the /config/data mount volume mount location.  Defaults to `\"${UNIFI_DOCKER_DIR}/unifi-data/data\"`\n\n    UNIFI_CONTAINER_NAME\nSet this if you've changed the name of the unifi container.  Defaults to `unifi-network-application`\n\nThis deploy hook saves the state of these environment variables into the acme.sh configuration variables, so it should persist when running subsequently from cron after the initial invocation.\nIn other words, no need to set these environment variables again after the initial successful invocation.  If something goes wrong, pass the `--debug` flag to\nacme.sh\n\n### NOTE: if you're on a raspberry PI, you need to do this in order for ipvlan / macvlan networks to work (assuing ubuntu or likely debian) and reboot:\n\n    apt install linux-modules-extra-raspi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanejohnson%2Fdocker_compose_unifi_mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanejohnson%2Fdocker_compose_unifi_mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanejohnson%2Fdocker_compose_unifi_mongo/lists"}