How can I change configuration for an existing vagrant box? - configuration

I have two installed vargrant boxes up and running. I want to change their configuration settings. Where can I do that? Specifically, I want to give each vagrant box some additional settings.
config.vm.network :private_network, ip: "10.0.0.10"
config.vm.hostname = "alpha"
The above code is from this following question:
Allow two or more vagrant VMs to communicate on their own network
That code is normally put in the Vagrantfile. I want to make changes to an existing vagrant virtual machine. If I modify that machine's Vagrantfile, are the changes applied automatically, or do I need to do some other steps?
I just want to change the network and hostname settings on both virtual machines. I do not want to reinstall these virtual machines from scratch again. I do not want to have to redownload the base image for both virtual machines again.

I modified the Vagrantfiles for both existing Vagrant boxes. Then I ran the command
vagrant up
Apparently, if a Vagrantfile has been changed since the last time a vagrant virtual machine was started, this command goes ahead and modifies the settings for that vagrant virtual machine. In my case, it added the networking settings successfully.

Related

How to install MySQL 5.7 on Amazon ec2

How am I able to install MySQL 5.7 in the cloud on Amazon EC2?
Most of the Amazon Machine Instances (AMIs) that I see either lack any MySQL server or possess an older version such as MySQL Server 5.5
I want to use the latest and greatest.
This is a relatively quick setup of MySQL 5.7.14 on Red Hat Enterprise Linux version 7 (RHEL7).
I am not affiliated with AWS; I just enjoy using their services.
Make sure you have an AWS EC2 account. Note that even though Amazon requires a creditcard on file, there will be no charges incurred for the first year if you adhere to their Free-tier terms. Typically this means a single micro-instance (1 Gb RAM) server running 24/7.
Launch of EC2 RHEL instance
Step 1: On AWS EC2 click "Launch Instance" and select "Red Hat Enterprise Linux 7.2 (HVM), SSD Volume Type - ami-775e4f16" as seen in the picture below. Note that the versions of the available or promoted AMIs (Amazon Machine Instance) will rotate over time and this is as of this writing. But the AMI number is shown above in the text.
Normally, I chose Amazon Linux AMI as my distro of choice. I don't do that anymore as it is their own hodge-podge and there is naturally uncertainty of which package manager to choose and therefore the files. So I stick with RHEL now.
On the "Choose an Instance Type" screen, select a free-tier eligible instance type as seen below:
Click Next. On the next Details screen click "Next" to accept defaults. On the storage screen change the size to 16GB and click "Next". Then "Next" again on Tag info. Next comes the "Configure Security Group" screen pictured below:
Accept the radio button of "🔘 create a new security group" for now. Note SSH port 22 is open to all (Anywhere) IP addresses with the 0.0.0.0/0 CIDR. Other options include detection of "My IP" (as in yours), or "Custom". Rest assured that with the next screen access will be locked down based on Security Keys we will setup. There is a button for Add Rule under the ports open to add such ports as MySQL 3306 or HTTP 80. But for now we will skip that. Note the security group name. Fill one in or accept the default for now. It is not critical to get this right as the security group can be changed later for a running Instance. Click Review and Launch.
Then click "Launch" (fear not, it is not going to Launch yet). As the next screen presents:
Note that as I already have some keypairs generated, it defaults to "Choose an existing keypair" in the first drop-down. Otherwise, you "Create a new key pair" with a given reminder name and proceed to "Download Key Pair". At this point you have the Key Pair as a .pem file. Treat that with the utmost of security, saving it to a place that you will not lose it. Preferably in a password protected area such as under your operating system User directory.
When you finally click "Launch Instances" on this same screen, the launch takes place in relation to that key pair (either just created or a pre-existing one). Note, the generation of a key pair might be a task you perform just once a year. Re-using a key pair again and again, up to you.
After you launch the instance, you have roughly five minutes before it comes live. Under the Instances left menu item, you know the instance is live when the Instance State reads "running" and the Status Checks reads "2/2 passed":
Remember the .pem file that you downloaded? Well just one time you need to create a .ppk file out of that for PuTTY, an SSH client program that will communicate cryto-secured to your running instance. For that we use the puttygen tool that works in harmony with PuTTY. So we run puttygen, load the .pem downloaded minutes before, and generate the .ppk file with a "Key passphrase" such as "I & love%ancHovies2_fjdi8Ha". Below is a picture of puttygen:
And the AWS EC2 page entitled Connecting to Your Linux Instance from Windows Using PuTTY. The steps are File / Load private key. Change the filter to All files (.). Find the .pem file. Hit "Open", then "Ok". Type in a Passphrase. Click "save private key", and save it in the same folder as a .ppk file alongside your .pem file. As mentioned, this is not something you might do but yearly.
Now run PuTTY, the SSH client. Use the Session / Host Name as something like
ec2-user#ec2-www-xxx-yyy-zzz.us-west-2.compute.amazonaws.com
So it is basically ec2-user# concatenated with the Public DNS name that is seen under Instances on the EC2 Control panel. As for specifying the PuTTY .ppk file, it would look like the below, with the .ppk file chosen next to the Browse button:
Go back to the Session upper left hierarchy shown below, give this a profile name under Saved Sessions, and hit "Save". Hereafter when you load PuTTY, you merely load the session by name:
Don't forget that just about all you are doing here is saving the .ppk reference into a friendly named profile. And you may ocassionally need to change Host Name (certainly when you save an Instance image on EC2 and come back in with a new Instance IP address on a subsequent launch).
Ok, it is not easy. But it is what it is.
When you click Open it will attempt to connect to your RHEL instance. Hit Yes on the signature warning. Enter the prior saved .ppk Key Passphrase, and you should be sitting at a Linux prompt.
MySQL Installation (I will put these notes on GitHub)
URL01: Download MySQL Yum Repository
URL02: Chapter 1 Installing MySQL on Linux Using the MySQL Yum Repository
You now have MySQL 5.7.14 loaded and running on EC2 with a database and user setup. Your servers need to be imaged. See this answer here of mine for creating images (AMI's). Backup your data. See the EC2 documentation such as Best Practices for Amazon EC2.
Back to security: best practices certainly suggest not opening up your db to direct connects through Security Groups for port 3306. How you choose to adhere to that is your choice, such as with a PHP, Java, or other programming API. Note that various db client programs can connect through SSH tunnels such as MySQL Workbench. In addition various development libraries exist with SSH Tunnels but they are not terribly easy to develop against (mainly due to difficult key chains and lack of extensive developer experiences). For instance, there is one for C# here.
In addition AWS has RDS and other database offering for less hands-on and rolling your own like the above. The reason many developers target EC2 is due to the fact that you have a full blown server for your other programming initiatives.
If you do modify the Security Groups as mentioned before, please consider using IP Ranges based on CIDR entries and use caution before over-exposing your datastores. Or over granting. Much the same best practices as you would for on-premise work.
Concerning this MySQL section, my GitHub notes for the above few pictures are located Here.
I had the same issue, but i didn’t want to use Red Hat or any other OS than Amazon Linux AMI. So, here is the process to install MySQL 5.7 and upgrade an older version.
Short path (without screenshots)
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
yum localinstall mysql57-community-release-el6-11.noarch.rpm
yum remove mysql55 mysql55-common mysql55-libs mysql55-server
yum install mysql-community-server
service mysqld restart
mysql_upgrade -p
Long path (with screenshots)
First of all, just to validate you can check the current version.
Then, you should download the repo for EL6 11
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
Next, make a localinstall:
yum localinstall mysql57-community-release-el6-11.noarch.rpm
This is probably the key for a successful installation. You should remove the previous packages, regarding to MySQL 5.5
yum remove mysql55 mysql55-common mysql55-libs mysql55-server
Finally, you can install MySQL 5.7
yum install mysql-community-server
Restart the MySQL Server and upgrade your database
service mysqld restart
mysql_upgrade -p
You can validate you installation by authenticating to MySQL
sudo yum install mysql57-server

Genymotion Virtualbox configuration

I have downloaded Genymotion and installed it with Oracle Virtualbox 5.0.10 on Windows 10/64bit.
I keep getting the errors:
Virtualization engine not found.
Cannot rename this connection. A connection with the name you specified already exists. Specify a different name.
I've tried uninstall/reinstall, deleted unused network adapters in device manager. I'm at loss.
Thank you all in advance for any help/idea.
You must go the VirtualMachine preferences under File in the menu. Then choose the Network setting, then Host-only Networks.
You can use the - button to delete all of the Ethernet Adapters that you have there.
Then create a new one and use the following settings:
IPv4 Address : 192.168.1.201
IPv4 network mask : 255.255.255.0
Then in the DHCP server tab:
Address: 192.168.1.100
mask: 255.255.255.0
Lower address: 192.168.1.101
Upper address : 192.168.1.199
Check to see which Ethernet adapter # you have now set up - this might be important later on.
Click OK for all the open boxes or save whatever you have.
Then try and run genyMotion again.
This worked for me.
There is one more thing you may have to do if this still doesnt work.
Go to Network and sharing centre . Change adapter settings and disable all the Ethernet connections EXCEPT for the Ethernet adapter you have just created.
I hope that helps
Daniel
For Ubuntu
Almost every GNU/Linux system comes with an installer package for Oracle VM VirtualBox.
Browse for the Oracle VM VirtualBox installer in your directories.
If you do not have the installer or if you need to install a specific version, download and install VirtualBox for Linux hosts from the Download VirtualBox page.
When installing VirtualBox, in the Custom setup window, make sure VirtualBox Networking is enabled.
Go to the Genymotion download page and download the Linux package corresponding to your system.
Run the following commands:
chmod +x <Genymotion installer path>/genymotion-<version>_<arch>.bin
cd <Genymotion installer path>
./genymotion-<version>_<arch>.bin -d <Genymotion installer path>
Run Genymotion using the following command:
cd <Genymotion installer path>
./genymotion

Accessing Virtual Hosts from a VM (Running on the Same Box)

I am running Apache with several virtual hosts on my Mac. I think the virtual hosts have properly been configured; thus, I can access the following from the web browser:
host1.mydomain
host2.mydomain
host3.mydomain
I can also access localhost with no problem.
However, I can't access those hosts from a virtual machine (I use Parallels Desktop, running on the same box). Do I need to configure something on my virtual machine? Maybe the hosts file, etc.?
Is it also possible to hit those hosts from the virtual machine, even I am not connected to the Internet?
Thanks.
It turns out this can be solved by simply updating the hosts file in the VM.
Assuming the Mac's IP is a.b.c.d and you want to access host1.mydomain, you'd need to add this line to the hosts file (in the VM):
a.b.c.d host1.mydomain
So, when you type in host1.mydomain on the VM browser, it will get resolved to the host running on the Mac.

Hudson cmd.exe running as

Where does hudson CI get user to run the cmd.exe ?
I'm trying to start and stop some remote services on various slaves and special credentials that are different than what hudson is using are needed. I can't find a place to override the user. I've tried running the server as various users, but it doesn't change anything.
Any other ideas?
Since you want to start and stop the services on the remote machine you need to login with these credentials on the remote machine, since I haven't found a way to start and stop a service on remote machine.
There are different ways to do that. You can create a slave that runs on the remote machines with the correct credentials. You can even create more than one slave for the same machine without any issues, than you can use different credentials for the same machine. These can then fire up the net stop and net start command.
You can also use the SSH plugin. This allows you to configure pre- and post-build ssh scripts. You 'just' need and ssh server on the windows machine. The password for the connection will be stored encrypted.
Use a commad line tool. So far I haven't found a Windows on board tool to have a scripted login to the remote machine. I would use plink for that task. plink is the scripted version of putty. Putty supports different connection types. So you can also use the build in telnet service (not recommended since telnet does not encrypt the connection). Disadvantage is that you will have the password unencrypted in the job configuration.
We had a similar problem, and I resorted to using PsExec. To my advantage, our machines exist on a separate LAN, within 2 firewalls, so I was OK with unencrypted passwords floating around. I had also explored SSH w/ Putty, which seemed to work, but not straightforward.
If someone can help with single line runas command, that could work too.
You don't say how your slaves are connected to Hudson, but I'll assume it's through the "hudson slave" service, since that's probably the most popular way to connect Windows slaves.
If so, the CMD.EXE is run with the same permissions as the user running the service. This can be checked by:
1. run services.msc
2. double-click hudson-slave service
3. go to Log On tab
By default, the slave service runs as "LocalSystem", which is the most powerful account on the system. It should be able to do whatever you need it to do. (i.e. start/stop services)

Change port for TeamCity web server

I installed TeamCity and got it working against my project. However, I have since realized that I don't want it the administration page to be configured on port 80. I'm going to have other websites on that server that I want on the default port. How do I change the configured port?
I wandered around the configurations a bit and looked through the administration settings but couldn't figure it out.
The port number can be edited in the <TeamCity home>/conf/server.xml file, line <Connector port="8111" protocol="HTTP/1.1".
from Installing and Configuring the TeamCity server
To add to the answer provided by #sfussenegger you will also need to make sure that your build agents can still connect to the TeamCity server instance on the new port, or else your builds won't run.
To do this, you'll need to change the build agent configuration files to reflect the new serverUrl value. You can find this setting in the C:\TeamCity\buildAgent\conf\buildAgent.properties file.