Goal: Install Consul 1.17.0
.
# INSTALL
# Source: https://developer.hashicorp.com/consul/downloads
wget -O- https://apt.releases.hashicorp.com/gpg \
| sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
randpasswd() { | |
NUM=${1:-32} | |
# macOS scenario | |
if [[ $(uname -s) == "Darwin" ]]; then | |
perl -pe 'binmode(STDIN, ":bytes"); tr/A-Za-z0-9//dc;' < /dev/urandom | head -c $NUM | |
else | |
# tested with: GNU/Linux, Cygwin, MSys | |
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w $NUM | sed 1q | |
fi |
mkdir ./{vault,dgraph} | |
cat << 'EOF' > compose.yml | |
services: | |
zero1: | |
image: dgraph/dgraph:${DGRAPH_VERSION} | |
command: dgraph zero --my=zero1:5080 --replicas 1 --raft idx=1 | |
ports: | |
- 6080:6080 | |
container_name: zero1 |
This was explanation by Grant McLean
cpan the CPAN shell has been shipped with Perl since about 1997. When you run it the first time it asks a bunch of questions and saves the answers in a config file. Then you can install a module by running:
cpan -i Module::Name
The shell provides other commands for searching CPAN and looking inside distribution files.
Pedantic ADHD Guide to Kubenretes Provisioning
This is my guide for how to get Kubernetes provisioned using Azure, Google Cloud, or AWS using CLI tools. This will require setting up an account with local CLI tools. The goal of this is to quickly set up a disposable test clusters in minimalist way.
Some tools used here:
direnv
) - used to setup environment variables automaticallyTCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl
extension and a different #!
call.
The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect
we use the following:
#!/usr/bin/expect
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# default constants | |
TIME = Time.now.strftime('%Y%m%d%H%M%S') | |
CONFIGFILE_HOSTS = './config/hosts' | |
VAGRANT_BOX = 'bento/ubuntu-14.04' | |
# build hosts hash | |
hosts = {} |
EKS_CLUSTER_NAME=${EKS_CLUSTER_NAME:-"my-cluster"} | |
NODE_GROUP=$(aws eks list-nodegroups \ | |
--cluster-name $EKS_CLUSTER_NAME \ | |
| jq -r '.nodegroups[0]' | |
) | |
ROLE_ARN=$(aws eks describe-nodegroup \ | |
--cluster-name $EKS_CLUSTER_NAME \ | |
--nodegroup-name $NODE_GROUP \ | |
| jq -r '.nodegroup.nodeRole' | |
) |