Archive for August, 2019

No networking in Docker containers under Debian 10 — Unixblogger

August 19, 2019 Leave a comment

I finally started to migrate the first few servers to Debian 10, codename “Buster”. With the last upgrades I never stumbled upon any issues. However, this time we see a problem when using Docker as the containers are unable to communicate to the internet. Upgrade to Debian 10 reliable as always As usually, the upgrade…

via No networking in Docker containers under Debian 10 — Unixblogger

Categories: Interesting

Postgres “Select * from ” freezes

August 18, 2019 Leave a comment

Due to a programming error in a python program I had written, I was unknowingly preventing postgres from obtaining an access lock to a table. There were no errors but trying to run a

Select * from <table>

would just freeze.

The solution was to fix the python program. But I used the following query to get some more insight into what was causing the issue.

$ psql -U myuser -h localhost mydatabase
Password for user myuser: 
psql (10.8 (Ubuntu 10.8-1.pgdg14.04+1))
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

mydatabase=> SELECT *                                  
  FROM pg_locks l
  JOIN pg_class t ON l.relation = t.oid AND t.relkind = 'r'
 WHERE t.relname = '<table>';
(9 rows)

mydatabase=> \q


Categories: postgresql

25 Useful Basic Commands of APT-GET and APT-CACHE for Package Management

August 14, 2019 Leave a comment

This article explains how quickly you can learn to install, remove, update and search software packages using apt-get and apt-cache commands from the command line. This article provides some useful commands that will help you to handle package management in Debian/Ubuntu based systems.

Categories: bash Tags: ,

Improve your tests in Django with fakes and factories

August 12, 2019 Leave a comment

In our Django apps, we have the M(odel)T(emplate)V(iew) structure (mostly known as MVC). When we want to test its functionality we usually have to create some model instances and work with them and the database.

A nice and easy approach for doing so is to create fake data in our tests in the form of factories and fakers.

In the following article, we are going to look at some practical examples and techniques. This will improve the readability and behavior of your tests.


Categories: python Tags: ,

Using Docker Volumes to Share Data Between Containers and Host Computer

August 4, 2019 Leave a comment

Docker volumes are used to persist data from a certain directory or directories of your Docker containers. So your data is not removed when the container stops or is removed.

You can also share a Docker volume to many containers. Let’s talk about a scenario to find out why it’s important.

Let’s say you have a PHP web application. Now you want to test whether it works on PHP version 5.4, 7.0, 7.1, and 7.2. You can create a Docker volume, let’s call it webapp. Then copy the source code files of your PHP web app to the Docker volume webapp. Then you can create containers of different PHP versions and attach the Docker volume webapp to WEBROOT of all these containers. That way, you can easily test how your web app performs on different PHP versions.

In this article, I will show you how to use Docker volumes to share data between containers and the host computer. Let’s get started.

Categories: Interesting Tags: