mirror of
https://github.com/amidaware/tacticalrmm.git
synced 2026-04-26 06:55:52 +03:00
[GH-ISSUE #779] Add localhost to /etc/hosts if not already present #2436
Labels
No labels
In Process
bug
bug
dev-triage
documentation
duplicate
enhancement
fixed
good first issue
help wanted
integration
invalid
pull-request
question
requires agent update
security
ui tweak
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tacticalrmm#2436
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @NiceGuyIT on GitHub (Nov 5, 2021).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/779
Originally assigned to: @wh1te909 on GitHub.
Is your feature request related to a problem? Please describe.
I ran into an edge case where celery was taking significantly longer than normal due to
localhostnot resolving locally.Describe the solution you'd like
I'd like for Tactical to be fast at all times and resolve
localhostwithout making a network request.Describe alternatives you've considered
This if more of a discussion about a strange edge case and possible documentation in case others run into the same problem. I've considered not opening this request and making note of it for future reference but that doesn't help the community.
Additional context
I installed Ubuntu 20.04 in an nspawn container with
debootstrapand then installed Tactical using the standard install. One asset was added. Everything was working as expected. Then I introduced Nebula and in the process changed the DNS to use a server in the cloud. This caused significant delays in the frontend but technically everything still worked.The troubleshooting process led to a celery being slow and timing celery shows about a 5 second delay. Compare the production timing with the dev timing.
Production
Dev
The output of
time /rmm/api/env/bin/celery -A tacticalrmm reportshowedredis://localhost/was used which clued me intolocalhost. This lead to the question: Where islocalhostresolved? A fresh Ubuntu install creates/etc/hostsand adds the various localhost flavors for name resolution.Fresh install of Ubuntu 20.04 in VM
Comparing a fresh Ubuntu 20.04 install with an
nspawninstall,/etc/hostsis missing from the nspawn install and present in the full install./etc/nsswitch.confis the same for host resolution:hosts: files dns. This leads us to DNS. Both systems have/etc/resolv.confsymlinked to/run/systemd/resolve/stub-resolv.confwhich is provided bysystemd-resolved.service. The change I made that broke celery was changing the symlink to/run/systemd/resolve/resolv.confand adding aDNS=1.1.1.1entry to/etc/systemd/resolved.conf, effectively removingsystemd-resolvedfrom the equation.The
systemd-resolveddocumentation states "systemd-resolved' will resolve synthetic records, one of which islocalhost. Iflocalhostis not in/etc/hostsand the DNS has not been changed,localhostwill still resolve locally without making any DNS requests over the network. However, iflocalhostis not in/etc/hostsand the DNS has been changed, there will be significant delays in the frontend of Tactical.Adding
localhostto/etc/hostsif it's not already present doesn't introduce any problems because the installer adds them. I suggest checking forlocalhostand if it's not already present, add it to/etc/hosts.@wh1te909 commented on GitHub (Nov 6, 2021):
sounds good, the install script already adds entries to
/etc/hostsso i'll also add localhost if not present@NiceGuyIT commented on GitHub (Dec 11, 2021):
For reference, here is
/etc/hostsafter a fresh install with hostnamevs-23-ubuntu. I don't know if IPv6 is necessary if the application is not IPv6 aware.Also
/etc/os-releasefor version info.@ninjamonkey198206 commented on GitHub (May 3, 2022):
If this still needs to be resolved, I could probably knock it out pretty quick. Should be the kind of grunt work I can currently handle while I'm learning the rest. Should just need the update and install scripts edited, unless I'm mistaken.
@ninjamonkey198206 commented on GitHub (Jun 3, 2022):
I'll add this in while I'm reworking the scripts. Planned to rework the host entries anyway.
@ninjamonkey198206 commented on GitHub (Jun 11, 2022):
@wh1te909 this has been added in the rework of the bash scripts I've been working on. Silver and Dinger are going to help test it all.