Archive

Archive for November, 2018

Kubernetes for Python Developers: Part 1

November 29, 2018 Leave a comment

Kubernetes is an open-source container-orchestration system for automating deployment, scaling and management of containerised apps.

Kubernetes helps you to run, track and monitor containers at scale. It has become the de facto tool for container management.

Kubernetes is the largest and fastest growing open-source container orchestration software.

This blog post is the first part of a series: Kubernetes for Python developers.

Our goal is to migrate a Celery app app we developed in a previous blog post from Docker Compose to Kubernetes.

You do not need any Kubernetes knowlegde to follow this blog post. You should have some experience with Docker.

In this first part of the series, you will learn how to set up RabbitMQ as your Celery message broker on Kubernetes.

You will learn about kubectl, the Kubernetes command line interface. And by the end of this article you will know how to deploy a self-healing RabbitMQ application with a stable IP address and DNS name into the cluster.

https://www.distributedpython.com/2018/11/28/kubernetes-python-developers-part-1/

Advertisements
Categories: Interesting, kubernetes Tags: ,

Infrastructure As Code Tutorial

November 26, 2018 Leave a comment

This tutorial is intended to show what the Infrastructure as Code (IaC) is, why we need it, and how it can help you manage your infrastructure more efficiently.

It is practice-based, meaning I don’t give much theory on what Infrastructure as Code is in the beginning of the tutorial, but instead let you feel it through the practice first. At the end of the tutorial, I summarize some of the key points about Infrastructure as Code based on what you learn through the labs.

This tutorial is not meant to give a complete guide on how to use a specific tool like Ansible or Terraform, instead it focuses on how these tools work in general and what problems they solve.

https://github.com/Artemmkin/infrastructure-as-code-tutorial

Source:

https://github.com/Artemmkin/infrastructure-as-code-tutorial?utm_source=DigitalOcean_Newsletter

Useful Linux Command Line Bash Shortcuts You Should Know

November 21, 2018 Leave a comment

In this article, we will share a number of Bash command-line shortcuts useful for any Linux user. These shortcuts allow you to easily and in a fast manner, perform certain activities such as accessing and running previously executed commands, opening an editor, editing/deleting/changing text on the command line, moving the cursor, controlling processes etc. on the command line.

Although this article will mostly benefit Linux beginners getting their way around with command line basics, those with intermediate skills and advanced users might also find it practically helpful. We will group the bash keyboard shortcuts according to categories as follows.

https://www.tecmint.com/linux-command-line-bash-shortcut-keys/

Categories: bash, Interesting

Getting MySQL Server Up on a Docker Container

November 16, 2018 Leave a comment

Problem:
I needed mysql-server for a flask tutorial, but I did not want to install it locally on my machine. I opted to give a docker container a shot and get out of my comfort zone of using vagrant boxes.

Solution:
Install the command line mysql client.

$ brew install mysql-client
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

==> Downloading https://homebrew.bintray.com/bottles/mysql-client-5.7.23.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/8b/8b73614068a82ed9f82f19e52fdd621adcd4d017fc3767703f216cbf7b00e60e?__gda__=exp=1542310178~hmac=5e9
######################################################################## 100.0%
==> Pouring mysql-client-5.7.23.high_sierra.bottle.tar.gz
==> Caveats
mysql-client is keg-only, which means it was not symlinked into /usr/local,
because conflicts with mysql.

If you need to have mysql-client first in your PATH run:
  echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc

For compilers to find mysql-client you may need to set:
  export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
  export CPPFLAGS="-I/usr/local/opt/mysql-client/include"

==> Summary
/usr/local/Cellar/mysql-client/5.7.23: 232 files, 80.5MB

$ echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc

Then

$ docker run --name=test-mysql --env="MYSQL_ROOT_PASSWORD=mypassword" --publish 6603:3306 mysql

In another terminal

$ mysql -u root -p -h 127.0.0.1 -P 6603
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.13 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

To stop and destroy the containers.

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
ec35ea89e39b        mysql               "docker-entrypoint.s…"   16 minutes ago      Up 16 minutes       33060/tcp, 0.0.0.0:6603->3306/tcp   test-mysql

$ docker stop test-mysql
test-mysql

$ docker rm test-mysql
test-mysql

$ docker ps -a 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Source:
https://severalnines.com/blog/mysql-docker-containers-understanding-basics

Categories: Interesting, MySQL Tags: ,

A Visual Explanation of SQL Joins

November 15, 2018 Leave a comment

I thought Ligaya Turmelle’s post on SQL joins was a great primer for novice developers. Since SQL joins appear to be set-based, the use of Venn diagrams to explain them seems, at first blush, to be a natural fit. However, like the commenters to her post, I found that the Venn diagrams didn’t quite match the SQL join syntax reality in my testing.

https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/

Categories: Interesting

Brett Slatkin – How to Be More Effective with Functions – PyCon 2015

November 8, 2018 Leave a comment

Functions improve readability, encourage reuse, and facilitate refactoring. Python has many unique features that make functions significantly more powerful. This talk will show you the best ways to use functions in Python: when *args is helpful and when it’ll crash your programs; how to use generators for arguments and return values; the value of keyword vs. keyword-only arguments; and more!

Categories: Interesting, python

Kubernetes The Hard Way – Kelsey Hightower

November 5, 2018 Leave a comment

Kubernetes The Hard Way

This tutorial walks you through setting up Kubernetes the hard way. This guide is not for people looking for a fully automated command to bring up a Kubernetes cluster. If that’s you then check out Google Kubernetes Engine, or the Getting Started Guides.

Kubernetes The Hard Way is optimized for learning, which means taking the long route to ensure you understand each task required to bootstrap a Kubernetes cluster.

The results of this tutorial should not be viewed as production ready, and may receive limited support from the community, but don’t let that stop you from learning!

https://github.com/kelseyhightower/kubernetes-the-hard-way

Categories: Interesting Tags: