Skip to main content

Posts

Showing posts from 2018

Test your Python3 code in VSCode with a Docker container

With great code, comes great testing (or so we hope).


This blog post will require the following:

1. VSCode installed.
2. Docker extension in VSCode.
3) Docker for Mac or Windows.
4. A Mac or Windows device.
5. Tissues to wipe your tears of joy from how exciting containers & Python are.

Today we're going to talk about testing our Python code in a Docker container. There can be instances where this doesn't work and a VM would be better for your purposes. However, if you're building distributed systems/applications, you want to know how your code will interact in a containerized environment. This is also a really good practice if you're going over some training material. Whenever I go over training material, whether that be learning some new in Python, testing code, or even testing the way an application integrates with a system, I want something fast, easy, and smooth. It takes time to spin up a VM and test when we can just use a container. Let's get started!

Fir…

Kubernetes on Google Cloud Platform - Part 1 Set up GCP

Moving into a containerized world can be tricky and confusing at first. The orchestration portion of containers and the ability to scale them can be the trickiest. In this 3 part series, we're going to go over spinning up Kubernetes in Google Cloud Platform. Kubernetes original design was built by Google itself, so what other better place to test and host our Kubernetes cluster?

Please Note: To follow along in this blog post, this will require a credit card. This is so Google can confirm identity. Google will give a free 300 credit for at the time of writing this is 12 months.

The first thing we want to do is head over to https://cloud.google.com/ and confirm you have a Gmail account. Next, let's click the "try free" button.

Next, let's click through the EULA and confirm your information on step 2. (You will see a second screen that is different than mine. I did not show a screenshot due to personal information)




You should see a "Creating project" screen…

Docker on Windows - Part 3 Creating A Container with Docker Compose

Welcome back and thank you for checking out my third and final blog post in the series of running Docker on Windows. In the first blog post, we set up Docker on Windows. On the second, we spun up an Nginx container. Today, we're going to spin up an Nginx container, but do it the automated way with Docker Compose! Docker Compose is a manifest file of your container and it's settings. You can have one container in your Docker Compose file or multiple. Let's get started.

First, let's confirm Docker Compose is installed and running on your system. Open up PowerShell and run:
docker-compose

If you see several switches and commands, you are good to go! If not, please confirm you installed Docker with the instructions in the first blog post of this series.


Next, we're going to open up VSCode. If you do not have VSCode installed, please do so by following this link: https://code.visualstudio.com/

Once VSCode is open, we want to ensure we have a few extensions. Those two ext…

Docker on Windows - Part 2 Creating A Container

Welcome back and thank you for joining me on this epic journey! On part 1 of the Docker series, we went over installation and configuration of Docker on Windows. Today, we will bring down an image, create a container, give the container it's needed ports, allow it to run in the background, and see our Nginx splash page come up!

First, let's bring up our PowerShell window and do a quick docker --version to confirm Docker is installed, running, and happy. If Docker is not running, please check on Part 1 of the Docker on Windows series to confirm you followed all of the steps. Make sure to also confirm the Docker service is running.


For the purposes of this post, we're going to utilize Nginx because it's the most straight forward for learning deployments with Docker, in my opinion. It utilizes a port that's mostly open for all and the image is pre-build in the Docker hub.

Speaking of Docker hub, let's head over and take a look at the Nginx image.
https://hub.docke…

Docker on Windows - Part 1 Installation & Configuration

As we go through the journey of distributed applications and containers, there's an up-and-comer, Microsoft. Microsoft has been in the container game since Server 2016, and it is now available on Windows 10.

In this blog post, we're going to go over the configuration with PowerShell, Chocolatey, and Docker. First things first, lets confirm you have chocolatey installed. Chocolatey is a package manager, like brew, yum, or aptitude. To install Chocolatey, open up a PowerShell prompt as an administrator and run the following:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

This does the following:
1. Sets an execution policy to bypass for this installation
2. Forces the installations, which means no prompts
3. Utilizes a .NET object System.Net.WebClient to make an API call to Chocolatey.

Now that this is installation, let's confirm by running 'choco'. You should see…