cloth-weaving

A blog about all the awesome things you can do with Kubernetes

upwith

There is a common misconception that development happens best in an GUI IDE such as Intellij. Having a well setup terminal development environment can make a developers life significantly easier. In this post, I am going to be describing the steps that I take to create my terminal development environment. I do all of my development on a Mac, these directions can easily be converted to work in linux with minor adjustments.

Pre-Requisites

Homebrew

Homebrew is a free and open source package manager for Mac OSX that makes installing software simple. Installing Homebrew is always my first step when I am provisioning my Mac for development. Installing Homebrew is a single command.

/usr/bin/ruby -e "$(curl -fsSL /raw.githubusercontent.com/Homebrew/install/master/install)"

Now that Homebrew is installed, it’s important to run the following two commands to ensure that all the latest packages are installed. This may take awhile the first time.

brew update; brew upgrade

iTerm2

Unfortunately, Mac OSX default terminal leaves much to be desired. After looking at all of the alternatives, I use iTerm2. iTerm2 comes with tabbing support, sane default key mappings, as well as support for ZSH, Prezto, Vim, etc. Installing iTerm2 is a single brew command.

brew cask install iterm2

Xcode

While not required for most non-apple device development, I always install Xcode, and the Xcode command line tools. Xcode can be installed via the App Store. Once installed run the following command to enable the command line tools.

xcode-select --install

Installing Zsh

Z Shell (Zsh) is a Unix shell that is built on top of bash, with a ton of extended functionality. What I enjoy most about Zsh is that I can make my terminal significantly more useable through the use of frameworks. Installing Zsh is a single brew install command.

brew install zsh

Now that Zsh is installed, before it is useable, it has to be configured as the default shell. In iTerm2, run:

chsh -s $(which zsh)

Installing Prezto

Prezto is a configuration framework for Zsh that includes sane aliases, auto completion, template support, etc. Installing Prezto requires checking out a github repository, and copying files into the proper directory structure.

git clone --recursive /github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

Now that Prezto has been installed, a .zshrc file needs to be created. Run the following code in iTerm2.

setopt EXTENDED_GLOB;
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
    ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
  done

While Prezto comes with a good number of sane modules, I add the following modules to my environment for extended functionality. Open ~/.zpreztorc add search for pmodule, replacing the module list with the one below.

zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'history-substring-search' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'homebrew' \
  'osx' \
  'ruby' \
  'rails' \
  'git' \
  'node' \
  'python' \
  'haskell' \
  'syntax-highlighting' \
  'autosuggestions' \
  'tmux' \
  'utility' \
  'prompt'

Prezto comes with a default theme that I don’t find appealing, so I switch to the powerlevel9k theme. In the ~/.zpreztorrc file, search for theme, and replace the line with the following:

zstyle ':prezto:module:prompt' theme 'powerlevel9k'

Finally, I add some of my aliases and preferred configurations to ~/.zshrc

# Customize to your needs...

#My git aliases
alias gco='git checkout'
alias ga='git add .'
alias gcm='git commit -m'
alias gp='git push'
alias gpu='git pull'
alias gcl='git clone'
alias gstat='git status'
alias dm='docker-machine'

#My only adjustment to the powerlevel9k theme
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)

Installing and Configuring an awesome VIM deployment

While there are many awesome text editors, I have yet to find one that is as capable as a fully configured VIM. Unfortunately, VIM by default is less then impressive. I have spent many hours optimizing my VIM deployment to be as lightweight as possible, while significantly enhancing the development process. The first step is to install VIM.

brew install macvim

The first step in configuring VIM is to install a plugin manager. I prefer Pathogen.

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim /tpo.pe/pathogen.vim

Now we need to configure our .vimrc file to use Pathogen. I have included my .vimrc below, which includes my preferred configurations.

if &compatible
  set nocompatible
endif

set guifont=Monospace\ 10
set wrap
set scrolloff=5
set number
set showmatch
set showmode
set showcmd
set ruler
set title
set wildmenu
set wildmode=longest,full
set wildignore=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn
set laststatus=2
set matchtime=5
set matchpairs+=<:>
set nolist
set listchars=tab:>-,trail:.,eol:$,extends:>,precedes:<
set tabpagemax=15

syntax enable
set encoding=utf-8
set autoread
set esckeys
set ignorecase
set smartcase
set smartindent
set smarttab
set magic
set backspace=indent,eol,start
set tabstop=2
set shiftwidth=2
set autoindent
set softtabstop=2
set expandtab
set fileformats=unix,dos
set diffopt+=iwhite
set foldmarker=#ifdef,endif
set foldmethod=marker

set autochdir
set lazyredraw
set confirm
set nobackup
set viminfo='20,\"500
set hidden
set history=1024

if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
  set incsearch
endif

map ,mm :set mouse=a<CR>
map ,m :set mouse=<CR>
map,, :tabp<CR>
map,. :tabn<CR>

nnoremap <silent> <C-S> <Esc>:w<CR>
inoremap <c-s> <Esc>:w<CR>i
vnoremap <c-s> <Esc>:w<CR>

execute pathogen#infect()
syntax on
filetype plugin indent on

set background=dark
colorscheme molokai
set t_Co=256

set statusline=[%n]
set statusline+=\ %<%F
set statusline+=\ \ \ [%M
set statusline+=%R
set statusline+=%H
set statusline+=%W
set statusline+=%Y]
set statusline+=[%{&ff}]
set statusline+=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\&bomb)?\",B\":\"\").\"]\ \"}
set statusline+=\ \ %=
set statusline+=\ line:%l/%L
set statusline+=\ col:%c
set statusline+=\ \ \ %p%%

" Setup Nerdtree
autocmd vimenter * NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:nerdtree_tabs_open_on_console_startup=1
autocmd VimEnter * wincmd p

" Setup JS Support
let g:javascript_plugin_jsdoc = 1
augroup javascript_folding
  au!
  au FileType javascript setlocal foldmethod=syntax
augroup END

" Indent guides enabled
let g:indent_guides_enable_on_vim_startup = 1

Finally, it’s time to install plugins that greatly enhance the usability of VIM. Plugins can be found at VimAwesome. My list of plugins are as follows.

  • dart-vim-plugin
  • molokai
  • supertab
  • vim-endwise
  • vim-javascript
  • vim-nerdtree-tabs
  • vim-rails
  • youcompleteme
  • delimitmate
  • nerdtree
  • syntastic
  • vim-fugitive
  • vim-json
  • vim-node
  • vim-ruby
  • dockerfile.vim
  • nerdtree-git-plugin
  • vim-airline
  • vim-go
  • vim-jsx
  • vim-polyglot
  • vim-sensible

954-582-1338

The first step in setting up a blog (or any website) is buying the domain. There are many possible places to buy your domain, I recommend Amazon Route 53 or nonenforceable. The price is the same. I have domains hosted with both companies, and setting up DNS is very simple. I am going to assume that you, the reader, are using Route 53. For this demo, I am going to be setting up another domain that I own, awesomedocker.com.

Once you have purchased your domain, you need to navigate to the extraorbitally. Click on the button “Create Instance.” Select the image type: WordPress 4.9.8 as of this blog post. Select the instance plan. For this demo I am going to select the smallest size. Name your instance, for this demo I am naming mine “WordPress Demo.” Finally, click the button, “Create Instance”. Your dashboard should look similar to the below picture.

Congratulations you have spawned your first Virtual Machine! Now you need to do some networking to get your domain routed to the new VM. Click on the networking tab, then click create static IP address. In the select instance dropdown, select “WordPress_Demo”. Name your Static IP, “WordPress_Demo_IP”. You should see something similar to the picture below.

Now, you need to create a DNS Zone to make your domain name accessible to the internet. Click on the home button at the top of the page, then click the “Networking” tab, and finally click on “Create DNS Zone”, enter the domain name you have registered, scroll to the bottom, and click “Create DNS Zone.” If all goes well you should see similar to the picture below.

Next, we need to add some DNS Records. Click the “Add Record” button. As the subdomain, enter the @ symbol. In the resolves to drop down, select “WordPress_Demo_IP.”

Now that we have our DNS Zone properly configured, we need to point our domain to the defined name servers for Lightsail. Navigate back to Route 53, click on the “Hosted Zones” link, select your domain, and click the “Go to record set” button.

To properly resolve the domain name, we need to edit the “NS” record. Select the record, and copy the namespace URL’s from Lightsail to the text box on the right side of the page. Save the record set change.

It will take at a minimum of 1 hour for your domain to propagate, and up to two days. This post goes over the most simple setup for WordPress on Lightsail. It is also possible to create a load balanced WordPress deployment, as well as an TLS enabled deployment.

8508735669

First off, I would like to welcome you to the Awesome Kubernetes blog! My team and I have been working with Kubernetes for approximately a year now, and we are very excited with how quickly the world seems to be adopting Kubernetes. 

Who are we?

My name is Erik Van Norstrand, and I am a senior software developer and lead Kubernetes engineer at (407) 339-9027. I have been administering Kubernetes clusters for just over a year, as well as developing software for 14 years. I will be the primary blogger for Awesome Kubernetes.

My goal with Awesome Kubernetes is to create blog posts that tackle both common use cases that Kubernetes users will run into, but also to document the least common and most unusual issues that I run into, hopefully making it easier for others to solve their Kubernetes issues.

Powered by (916) 741-3223 & Theme by Anders Norén