PAUL'S BLOG

Learn. Build. Share. Repeat.

Re-visiting Dev Container Features

2022-12-02 3 min read Tutorial

A few months ago I wrote a post that described how you can add custom features to your Dev Containers. That didn’t age very well 😅

But good news is that there is a better way to add or extend functionality for your Dev Containers. 🥳

Since my original post, @BrigitMurtaugh published a post on the VS Code blog announcing new repos, the open dev container specification and discussed a new way of adding features. If you haven’t read the post, go check it out here.

Continue reading

Web Application Routing on AKS

2022-11-16 5 min read Architecture

Exposing your web applications on Azure Kubernetes Service (AKS) has gotten a little bit easier. In this post, I will cover the new Web Application Routing feature for AKS and discuss reasons why you may want to implement it within your cluster.

Exposing your app

You have a lot of options when it comes to exposing your application Pods to the world. If you’re using a managed-Kubernetes service in the cloud, you could deploy a Service and set the type to LoadBalancer and your cloud provider will provision one with a public IP. The Service sits in front of your Pods and if all you need is a public IP, you’re good to go.

Continue reading

Ubuntu Dev Tools

2022-11-11 3 min read Code Snippets

Is this the year of the Linux desktop? I’m not sure but I have been making more of an effort to “daily drive” a Linux desktop lately. I’m currently working off of an Ubuntu 22.10 machine and here is my script for installing common tools that I work with daily.

sudo apt-get update 
sudo apt-get upgrade

# add git repository
sudo add-apt-repository ppa:git-core/ppa

# install some basic tools
sudo apt-get update
sudo apt-get install -y \
    python3 \
    python3-pip \
    bpytop \
    tree \
    guvcview \
    vim \
    curl \
    git \
    gnupg2 \
    jq \
    sudo \
    zsh \
    build-essential \
    cmake \
    libssl-dev \
    openssl \
    unzip \
    pkg-config

# install brew tools
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /home/paul/.zshrc
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/paul/.zshrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install gcc 

# install hugo 
brew install hugo

# install azure cli
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

# install dotnet6
sudo apt-get install dotnet6

# install go
wget https://go.dev/dl/go1.19.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.zshrc
rm go1.19.3.linux-amd64.tar.gz 

# install kubectl
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl

# install docker desktop
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
wget https://desktop.docker.com/linux/main/amd64/docker-desktop-4.13.1-amd64.deb
sudo apt-get update
sudo apt-get install -y ./docker-desktop-4.13.1-amd64.deb
rm docker-desktop-4.13.1-amd64.deb

# install rancher desktop
curl -s https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/Release.key | gpg --dearmor | sudo dd status=none of=/usr/share/keyrings/isv-rancher-stable-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/isv-rancher-stable-archive-keyring.gpg] https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/ ./' | sudo dd status=none of=/etc/apt/sources.list.d/isv-rancher-stable.list
sudo apt-get update
sudo apt-get install -y rancher-desktop

# install hashi tools
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com jammy main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt-get install -y terraform packer consul nomad vault waypoint

# install node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
command -v nvm
nvm install 18

# install pulumi
curl -fsSL https://get.pulumi.com | sh

# install rust and toolchains
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo "source $HOME/.cargo/env" >> ~/.zshrc
source "$HOME/.cargo/env"
echo "PATH=$PATH:$HOME/.cargo/bin" >> ~/.zshrc
source ~/.zshrc

# install tools for building wasm apps
rustup install nightly
rustup component add rustfmt
rustup component add rustfmt --toolchain nightly
rustup component add clippy
rustup component add clippy --toolchain nightly
cargo install cargo-expand
cargo install cargo-edit
cargo install cargo-generate
cargo install --git https://github.com/bytecodealliance/wit-bindgen wit-bindgen-cli --tag v0.2.0
rustup target add wasm32-wasi
rustup target add wasm32-unknown-unknown

# install rustwasm
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

# install wasmtime
curl https://wasmtime.dev/install.sh -sSf | bash

# install snaps
sudo snap install --classic code
sudo snap install spotify
sudo snap install postman
sudo snap install zoom-client
sudo snap install sublime-text --classic
sudo snap install storage-explorer
sudo snap install obs-studio
sudo snap install discord
sudo snap install slack --classic
sudo snap install vlc

Fixing a NodeJS Digital Envelope Routines Error

2022-11-08 2 min read Tips and Tricks

In my journey to learn Rust, I’ve decided to pick up this book called “Practical Rust Web Projects” by Shing Lyu.

In the last chapter, you walk through an example of packaging a WebAssembly module using wasm-pack and using the .wasm binary in a NodeJS application. On the step where I needed to compile the application, I ran into the following error:

$ npm run build

> create-wasm-app@0.1.0 build
> webpack --config webpack.config.js

node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
    at /Users/paul/repos/Apress/practical-rust-web-projects/Ch06/hello-wasm/client/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.7.0

After a bit of Googling, I ran across someone suggesting to run the following command:

Continue reading

Deploying ARM64 workloads to AKS

2022-11-02 6 min read Tutorial

You might have heard by now that Azure has partnered with Ampere to bring ARM-based processors for virtual machines on Azure. This is super exciting as it gives you an opportunity to deploy workloads on highly performant and power efficient virtual machines and these characteristics ultimately result in excellent price-performance (lower costs 🥳)

So… are you ready to deploy your workloads to ARM64 node pools on AKS? I sure wasn’t when attempting to deploy the azure-voting-app-redis application to my cluster.

Continue reading

Sharing Bicep Modules with Azure Container Registry

2022-10-11 14 min read Tutorial

One of the things I do as a Cloud Native Advocate at Microsoft is build end-to-end lab scenarios in the https://aka.ms/oss-labs repo. Most of the demo scenarios we aim to cover is in and around the container space and a majority of the labs uses Azure Bicep to declaratively provision Azure infrastructure. As more labs get spun up, there is a potential for redundant Bicep code. You might have already guessed, there’s a need for re-usable code to spin up AKS clusters.

Continue reading
Older posts Newer posts