Install the DevOps development tools on Windows

Chocolatey

If you want to host Chocolatey packages internally install Chocolatey. See Install Chocolatey

Store your username in an environment variable

We will use it in the .kitchen.yml file of the Chef SDK.

  1. Open the Git Bash window and execute the command echo ‘export USER=`whoami | tr -d “\\n”`’ >> ~/.bashrc

Virtual Box

Download Virtual Box from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing, this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the Virtual Box application.You can close it, we will use other tools to start it in the future.

To be able to launch 64 bit guest operating systems turn off Hyper-V in Windows Features

  1. In the Windows search box enter Windows Features and select Turn Windows Features on or off,
  2. Uncheck Hyper-V and click OK,
  3. Reboot the computer for the setting to take effect.

Configure VirtualBox

Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  1. In Virtual box click Settings
  2. Select Network
  3. Attach the network adapter to NAT

Copy and paste

To enable copy and paste between the virtual machine and the host ( your workstation )

  1. On the General tab of the Settings page select the Bidirectional shared clipboard

Shared Folders

Specify the shared folder on your workstation

  1. In the VirtualBox menu select Preferences
  2. On the Shared Folders tab click the + icon
  3. To share the entire system drive, select the C: drive of your workstation

Enable shared folders on the virtual machines

To enable the shared folders on the virtual machine and other configurations see Virtual machine configuration at VirtualBox


Vagrant

For Vagrant installation see Vagrant.


Ruby

  • Download Ruby from http://rubyinstaller.org/downloads
  • 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-01-add-to-path

 Ruby Development Kit

The Ruby Development Kit is need for certain Ruby gems, so install it.

  • Download the Ruby Development Kit from the DEVELOPMENT KIT section of  http://rubyinstaller.org/downloads
  • 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.
      • ruby dk.rb init
      • ruby dk.rb install
  • For more information see  http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

Chef Development Kit

Terraform by Hashicorp

Install it with Chocolatey

  • Open a terminal window as administrator
  • Execute
    choco install terraform

or

Manual installation

  • Download Terraform from https://www.terraform.io/downloads.html
  • Unzip the downloaded package to C:\HashiCorp\Terraform
  • Add the Terraform directory to the path of the computer. It is not added automatically on 64 bit Windows.
    • In Windows Explorer right-click Computer and select Properties,
    • On the left side select Advanced System Settings,
    • At the bottom click the Environment Variables… button,
    • In the System Variables box select Path and click the Edit… button,
    • Add the following to the end of the Variable value. (Don’t forget to start with the semicolon as the separator). ;C:\HashiCorp\Terraform
  • To create RDS (Relational Database Service) instances in AWS, install the Amazon Web Services Command Line Interface (See instructions below)
  • Configure the GitBash window to run as administrator to be able to execute the “terraform get” command to get local modules during development
    • Right click the shortcut of the Bash window you use and select Properties
    • On the Compatibility tab check Run this program as an administrator

For more details see https://www.terraform.io/intro/getting-started/install.html

Graphviz

Graphviz is a Dependency Graph Visualization Software. We will use this utility to display the Terraform graphs.

  • Download from http://www.graphviz.org/Download..php
    There are really two dots in the address :-)
  • Execute the installer
  • 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.

Install with Chocolatey

  • Open a Git Bash window as administrator
  • Execute choco install packer

or

Manual Installation

Install software development tools on Windows

Text Editor

Notepad ++

Install a good text editor. If you do not have a favorite, I recommend Notepad ++

Configure Notepad ++

Tab settings

  • In the Settings menu select Preferences
  • In the Indentation section set the Indent size to 2 and select Space character(s)

Visual Studio Code

Configure Visual Studio Code

To work with Dev Containers, install the Dev Containers extension by Microsoft and Docker Desktop.

Git

For GitHub

For Git installation and configuration see Install Git on Windows

For Bitbucket

For Git and Bitbucket UI installation and configuration see Working with Bitbucket

Terminal

Windows Terminal is a great host for multiple terminal windows. It can open PowerShell, Command Prompt (cmd), and all other installed terminals, including Git Bash.

To configure Windows Terminal to open Git Bash as the default profile
  • Open Windows Terminal from the start menu, or right-click on any folder in File Explorer and select Open in Terminal
  • Click the small down arrow and select Settings
  • On the Startup tab set the Default profile

JSON

To automatically pretty print JSON responses in Chrome

Make

To install Make to be able to run it in the Git Bash (MINGW64) window

To install using Chocolatey
  • Install Chocolatey see Install Chocolatey
  • Install Make with
    choco install make
  • Add make to the Bash path
    • Add to the ~/.bashrc file
      export PATH="/c/ProgramData/chocolatey/bin:$PATH"
To install manually
  1. Navigate the ezwinports at https://sourceforge.net/projects/ezwinports/files/
  2. Download the make-4.4.1-without-guile-w32-bin.zip or newer archive (make sure you select the version “without-guile”),
  3. Extract the zip archive in a temporary location,
  4. Copy the contents to the C:\Program Files\Git\mingw64 directory, merging into the existing folders, but do NOT overwrite or replace any existing files.

Docker Desktop

Modern software development revolves around Docker containers. Install the Docker Desktop to be able to work with Docker and Kubernetes clusters.

  • Create a Docker account at docker.com
  • Download the Docker Desktop installer
  • Follow the instructions at the right side of the page
    • On windows
      • Install WSL with
        wsl.exe --install Ubuntu
      • Install Docker Desktop

AWS CLI

To be able to work with Amazon Web Services install the AWS CLI

Configure the AWS CLI

This process with create the ~/.aws/credentials and ~/.aws/config files

  • In the terminal execute
    aws configure
  • Enter the aws key, aws secret key, and specify the default region and response format (usually json is used)

xcrun: error: invalid active developer path on macOS

Issue

After a major macOS upgrade (currently to Ventura) the command line tools, including git, in the terminal windows (Terminal, iTerm) stop working. We get the error message

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Cause

The macOS terminals use the Xcode Command Line Tools to execute commands on the Mac. When you upgrade the Macintosh operating system, you need to accept the licensing agreement of the Xcode Command Line Tools.

Solution

The simplest way to do it, to re-install the Xcode Command Line Tools and click the Accept button.

  • Open a terminal window and execute
    xcode-select --install
  • The installation starts, and when prompted, Accept the license terms and complete the installation.

Troubleshooting

  • If after the re-installation you still get the same error message, try to execute
    sudo xcode-select --reset

There is a double quote at the end of the value read from the .env file

Developers frequently use the .env file to store configuration values on the workstation. If the values contain sensitive data add the line to the .gitignore file to avoid committing the file into source control.

.env

If the value contains spaces, enclose it in double quotes

DEBUG_COLUMN_NAME="x Debug"

Symptom

Your application reads a double quote at the end of the value:
gDebugColumnName: x Debug”

Issue

There is an extra space character at the end of the line after the closing double quote in the .env file

Solution

Delete all trailing spaces from the lines in the .env file.

KSP2 Modding with SpaceWarp

Install SpaceWarp

To install SpaceWarp you need the following tools installed on your computer

Get SpaceWarp from GitHub

  • Create a new directory external_dlls for SpaceWarp in the Kerbal Space Program 2 “C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\KSP2_x64_Data\Managed” directory
    cd "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\KSP2_x64_Data\Managed
    md external_dlls
  • Clone the SpaceWarp repository in to the external_dlls directory
    cd external_dlls
    git clone https://github.com/X606/SpaceWarp.git

Install the Python dependencies

Build SpaceWarp

  • Open the ksp2_mod_loader_patcher.sln Visual Studio solution from “C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\KSP2_x64_Data\Managed\external_dlls\SpaceWarp\SpaceWarp”
  • Open the list of references to see the missing packages

  • The packages marked with an exclamation point are missing

  • Open the NuGet package manager

Add references to the missing assemblies

  • Right-click References and select Add Reference…
  • On the Browse tab click the Browse button
  • Browse to the C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\KSP2_x64_Data\Managed folder and select the DLLs
    • Assembly-CSharp.dll
    • Newtonsoft.Json.UnityConverters.dll
    • Unity.TextMeshPro.dll
    • UnityEngine.dll
    • UnityEngine.AssetBundleModule.dll
    • UnityEngine.CoreModule.dll
    • UnityEngine.IMGUIModule.dll
    • UnityEngine.InputLegacyModule.dll
    • UnityEngine.UI.dll

Rebuild the solution

  • Right-click the solution and select Rebuild Solution

Using SpaceWarp

You can also download SpaceWarp from https://spacedock.info/mod/3257/Space%20Warp

  • Unzip the downloaded file
  • Copy the contents (the SpaceWarp directory) into the KSP2 main directory

Maybe needed to configure Visual Studio to work with Unity

See https://learn.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/getting-started-with-visual-studio-tools-for-unity?pivots=windows for details

To select the installed Visual Studio version

  • Open the Unity Editor
  • In the Edit menu select Preferences
  • On the External Tools tab click the Open by file extension and select your Visual Studio version

Error: Route.post() requires a callback function but got a [object Undefined]

If you use the NodeJS Express server, you have just created a new route with the code like this

router.post('/my_new_action', authenticationMiddleware, myController.myNewFunction);

and created a new function to handle the request, like

async function myNewFunction(req, res) {
...
}

and get the error message:

…/node_modules/express/lib/router/route.js:211
throw new Error(msg);
^

Error: Route.post() requires a callback function but got a [object Undefined]

make sure you export the new function in the controller.

module.exports = {
  myFirstFunction,
  myNewFunction
};

Rover Construction in Kerbal Space Program

To construct a rover we need a base to attach the wheels, seats, and the power source.

Structural plates

We can start with structural plates, but we need to apply some tricks to attach them to each other.

  • Place one plate in the horizontal position
  • If you cannot attach the second plate directly to the edge
    • Attach the second plate first in a 90° angle
    • Turn on Snap
    • First, rotate
    • then move it into position

Stability assistance

Even if the rover performs fine on Kerbin, the low gravity on the Mun will cause the rover to roll in a quick direction change, a steep curve or during braking.

  • Move the wheels as high as possible on the body, so the center of mass is as low as possible.
  • Add Small Inline Reaction Wheels close to the center of mass, and set the Reaction Wheels to SAS only. In the default Normal setting as you control the rover the reaction wheels would flip it in the same direction.

Installing ngrok

“ngrok is a simplified API-first ingress-as-a-service that adds connectivity,
security, and observability to your apps with no code changes”

Create a free ngrok account

Install ngrok

On macOS

  • Create the ngrok folder in your user’s opt directory
    mkdir ~/opt/ngrok
  • Step into the new directory
    cd ~/opt/ngrok
  • Move the downloaded installer into the new directory. Replace THEVERSION with the version of the downloaded file
    mv ~/Downloads/ngrok-vTHEVERSION-stable-darwin-amd64.zip .
  • Unzip the ZIP file
    unzip ngrok-vTHEVERSION-stable-darwin-amd64.zip
  • To be able to start ngrok from any directory, add the binary to the PATH. Add this to your ~/.bashrc file where the rest of the PATH statements are
    PATH=~/opt/ngrok:$PATH
  • IMPORTANT: Restart all your terminals for the PATH change to take effect

Verify the installation

When the terminals have been restarted for the PATH change to take effect

  • Test the installation with
    ngrok --version

Connect to your ngrok account

  • Execute this in the terminal to connect to your ngrok account. Get your authentication token from your setup page at 2. Connect your account
    ngrok config add-authtoken YOUR-AUTHENTICATION-TOKEN