Bootstrap Unifi controller (#150)

This commit is contained in:
Joshua Spence
2021-06-30 10:22:20 +10:00
committed by GitHub
parent f2394ae07e
commit 54d59494c9
2 changed files with 9 additions and 16 deletions

8
.gitattributes vendored
View File

@@ -7,11 +7,3 @@
*.jar binary
*.wt binary
*.bson binary
testdata/unifi/data/db/journal/*.* binary
testdata/unifi/data/keystore binary
testdata/unifi/*.* eol=lf
WiredTiger eol=lf
WiredTiger.lock eol=lf
WiredTiger.turtle eol=lf

View File

@@ -26,13 +26,20 @@ case "$1" in
-p ${DOCKER_STUN_PORT}:3478/udp \
-p ${DOCKER_AIRCONTROL_PORT}:10001/udp \
-e TZ='America/New_York' \
-v $(pwd)/testdata/unifi:/unifi \
--name unifi \
jacobalberty/unifi:${2:-$default_tag}
echo "Waiting for login page..."
timeout 300 bash -c 'while [[ "$(curl --insecure -s -o /dev/null -w "%{http_code}" '"https://localhost:${DOCKER_HTTPS_PORT}/manage/account/login"')" != "200" ]]; do sleep 5; done'
timeout 300 bash -c 'while [[ "$(curl --insecure --location -s -o /dev/null -w "%{http_code}" '"https://localhost:${DOCKER_HTTPS_PORT}/manage/account/login"')" != "200" ]]; do sleep 5; done'
echo "Controller running."
echo "Bootstrapping controller..."
function unifi_curl() {
curl --data "${2}" --header 'Content-Type application/json' --insecure "https://localhost:${DOCKER_HTTPS_PORT}${1}"
}
unifi_curl /api/cmd/sitemgr '{"cmd":"add-default-admin","name":"tfacctest","email":"tfacctest@example.com","x_password":"tfacctest1234"}'
unifi_curl /api/set/setting/super_identity '{"name":"UniFi Network"}'
unifi_curl /api/cmd/system '{"cmd":"set-installed"}'
;;
"test")
TF_ACC=1 \
@@ -49,12 +56,6 @@ case "$1" in
"update")
docker pull jacobalberty/unifi:${2:-$default_tag}
;;
"reset")
git checkout - testdata/unifi/
for file in $( git ls-files --others --exclude-standard | grep testdata/unifi ) ; do
rm -f ${file}
done
;;
*)
echo "unrecognized command"
exit 1