Accessing vagrant dev environment - dns

We've just started using Vagrant for dev environments for individuals, but found a pain point with trying to show other people what you're working on. I.e. Hey Bob, check out dave.dev.example.com (Vagrant box) and try the login.
At the moment the Vagrant boxes are using bridged networking, so have an IP on the local network, but we're having to put hosts file entries in.
How have others worked around this problem? At the moment I'm thinking either push a record into a local BIND server or having devs commit to a branch and checkout on a test server.

Related

Making multiple Docker Machines accessible across local network. Linux & Mac

I know there are several questions similar to this, but as far as I can see there's not an answer for the setup that I can get to work, and as far as documentation goes I'm a bit lost.
My goal is to set up a linux development server on the local network which I can run multiple docker machines / containers on for each of our projects.
Ideally, I would create a docker-machine on the dev box, and then be able to access that from any of my local network machines. I can run docker on the linux box directly and access by publishing the ports, but I want to run multiple machines with different ip addresses so that we can have multiple VMs running (multiple projects).
I've looked at Docker Swarm and overlay networks and just not been able to find a single tutorial or set of instructions to get this sort of set up running.
So I have a dev box at 192.168.0.101 with docker-machine on. I want to create a new machine, run nginx on it, and then access nginx from another machine on the local network i..e http://192.168.99.1/ then set up another and access that too at say http://192.168.99.2/.
If anyone has managed to do this i'd be interested to know how.
One way I've been thinking about doing it, is running nginx on the local host on the dev box, and set up config rules to proxy to the local machines, unsure how well this would work (it works for web servers, but what if I want to ssh or bash into one of those machines, or if one has a mysql container I want to connect to)
Have you considered running your docker machines inside LXD containers?
Stepane Grabers site has a lot of relevant information
https://stgraber.org/category/lxd/
The way that I resolved this, is by using a NAT on the linux box, and then assigning a different ip to each machine. I followed the instructions here; http://blog.oddbit.com/2014/08/11/four-ways-to-connect-a-docker/ which finally got me to be able to share multiple docker machines using the same ports (80), on different ips.

How to change the host IP sent in emails to new GitLab users to a publicly visible IP, not the local GitLab IP?

I have set up a Bitnami GitLab stack as a running virtual machine instance using VMWare Workstation on my personal dedicated Windows server (host) running out of my home office. My dedicated Windows server host has a publicly visible static IP address.
I have successfully gained public access to the GitLab application running as guest by setting up port forwarding within VMWare Workstation's Virtual Network Editor (using NAT translation, not bridging). I am able to access the GitLab web interface from any internet-connected computer just by typing the static IP (including my chosen port).
I have also successfully set up two Git repositories in the running GitLab instance.
Sending email needs to be enabled, requiring a modification of a settings file, and this worked straightforwardly (here is a link that explains how to set up SMTP properly).
Before inviting new users, I wanted to test the functionality by inviting myself first (using a secondary email address).
When inviting a user, an invitation/confirmation email is sent to that user that provides a link to login to the GitLab instance. However, I find that the URL provided in the invitation email is the local network IP address (i.e., 192.168.44.129) rather than the publicly visible static IP address.
I do not see any settings in the GitLab web interface itself to change the host IP included with email invitations, so I assume I need to change a setting in a configuration file somewhere. But I have no idea if this should be a GitLab setting, an Nginx setting, a RoR setting, or some other setting; and what the setting / setting file is.
The best links I can find about this (here, here, and here) do not seem to lead me to sufficient clarity to take an efficient guess as to what to do.
How do I change the URL (host IP) that is provided in invitation emails to new users via GitLab from the local network IP address to a globally-visible (static) IP address?
Two hints pointed the way for me, and once I did resolve the issue (as I am about to describe), I found the details laid out in the deceptively named subsection of the Bitnami GitLab stack official documentation.
The first hint was to be found in a not-very-highly-upvoted answer here (in comparison with other answers and the accepted answer, some of which had many more upvotes). The setting for the host IP and port used in the GitLab account invitation emails is to be found in the gitlab.yml file (as of today, the full path of this file on the VM stack (and probably other) installations is /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml; see the host and port settings, as well as other overall useful settings). (I'm not experienced with the Rails universe, and using the .yml settings file is a touch, apparently, of the way Rails apps in general do things, if I understand correctly.)
The above step does succeed - but only until the server is restarted. Unfortunately, when the server is restarted, the host setting is overwritten with whatever is present in ifconfig as the IP address (the port entry remains the same as whatever you enter).
The second hint was how to resolve this problem; I found it here. There is a special script in the init.d folder whose specific purpose is just to reset the host parameter in this (and perhaps other?) .yml settings files. (What a wonderful "convenience" in my scenario.) Simply commenting out the single line exec /opt/bitnami/apps/gitlab/bnconfig --machine_hostname ... in this file (by adding a # at the front of the line) resolved the problem.
Once both of the above changes were made, the problem was resolved. GitLab invitation emails successfully include the desired static IP address (and port) of the server, even through server restarts.
As I mentioned above, once I resolved the problem, I then found that the answer to this question was already laid out in the official Bitnami GitLab documentation (note: both hint #1 and hint #2, from above, are tucked away in this same subsection of the documentation - one after the other - they're not prominent; they don't stand out very well; they come across as secondary details upon first reading, I think; the formatting does not draw attention to the file name and path, which would be helpful, I think; and the subsection name in which they are present does not particularly make it clear that this would be the correct subsection to look at, except in retrospect, in my opinion).
ADDENDUM: For anyone who finds it useful, there's an added detail required to get email working from your own personal server with GitLab - I made only a brief passing mention of this in the question, because I had already done it.
But for completeness for future visitors, I should mention that you need to set up SMTP properly on your GitLab instance by making a modification to a file named production.rb (the full path as of today is /opt/bitnami/apps/gitlab/htdocs/config/environments/production.rb). Specifically, as is also to be found in the official Bitnami GitLab documentation, you must add a config.action_mailer.smtp_settings {...} block and add/uncomment a few other settings in order to be able to send emails from your running GitLab instance.

How to clone a Git repo from a VM?

I am currently developing inside a virtual Ubuntu box with Git, and I need to clone this repo to another CentOS VM. I don't know how to describe the git repo's location using the user#server:/path.git syntax.
Anyone can point me to the right direction? Thanks!
Can you ping one VM from the other? If so, then the IP you can ping you should be able to ssh to.
If you cannot ping, then perhaps you have a host which is reachable from both VMs. You could create a server repo there. For instance, github.com or bitbucket.com or the many many others might be a suitable third party host. Perhaps you could install a proxy (squid or dante-socks or something similar) to allow the VMs to talk to each other.
If you have email connectivity, perhaps you could mail git-bundles back and forth instead of using normal live git connections. There are many ways to do this, but we really need to know more about the networking and communications environment of these Vms to say more.

Using GIT to clone from a windows machine to a linux webserver (in house)

OK, I am looking for a way to use GIT to keep a web site up to date between my local machine (git repository) and my web site (git clone of repository).
I have initialized the repository (on windows 7 machine) and added all the files to the repo on my local machine. I now need to get the repo to the webswerver (a linux-based machine). I can access the webserver via putty and ssh. How do I go about cloning the repo into the appropriate directory to serve the web site?
I have tried the following from my linux based machine: git clone git+ssh://myuser#10.1.0.135/d/webserver/htdocs/repo
I keep receiving a connect to host 10.1.0.35 port 22: connection time out
Both machines are in house with the webserver being outside of the network on a different IP range (outside of firewall). I came from subversion and can easily svn commit/update to and from the webserver and my machine without issue.
Thanks for any guidance on this!
The best resource I've found for doing this is located here.
The problem I had was that issuing a git clone from the *nix environment using the above suggestions was unable to find the path to the repo properly.
I was able to fix this by starting the git daemon with the --base-path and --export-all params.
So, from the windows box:
git daemon --base-path=C:/source/ --export-all
Then from the *nix box (mac in my case):
git clone git://<local ip>/<project name>
My directory structure on the windows box is:
c:\source\<project name> - this is where the .git folder lives
Here is a walkthrough someone else did. It goes step by step showing how to do what you want.
The IP address 10.1.0.135 is reserved for private networks, which means that it only refers to your local Windows computer when used within your home network. If you're running the git clone command with that address on your server, 10.1.0.135 refers to a completely different computer, which explains why the connection isn't working.
Here's my suggestion: instead of trying to clone the repository on your home computer, first create an empty repository on the server
server$ git init /path/to/repository
and then push changes from your computer to the server's repository
home$ git remote add website ssh://myuser#server/path/to/repository
home$ git push website
You can call the remote something other than "website" if you want.
For slightly more advanced usage, I've written a blog post explaining how to set up staging and production servers and maintain them with git. If you don't want to deal with a staging server, though, I also link to a couple of tutorials about a simple two-repository setup to manage a website with git, which is basically what it sounds like you're looking for.
Sounds like your windows 7 machine (in particular, port 22) may not be accessible from outside of the firewall. With subversion, the webserver is likely accessible to both machines. Also, the IP for your Windows machine is a non-routable IP, which means your firewall is likely also NAT'ing your internal network.
You could approach this by opening port 22 in the firewall, or setting up port-forwarding in the firewall to point to your Windows machine. But you should probably create the git repo on the server, then clone from that to your Windows machine instead. You could use scp -r to get that initial repo on the server, though someone with more git experience may be able to tell you a better way.
Good idea to do this with Git, if you need to check it into a version control system anyhow.
Just wanted to mention you could also look at the rsync utility - e.g. google "Rsync Windows" brings up some nice results.
Rsync is specifically made for keeping directory trees in-sync across machines. And it does it smart, not transfering files which are already on the other side, and you can use compression.. it has tons of features,
and is typically used in UNIX production environments. There are ways to run it also on Windows.
In any case:
Check your firewall settings on both machines - the relevant ports need to be open. In your case port 22 is probably blocked

Wrong DNS for just one site on development machine

www.superyoink.de is my clients' website. I can access it from any machine except my development one.
If I ping it on my development machine, I get 80.67.28.107 - this is wrong.
My laptop, next to me, is able to resolve it correctly.
I have tried putting correct address into hosts like so:
93.187.232.191 www.superyoink.de
Still resolves to wrong address.
Rebooted, did ipconfig /flushdns nothing seems to work.
Can anyone suggest a way to fix this?
A few things you could try:
Double check your hosts file to make sure you don't have more than one entry for www.superyoink.de. You may wish to include the content of your hosts file with your question.
Compare the hosts file of your development machine and the laptop. Assuming that the contents should be similar -- are there any significant differences with respect to www.superyoink.de?
Compare the network configuration of your development machine and the laptop. Are both machines using the same DNS servers or different DNS servers?
Have you checked the DNS servers match a "working" machine?

Resources