Skip to content

Instantly share code, notes, and snippets.

View sneal's full-sized avatar

Shawn Neal sneal

View GitHub Profile
@sneal
sneal / README.md
Last active August 16, 2024 17:15
Azure - BOSH Director MySQL Migration

Migrate BOSH Azure MySQL DB to a new instance

These step describe the steps necessary to move a BOSH external MySQL 5.7 databases on Azure to a new instance.

Stop BOSH Director VM

Stop the BOSH Director VM in Azure. You can find the VM name in the Operations Manager BOSH Director tile under the Status tab. From the Azure CLI:

az vm stop --resource-group tas-resourcegroup --name 85a181e5-aa6b-4ea7-47b0-b2218b46002a
@sneal
sneal / README.md
Created August 13, 2024 21:02
TAS Log Rate Limits

TAS 4.0.20+ has ability to limit the log rate (bytes/sec) of applications to avoid having a single application overwhelm the logging system in Cloud Foundry.

The general settings or ways to configure logging limits are:

  • "Default log rate limit per app" in the TAS tile under App Developer Controls
  • CF org/space quotas
  • log-rate-limit-per-second app setting

Default log rate limit per app

The global default setting is just that, a default. It's the same as setting the per-app log-rate-limit-per-second on every single app in the foundation. This is not a way to keep devs from overriding this value. Devs can override

@sneal
sneal / main.go
Created January 11, 2024 19:58
CF apps running each diego cell
package main
import (
"context"
"fmt"
"github.com/cloudfoundry-community/go-cfclient/v3/client"
"github.com/cloudfoundry-community/go-cfclient/v3/config"
"github.com/cloudfoundry-community/go-cfclient/v3/resource"
"os"
)
@sneal
sneal / config.go
Last active December 6, 2023 18:39
go-cfclient config.New
func (c *Config) OAuth2HTTPClient(ctx context.Context) (*http.Client, error) {
// if explicitly configured with an oauth2 transport then use as-is
if _, ok := c.httpClient.Transport.(*oauth2.Transport); ok {
return c.httpClient, nil
}
// use our http.Client instance for token acquisition
oauthCtx := context.WithValue(ctx, oauth2.HTTPClient, c.httpClient)
var tokenSource oauth2.TokenSource
@sneal
sneal / README.md
Last active September 8, 2023 18:51
TAS External MySQL MIgration -> Internal TAS MySQL

Migration to TAS Internal MySQL

Migrating from an externally hosted MySQL DB server such as RDS or Oracle MySQL to the internally managed TAS HA cluster MySQL requires some extra steps to avoid application downtime. To avoid unnecessary downtime and churn we want to avoid having TAS system components ever see an empty MySQL database.

At a high level the overall procedure is:

  1. create single internal mysql instance
  2. bosh stop cloud_controller
This topic describes how to migrate your VMware Tanzu Operations Manager (Ops Manager) installation to a new vSphere datastore.
Prerequisites
Both the new and existing vSphere datastores must reside in the same data center.
To avoid service disruption, VMware recommends that you configure your overall Ops Manager deployment for high availability (HA). In addition, check for configurations necessary to achieve HA in each of your installed product tiles.
If your environment has any single points of failure, service might be disrupted as a result of the migration.
Before You Begin

This PowerCLI snippet can be used to find all the BOSH VMs connected to a specific datastore and then disconnect the CD-ROM to avoid vMotion or SDRS errors.

  1. Open a PowerCLI session and login to the appropriate vCenter using the Connect-VIServer command.
  2. Copy the below eject-iso.ps1 snippet locally
  3. Change the datastore name, from dsname to whatever your datastore name is.
  4. Execute the script

The final output table will contain all the VMs processed and list out the updated ISOPaths which should be empty at this point.

NOTE The script only modifies BOSH VMs, i.e. those with mounted env.iso files, however the output will display all VMs on the specified datastore and any other non-BOSH ISOs mounted.

@sneal
sneal / README.md
Created July 12, 2023 20:31
BOSH datastore cluster - datastore evacuation

This topic describes how to change your VMware Tanzu Operations Manager (Ops Manager) installation's underlying vSphere datastore clusters.

Before You Begin

The following sections describe the steps you can do prior to the migration.

Step 1: Back Up Your Environment

Ensure that your Ops Manager environment is fully backed up.

For more information about how to back up Ops Manager, see Backing Up Deployments.

@sneal
sneal / orderfiles.py
Created June 5, 2023 04:42
Script to rename all GoPro generated media in a directory to an ordinal number series (i.e. human understandable)
import sys, os
from pathlib import Path
from operator import itemgetter
p = ''.join(sys.argv[1:])
if len(p) == 0:
print('you must give a fully qualified directory path to process')
exit()
files = list(Path(p).glob('*.MP4'))
@sneal
sneal / README.md
Created May 11, 2023 20:51
vsphereVolume manual reattach

Using Pre-Existing Persistent Disks as PersistentVolumes

This explains how to create a PersistentVolume using existing (vsphereVolume) persistent disks populated with data, and how to use the PersistentVolume in a Pod.

Create Nginx Pod With PV

Create a storage class in the nginx namespace, here we're using the obsolete in-tree VCP provisioner:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: vcp-storage