Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for mongodb reachability during init #23

Merged
merged 3 commits into from
Oct 16, 2023

Conversation

drizuid
Copy link
Member

@drizuid drizuid commented Oct 16, 2023

linuxserver.io


  • [ X] I have read the contributing guideline and understand that I have made the correct modifications

Description:

rather than blindly supporting people who have mongo and unifi in different bridges, check for reachability during init and flag in the container logs. exiting at this point will also avoid mucking up mongodb or settings

Benefits of this PR and context:

ease our support burden and help users self-identify issues (lol at unraid users actually reading logs though)

How Has This Been Tested?

it hasn't been tested aside from in bash, yolo.

root@9e424684da5a:/usr/lib/unifi# MONGO_HOST=purple
root@9e424684da5a:/usr/lib/unifi# if [[ -z  "${MONGO_HOST}" ]]; then echo not set; elif ! nc -w1 "${MONGO_HOST}" ${MONGO_PORT}; then echo $? -- not reached; else echo works; fi
nc: getaddrinfo for host "purple" port 27017: Name or service not known
0 -- not reached
root@9e424684da5a:/usr/lib/unifi# MONGO_HOST=mongodb
root@9e424684da5a:/usr/lib/unifi# MONGO_PORT=27018
root@9e424684da5a:/usr/lib/unifi# if [[ -z  "${MONGO_HOST}" ]]; then echo not set; elif ! nc -w1 "${MONGO_HOST}" ${MONGO_PORT}; then echo $? -- not reached; else echo works; fi
0 -- not reached
root@9e424684da5a:/usr/lib/unifi# MONGO_PORT=27017
root@9e424684da5a:/usr/lib/unifi# if [[ -z  "${MONGO_HOST}" ]]; then echo not set; elif ! nc -w1 "${MONGO_HOST}" ${MONGO_PORT}; then echo $? -- not reached; else echo works; fi
works
root@9e424684da5a:/usr/lib/unifi# unset MONGO_HOST
root@9e424684da5a:/usr/lib/unifi# if [[ -z  "${MONGO_HOST}" ]]; then echo not set; elif ! nc -w1 "${MONGO_HOST}" ${MONGO_PORT}; then echo $? -- not reached; else echo works; fi
not set

Source / References:

what prompted the thought is https://discord.com/channels/354974912613449730/1163422841161650227

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-unifi-network-application:7.5.176-pkg-22c0bf17-dev-b5696dc13f6b17d8a38f5acce86d2e957bf63ccf-pr-23

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-unifi-network-application:7.5.176-pkg-22c0bf17-dev-8f96e5dd7b5f7c08d62b50445a99ea5658122f58-pr-23

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-unifi-network-application:7.5.176-pkg-22c0bf17-dev-c15cb33cea2c24fab8b8a74fc013cc2bce77b20f-pr-23

@drizuid drizuid merged commit ec5536d into main Oct 16, 2023
5 checks passed
@drizuid drizuid deleted the check-for-mongo-reachability branch October 16, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants