-
Notifications
You must be signed in to change notification settings - Fork 34
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
sed command for /etc/hosts #72
Comments
@hamhpc I like the thinking here. Tested the command locally: Output after running command:
End result: (updated /etc/hosts file) 127.0.0.1 localhost Does this look correct to you? @hamhpc |
actually it doesn't. The logic here is to find the match for the first line: 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 and replace it with the same line followed by a carriage return and the second line containing the isle host info. I think the tricky part here is that I think there needs to be a tab in the line and a copy paste might not copy properly. You can look at: https://github.com/hamhpc/ISLE-ks/blob/master/ks_ISLE.cfg for the version I'm using and appears to work when running it via kickstart. The only issue is that the first line looks like this for CentOS: 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 But I'm not sure it's the same convention for other OS's so that might need to be handled. |
Yea not sure either... basically this was to help automate the handling of
someone having to modify /etc/hosts. Instead of telling them to do it just
use sed in the scripts to do it. Find the localhost line you expect and add
it back in with another line after it with all your host entries you need.
Anyhow. I guess just close this.
…-Steve
*****************************************
Steven L. Young
Unix/HPC System Administrator
Hamilton College
*****************************************
On Wed, Jan 24, 2018 at 2:56 PM, Gavin Morris ***@***.***> wrote:
@hamhpc <https://github.com/hamhpc> @McFateM <https://github.com/mcfatem>
@br2490 <https://github.com/br2490> I've not heard back on how to advance
with this command. Wondering if still needed given in isle.localdomain we
use the extra_hosts: command to give the containers the appropriate DNS
resolution. @br2490 <https://github.com/br2490> Does this match your
experience during your community alpha?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEinlo6E-Z5iOzUBIA9ZIvWRwYyurXIWks5tN4rlgaJpZM4Q7V-0>
.
|
@g7morris, yes my experience in Alpha2. I'll add I've also had success using separately defined docker networks - I'm behind on my pre-alpha-alpha (Barnard was set for Feb, I jumped the gun) testing so hopefully by Monday I have something more meaningful to say. I think there are several ways to accomplish this and extra_hosts is probably the fastest. I'd still like to investigate separate docker networks, one internal (all containers sit on this), and one external (such that only outward facing containers go here, i.e.: isle-apache). @hamhpc in trying to keep with Docker practice we try to avoid editing the host file directly and let docker handle it. Gavin mentions extra_hosts which adds an unlimited number of entries into hosts, I'll mention hostname and domainname params too, but I fail to remember if compose respects them. knowing compose, it's like a 50/50. edit, specifying which alpha. |
Makes sense to me =). Sounds good overall. I think we should close this
since we're not editing /etc/hosts anymore. This made more sense back at
the beginning before things changed. Maybe this needs to be part of the
manual process? I'm behind as well with my testing as I need to update
https://github.com/hamhpc/ISLE-ks/blob/master/ks_ISLE.cfg with the latest
instructions for how to build using the Alpha2 build stuff. Thanks,
…-Steve
*****************************************
Steven L. Young
Unix/HPC System Administrator
Hamilton College
*****************************************
On Thu, Jan 25, 2018 at 1:12 PM, Benjamin Rosner ***@***.***> wrote:
@g7morris <https://github.com/g7morris>, yes my experience in alpha.
I'll add I've also had success using separately defined docker networks -
I'm behind on my pre-alpha-alpha testing so hopefully by Monday I have
something more meaningful to say.
I think there are several ways to accomplish this and extra_hosts is
probably the fastest. I'd still like to investigate separate docker
networks, one internal (*all* containers sit on this), and one external
(such that only outward facing containers go here, i.e.: isle-apache).
@hamhpc <https://github.com/hamhpc> in trying to keep with Docker
practice we try to avoid editing the host file directly and let docker
handle it. Gavin mentions extra_hosts which adds an unlimited number of
entries into hosts, I'll mention hostname and domainname params too, but I
fail to remember if compose respects them. knowing compose, it's like a
50/50.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEinlp7ED6VEpVU_ymvV9zuD4UhINgZAks5tOMP3gaJpZM4Q7V-0>
.
|
Closing ticket as requested. |
…/master Updates
Hi.. I worked out this sed command to update /etc/hosts in CentOS 7. It might be easier to have in the documentation to do this than to have to explain how to do it in an editor. Plus helpful when those want to do scripted installs if we can come up with methods that help facilitate that.
sed -i 's|127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4|127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\n127.0.0.1 islandora-docker.com fedora.islandora-docker.com apache.islandora-docker.com fedora apache|g' /etc/hosts
This is also a little different in that I'm adding a second 127.0.0.1 line after the localhost line to contain the ISLE names. This way they won't mess with their primary localhost entry for their OS.
So the end result is this:
[root@islandora-dev ISLE]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 islandora-docker.com fedora.islandora-docker.com apache.islandora-docker.com fedora apache
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@islandora-dev ISLE]#
The text was updated successfully, but these errors were encountered: