Most of the DevOps tools are still in beta versions, many times the new version is not compatible with your existing scripts or have an error that stops your scripts working. To be able to keep multiple versions of the applications and easily switch between them, create symbolic links and point to the version you want to execute.
Create version-specific locations
Create a folder for your optional applications.
mkdir /opt
Set you as the owner of the “opt” directory and its children.
YOUR_GROUP should be on:
MacOS: wheel
Ubuntu: your username
sudo chown -R YOUR_USER_NAME:YOUR_GROUP /opt
Set the security of the folder.
sudo chmod 755 /opt
We will create a directory structure to place each version of the application into its own folder. This example uses Packer.
Create a symbolic link to point to the application in the appropriate version folder. These are the examples for Packer, Terraform, and Vagrant. Notice, that the Vagrant application is in the “bin” directory, so the symbolic link has to point there.
If there is an existing symbolic link that points to the latest version of the application, rename it to be able to quickly return to the prior version of the application. This can come handy when we need to destroy instances created with the prior version of Terraform.
cd /opt/terraform
mv terraform terraform_v_0.9.11
cd /opt/packer
mv packer packer_v_1.0.4
Create a new symbolic link that points to the latest version of the application.
# For Packer
cd /opt/packer
ln -s /opt/packer/packer_1.2.0/packer packer
# For Terraform
cd /opt/terraform
ln -s /opt/terraform/terraform_0.10.0/terraform terraform
# For Vagrant
cd /opt/vagrant
ln -s /opt/vagrant/vagrant_1.9.5/bin/vagrant vagrant #The vagrant application is in the bin folder
Add the main application folder to the path in the config file of your terminal
Starting with Terraform version 0.7.3 you can only define a variable once within a directory or a module. Before that release you could copy variable definition files from other modules and did not throw an error if you had the same variable defined in multiple files within the module.
In the new version of Terraform if you define the same variable name multiple times within the module you will get the following error message,
Variable '...': duplicate found. Variable names must be unique.
Make sure a variable is only defined once in the module or directory.
I am not sure who uses the Caps Lock button anymore. It was important in the age of typewriters to be able to type all uppercase titles without holding the shift key, but these days I don’t remember the last time I needed it. In fact I frequently press it accidentally and prevents me to log into my computer.
I have summarized the steps below to create a free Virtual Box Windows Server 2012R2 image on your workstation, so Test Kitchen can use Vagrant and Virtual Box to launch Windows instances and test cookbooks locally fast and free.
Install the Vagrant WinRm plugin
vagrant plugin install vagrant-winrm
Get BoxCutter
Create the Windows image with BoxCutter. This process will take 30 minutes or more to fully configure the Windows image. The download step may time out on slower VPN connections. In that case disconnect the VPN connection and try it again without it. In case of any error, just execute the last command again and if it can, the process will continue from the point of error.
cd ~/
mkdir boxcutter
cd boxcutter
git clone https://github.com/boxcutter/windows.git
cd windows
Modify the BoxCutter JSON file
Change the ~/boxcutter/windows/eval-win2012r2-standard.json file to avoid the error message:
virtualbox-iso: Removing floppy drive… ==> virtualbox-iso: Error removing floppy controller: VBoxManage error: VBoxManage: error: The machine ‘eval-win2012r2-standard’ is already locked for a session (or being unlocked) ==> virtualbox-iso: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports ==> virtualbox-iso: VBoxManage: error: Context: “LockMachine(a->session, LockType_Write)” at line 1038 of file VBoxManageStorageController.cpp
Change “headless”: “false”, to “headless”: “true”,
If you want to move Git repositories to your new workstation
Commit and push all repositories to GitHub on the old workstation,
Copy the folders from your old workstation to the new,
Execute the following command in all Git repositories on the new workstation.
git reset --hard
Terraform
Copying Terraform scripts from a Windows workstation
If the Terraform scripts reference modules, terraform creates symbolic links to those modules in the .terraform/modules directories. When you try to copy those symbolic links on a Windows machine the copy process stops. To copy the Terraform scripts
Start Windows explorer in the folder above the Terraform script folders,
Search for .terraform,
In the search result list delete the .terraform folders.
Test Kitchen
If you migrate between Windows and Macintosh you need to update a few paths, because the two operating systems store user specific files at different places.
The ssh_key location in the .kitchen.yml file should start with
Enable Secondary click for the mouse and the trackpad.
Sounds
Disable the startup sound
To disable the sond during the computer start
In System Settings, Sound tab turn off the Play sound on startup
Enable notifications when external monitors are connected
By default notifications are turned off during screen sharing and screen mirroring. This makes screen sharing quieter for the audience, but notifications of arriving emails and Zoom calls are also muted when we use external monitors (screen mirroring). To enable notifications when external monitors are connected:
In System Settings, Notifications enable Allow notifications when mirroring or sharing the display.
Keyboard
Disable caps lock
If you never write emails with all capital letters, and many times a day accidentally press the caps lock key, you can disable it.
Open settings.
Open the Keyboard settings click Keyboard Shortcuts
On the Modifier Keys tab set Caps Lock to No Action for the inernal keyboard.
Set the same for your external keyboard if you have one.
Disable the Globe key
When you press the fn key on the MacBook the emoji selection pops up. It is very annoying during programming. To disable the Globe key
In Systems Settings, Keyboard set Press globe key toDo Nothing
Remove Siri from the control strip
If you don’t use Siri on your Mac, there is no reason for Siri to occupy space on the control strip above the keyboard.
Open the Keyboard settings
On the Keyboard tab click the Customize Control Strip button
Move the mouse below the bottom of the screen to highlight the Siri icon on the control strip, and drag it from the control strip up to the screen.
How to lock the screen
On High Sierra ( macOS 10.13 ) and later
Press the Cmd-Ctrl-q key combination to lock the screen.
On earlier macOS versions
To be able to lock the screen from the menu bar:
In Finder search for Keychain Access and start it,
In the Keychain Access menu select Preferences,
Check the Show keychain status in menu bar checkbox, This will place a lock icon in the menu bar.
To lock your screen
Click the lock icon in the menu bar
Select Lock Screen
Finder
Always browse in list mode
Open Finder
In the View menu select Show View Options
Select Always open in list view, and Browse in list view
Show the full path in Finder
Open Finder
In the View menu select Show Path Bar Finder will show the full path of the current folder at the bottom of the window.
To jump to a folder shown in the path bar just double click it.
Press the ‘Option/Alt’ key, right click on the Finder icon in the dock and click Relaunch
Menu bar
Change the spacing betweeh the icons
The notch for the camera on the new MacBooks hides the left most icons. The apps are running, but their icons are hidden if those do not fit on the right side of the notch. To make room for more icons
Remove rarely used system icons from the Menu Bar
Set the clock to display less information. Click the Clock Options button to access the Clock panel
Press and hold the Command key and drag the important icons to the right side of the Menu Bar to keep those always displayed.
Show the battery charge percentage
In Sequoia and later
In System Settings on the Control Center tab under Battery enable Show Percentage
In Monterey or later
In System Preferences select Dock & Menubar
On the left side scroll down to Battery Menu Bar and select Show Percentage
Before Monterey ( macOS 12 )
Click the battery icon in the toolbar
Select Show Percentage
Remove Fast User Switching
If you are the only one who uses the computer, to save space in the Menu Bar, remove the Fast User Switching icon
In System Settings on the Control Center tab under Fast User Switching set Show in Menu Bar to Don’t Show
Apple Id without credit card
If you don’t have an Apple Id, create one. To obtain one without a credit card, you need to create the account in an older version of iTunes. In version 12.7 of iTunes Apple removed the access to the App Store.
If you don’t have ownership of Homebrew, before installation execute sudo chown -R $(whoami) /usr/local/var/homebrew sudo chown -R $(whoami) /usr/local/Homebrew/
The installation steps are currently brew tap zackelia/formulae brew install bclm sudo bclm write 77 sudo bclm persist
Check the set value with bclm read
Turn off Optimized battery charging in System Preferences to give full control to the tool.
You may need to reboot the computer for the process to start monitoring the battery.
The charging will stop around 80%. It may goes above 80% with a few percents, but at least the battery is not fully charged.
After software update
The system software update usually resets the upper charging limit to 100%. After system update execute in a terminal
sudo bclm write 77
sudo bclm persist
bclm read
UTC Clock in the menu bar
This feature does not work reliably on newer machines with the notch on the top of the screen for the camera. Most likely when there is not enough room in the Menu Bar, the UTC clock is not displayed, but still hides other icons in the Menu Bar.
xBar is a plugin manager that can display plugins in the menu bar. One of them is World Clock that can display multiple clocks in a drop down of the menu.
If you use a Macintosh computer you use the Command key all the time. Unfortunately, on the Windows keyboard you will always hit the Windows key. This can be very frustrating, as pressing the Windows key with any of the cursor keys will resize the window.
Install the 32 bit version, as the 64 bit version is fairly new and has compatibility issues. Download the latest Ruby installer. Pick the file that does not have the (x64) at the end.
Accept the default values but check Add Ruby executables to your PATH
Ruby Development Kit
The Ruby Development Kit is need for certain Ruby gems, so install it.
If you have installed the 32 bit version of Ruby make sure you install the 32 bit version of the DevKit. Select the Development kit that matches the Ruby version you installed. At the time of writing the latest development kit is under “For use with Ruby 2.0 and above (32bits version only)”
Run the installer to extract it to a permanent location (C:\RubyDevKit)
Open a command window in the C:\RubyDevKit folder
Run these commands in the command prompt to install it.
You may need to add the location to the Path environment variable. Make sure you use the actual folder name, as it contains the version of the application.
;C:\Program Files (x86)\GraphvizX.XX\bin
AWS CLI
The Amazon Web Services command line interface installation will set up your workstation to launch instances in AWS from Test Kitchen. If you know you will work with AWS, see DevOps Engineering part 3. – Working with AWS for the AWS CLI installation.
Packer
We use Packer to create custom AWS AMIs that contain the fundamental configuration and applications that are common in every instance we launch.
To download apps from the Apple Store you need an Apple Id. If the app is free, you may not want to enter credit card information during the registration. If you try to create the Apple Id without the credit card in the App Store application, you may get the following error message:
Your session has timed out. Please try again. Code 5107
To create the Apple Id without a credit card
Start iTunes on your Macintosh,
Click the drop down menu in the upper left corner,
If Apps is visible, select it, otherwise click Edit Menu… in the same drop down,
To display Apps in the drop down, select the check box next to it.
On the top of the screen click the App Store button,
In the upper right corner search for a free app in the App Store and start to download it,
Create a new Apple Id and select None for credit card type.
When you try to execute any of the “kitchen” commands in Chef Test Kitchen you may get the following error message.
lib/kitchen/config.rb:182:in `block in filter_instances': undefined method `empty?' for nil:NilClass (NoMethodError)
This happened in my cookbook, when I have removed the value from the “excludes:” option in the .kitchen.yml file, but left the “excludes:” option there alone.
To make your cookbook work in Chef Test Kitchen again, remove the empty “excludes:” option form the .kitchen.yml file
Place the database backup file in the root directory of your C: drive (trust me, this will make your life easier)
Open the Command Prompt
Start the MySQL command prompt
mysql -u root -p
This command will prompt you for the MySQL root password
Switch to the new database
use db;
Import the database
source C:/BACKUP_FILE_NAME.sql
To avoid the Failed to open file ‘…’ , error 2 and error 22 error message
You can have spaces in the name of the backup file, but not in the directory names in the path
Do not use quotes around the file path
Use forward slashes
Do not end the command with semicolon (;)