I have a database in a VMWare Server 2.0 Virtual machine. I also have a web application in the IIS (7) in the VM.
Now I want to execute some database scripts that are in the VM, from the Host machine.
Also I have a VB script in the VM that I want to run from the Host machine.
How do I go about setting this up. I can buy Final builder if that will help me.
Since I am looking to automate the above from the Host machine, I was wondering what I would have to do to execute the database and the VB scripts that are in the VM, but execute them from the Host machine, so that these update the database and IIS (vb script thing) in the VM.
Thanks.
The easiest approach is to configure the VM with a network connection that is reachable from the host machine, and run the scripts across the network connection the same as you would if you had a physical machine instead of a virtual machine. If your goal is to keep the VM isolated from your existing network and servers, then you need merely configure a private network between the host and the guest, and use that. With this approach, you don't need any extra software.
I'd suggest to attach a host share as a network drive and then use vmrun. Here is an example:
vmrun -T server -h https://hostname:8333/sdk -u root -p mypassword -gu administrator -gp guestpaswd
runProgramInGuest "[Vol1] win2008-1/win2008-1.vmx" -activeWindow "c:\windows\system32\cmd.exe"
Surely, the VmWare Tools are to be installed.
Related
I'm currently testing a few websites on Ubuntu Server installed on Oracle VM Virtual Box on a Windows 11 machine.
I need to type an IP address to access these sites (eg: 192.168.xxx.xxx).
Is it possible to use something like a domain name to access them instead of using an IP address? Like mysite1.com, mysite2.com etc.
I'm not using domain names booked on godaddy or some place like that. Just names for local testing. How can it be done in this scenario? Everything is installed on the same machine.
Add your sites to /etc/hosts file like this:
192.168.... mysite.domain
Yes, you can go to /etc/hosts and apply IP you are using and the domain name you want:
Example.
Open with:
sudo nano /etc/hosts
apply:
192.168.x.x mysite.com
And restart server.
TRY CLEAN CACHE
sudo apt-get install nscd
AND NOW
sudo service nscd restart
or
sudo service dns-clean
To restate your setup, you have one Ubuntu server guest VM (in VirtualBox) running on Windows 11. Because you mentioned the 192.168.x.x IP range I will assume the guest VM is on a "bridged" vbox network adapter that any device on your local network can ping. I also have to assume the IP address(es) you are using are successfully connecting you from your Windows 11 host to your Ubuntu guest. Is all this correct? Does your VM have a desktop and a web application that can reach popular sites on the internet? Does the Ubuntu OS use DHCP or a static IP assignment?
The short answer is yes, you can use domain names instead of IP addresses. If you are not successful connecting to the IP address, switching to domain names will not help you. You have to have all the network dependencies satisfied first.
To choose a domain name for testing;
You should take a look at RFC 6761. Specifically at secion 6; 6.1 - 6.5
https://www.rfc-editor.org/rfc/rfc6761.html
.in-addr.arpa.
10.in-addr.arpa. 21.172.in-addr.arpa. 26.172.in-addr.arpa.
16.172.in-addr.arpa. 22.172.in-addr.arpa. 27.172.in-addr.arpa.
17.172.in-addr.arpa. 30.172.in-addr.arpa. 28.172.in-addr.arpa.
18.172.in-addr.arpa. 23.172.in-addr.arpa. 29.172.in-addr.arpa.
19.172.in-addr.arpa. 24.172.in-addr.arpa. 31.172.in-addr.arpa.
20.172.in-addr.arpa. 25.172.in-addr.arpa. 168.192.in-addr.arpa.
.test.
.localhost.
.invalid.
.example.com.
.example.net.
.example.org.
You may have to create/modify the \windows\system32\drivers\etc\hosts file that Windows uses to intercept asking DNS for IP/host mapping. If you are using a linux/unix client, the /etc/nsswitch.conf AND /etc/hosts files could override DNS for you. This may or may not be in the same location on Windows 11 but as of Windows 10 21H2 it was still there.
Original Post
I have a Windows workstation with WSL2 and Docker installed that I am able to use for container based development in VS Code. I would like to be able to develop inside the containers on this system remotely. I am able to SSH directly into the WSL2 environment on the workstation and am able to start the docker daemon without logging directly into Windows by creating a Task to start the daemon automatically as described here: https://stackoverflow.com/a/59467740/10692741
However when I try to access Docker on the remote machine by following this guide: https://code.visualstudio.com/docs/remote/containers-advanced#_developing-inside-a-container-on-a-remote-docker-host, I get the following error:
error during connect: Get http://docker/v1.24/version: net/http: HTTP/1.x transport connection broken: malformed HTTP status code "\x00c\x00o\x00m\x00m\x00a\x00n\x00d\x00"
I have also tried connecting via a SSH tunnel as outlined here: https://code.visualstudio.com/docs/remote/troubleshooting#_using-an-ssh-tunnel-to-connect-to-a-remote-docker-host and am unable to connect to Docker as well.
Has anyone had success with a setup like this? Or is this not supported due to limitations with Docker on Windows, WSL2, and/or Windows OpenSSH implementation?
Update: 2021-01-21
When I SSH into the Windows machine remotely, I am able to see the docker containers in the VS Code extension. I am able to start them, stop them, and enter into them with the shell. However, when I try to attach VS Code I get same error shown above.
Things that may have possibly affected this over the past couple days:
Adding SSH keys on my local machine to the ssh-agent via ssh-add /my/key
Exposing Docker daemon on tcp://localhost:2375 without TLS on the remote Windows machine
Also I want to note that the I've tried using Windows, Mac, and Linux as the local machine. With Mac and Linux I am able to open a remote session into the Windows machine, but from the Windows local machine I am able to SSH into the remote Windows machine but cannot open a remote connection in VS Code for some reason.
Ok, I was able to get this working using the port/socket forwarding technique. For sake of clarity, I'll use:
local development workstation, local workstation, or just workstation to indicate the computer from which we wish to use VSCode to access Docker containers on ...
the remote Docker host, remote, or just Docker host
Sanity check -- Do you have Docker Desktop installed on both systems? On the local development workstation, you can skip the WSL2 integration, but you'll at least need the client tools, since the VSCode extension uses them.
Steps I took:
I already had Docker with WSL2 integration set up on my main system (which for the purposes of this exercise, became my remote Docker host), along with VSCode, so I knew everything was working there. It sounds like that was your starting point as well.
On another system on the same network (accessed with RDP to make it simple), I already had VSCode installed as well, with the Remote Development Extension Pack. I also have WSL on that system, but only a v1 instance there. Not that WSL on the workstation should be a factor at all for the purposes of this exercise.
I installed Docker Desktop for Windows on that local development workstation.
I also installed the Docker extension for VSCode, since I didn't yet have it on the local development workstation.
On the workstation, I was not yet set up to SSH from PowerShell into my WSL Ubuntu distro on the remote. From PowerShell on the workstation, I generated an ECDSA key (per this and other documents) and added the public key to my authorized_keys on the the remote.
On the workstation, I started the OpenSSH Authentication Service and added the newly created key to the agent (in PowerShell) with ssh-agent add ~\.ssh\id_ecdsa.
I logged out of the workstation and back in so that the path changes were picked up for the Docker desktop install.
I was then able to ssh from Powershell on the local to Ubuntu/WSL on the remote with the port forwarding. Since I'm using the Windows 10 OpenSSH server as a jumphost to my WSL SSH servers, my command looked slightly different (with a -o "ProxyCommand ... mainly), but overall the structure is the same as the one listed in the "SSH Tunnel" doc you linked in your question.
On the remote (manually, not through any integration from the local), I did a basic docker run -it --rm Ubuntu and left it open.
On the local, from PowerShell, I set the DOCKER_HOST environment variable via [System.Environment]::SetEnvironmentVariable("DOCKER_HOST","tcp://localhost:23750").
I was then able to see the remote container using docker ps on the local. I could also docker exec -it containername bash into it remotely.
Of course, the above two steps aren't needed in the long term for VSCode, they were just part of my process to make sure everything was up and running (since, as you might expect, I did have several points at which I failed during this process).
So with that working, it was a simple matter in VSCode to change the Docker extension's DOCKER_HOST setting to tcp://localhost:23750. And voila, I could see all images on the remote as well as attach to them from VSCode.
Other thing(s) to check
I'll add to this list if we find additional reasons why it might not be working, but for now:
You mention that you are starting the Docker Desktop daemon automatically at startup via Task Manager, but you don't mention anything about the WSL2 instance. However, since you are able to ssh into it, I assume you have a way to bring it up as well? My experience has been that, unless the owning user is logged in, WSL terminates any instances after a few seconds, even if a service is running. There's a workaround, I believe, that I can dust off if this is a problem.
I always SSH into my virtual machine and don't use VMWare's virtual machine window/terminal after I am done setting up the VM. I find it annoying to always have the VMWare Fusion application open as well as the VM window, thus, I want to be able to silently start the VM from my terminal and do all other actions only through terminal.
I saw this page on the VMWare website that talks of starting a VM with the command:
/Applications/VMware\ Fusion.app/Contents/Library/vmrun start full/path/of/your/virtual/machine/bundle
That is a step in the right direction as I don't need to click anything to start my VM, however, it still opens the application and VM in windows.
When I used Virtual Box, I remember being able to do this with a command like:
VBoxManage startvm "VM name" --type headless
Is there a similar command that for VMWare that would allow me to run my VM headless?
You can try :
vmrun start full/path/of/your/virtual/machine/bundle nogui
I have windows 7_x64 Virtual Machine on Server machine running on Windows Server 2008 R2. I want to run this VM from jenkins (CI tool which executes batch file, running on same server).
I am using vmrun utility to do so.
When i run
vmrun -T ws -gu *** -gp *** start "vmx file path.vmx"
this executes fine on server command prompt (locally). but when i try to exceute the same from any of the client machine (by visiting jenkins site) I get
Error: There was an error in communication
After some troubleshooting, I can say vmrun command is not responding whenever it is evoked remotely. but it is confusing me, because I have jenkins which is running those commands is installed on same server. i am just running job from thin client. how does that make any difference?
Could anyone help me troubleshooting this issue?
Thanks!
For reference:
*Server machine(host): Windows Server 2008 R2
*Virtual machine(guest): Windows 7 x64
*Jenkins : Installed on same server (host)
*client : remote windows machine, accesses the jenkins instance from browser and triggers the job
*problem/error : vmrun commands dont execute.
Jenkins does not execute anything on "client" (i.e. the machine with the browser from which you accessed Jenkins instance). Jenkins will only execute anything on Master (what you called "server machine") or Slave nodes.
Now, there can be several differences between running the command from your local command prompt (on server) and through Jenkins. The primary difference is that Jenkins runs under a separate session, usually under a separate user, which may have different permissions, however that depends on how you have installed and configured the Jenkins session.
To identify if there are any Environment variable differences, type set on your local command prompt, and then execute Jenkins with just set in the build step. Compare the two. Other than Jenkins specific variables, everything else should be same.
Also, verify that your Jenkins user (the one running the service) has permissions to do whatever your are doing.
I installed the Rundeck server in one Linux machine.
Tomcat is running in a Windows 7 machine.
Now, I want to stop and start the Tomcat service in the Windows machine by creating a job in Rundeck (on the Linux machine).
Is it possible?
Yes, this is possible.
Install Cygwin, including openssh-server to the Windows machine. Generate a public key for the Rundeck server user and add it to the .authorized_hosts file on the Windows machine. Ensure you have port 22 or an alternate port accessible for SSH.
In rundeck, create a new job which fires the Tomcat executable or any commands you prefer for starting/stopping the service.
It may help to prefix the Rundeck job command with some $PATH variables if the connecting user account has trouble locating executables in the Windows/Cygwin environment.