forked from paultyng/terraform-provider-unifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
33 lines (30 loc) · 1.04 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
services:
unifi:
image: "jacobalberty/unifi:${UNIFI_VERSION:?}"
init: true
restart: "always"
user: "unifi"
ports:
- "${UNIFI_HTTP_PORT:-8080}:8080/tcp"
- "${UNIFI_HTTPS_PORT:-8443}:8443/tcp"
volumes:
- "./scripts/init.d:/usr/local/unifi/init.d:ro"
bootstrap:
image: "alpine/httpie"
depends_on:
unifi:
condition: "service_healthy"
entrypoint: "/bin/sh"
command:
- "-c"
- |
alias http='http --quiet --check-status --verify=no --ignore-stdin'
http https://unifi:8443/manage/account/login 2>/dev/null
case $$? in
0) echo 'Unifi controller has already been setup' >&2; exit 0;;
3) echo 'Bootstrapping Unifi controller';;
*) echo 'Unexpected HTTP response from Unifi controller' >&2; exit 1;;
esac
http https://unifi:8443/api/cmd/sitemgr cmd=add-default-admin "name=${UNIFI_USERNAME:?}" "email=${UNIFI_EMAIL:?}" "x_password=${UNIFI_PASSWORD:?}"
http https://unifi:8443/api/cmd/system cmd=set-installed