Search This Blog

Life, code and all

Code snippets and memory joggers

Sunday, August 31, 2025

Docker Development Environment

Introduction

This something i wrote back in 2017 but, it seems, i never hity the publish button.

Motivation

devimpy

The intention is to develop a functional test environment for the devimpy project.

peoplevalue

An alternative way for providing the services I write to the folks within People Value.

The code I write, I hope, will be more easily available to less technical members of staff, being made available through the BackOffice system we have already and so provide them with a consistent way of accessing the functions they require.
Specifically from a web interface integrated into the backoffice.

Many of the processes I provide can be long running but will be run infrequently.

Previous attempts to allow users to activate process through a web interface have had issues where it would be possible for a process to be started and started again which potentially caused the two versions of these processes to interfere with each other.


Development Environment

My development environment will use virtual machines to emulate the various systems that will be used.

I'm using Debian Jessie as the base systems for all the machines with VirtualBox and all machines have vim-nox build-essential, dkms installed.
Guest Additions is ready to be installed but gets run on GUI systems after the desktop has been installed.
all the machines get Guest Additions installed eventually.

Development will be with python3 (at the time of writing, the current Debian stable has v 3.4 installed by default but development may be done with another version, maybe) using the Pyramid framework.

'docker-manager' Server

Install

Taken from the official Docker site:

$ sudo apt-get install -y --no-install-recommends  apt-transport-https  ca-certificates  curl  software-properties-common

$ curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -

$ sudo add-apt-repository  "deb https://apt.dockerproject.org/repo/ debian-$(lsb_release -cs)  main"

$ sudo apt-get update
$ sudo apt-get -y install docker-engine
$ sudo service docker start

Created and added myself to the docker group so that I can run the docker command as myself, without having to sudo every time.

$ sudo groupadd docker
$ sudo usermod -aG docker $USER

$ docker run hello-world
The last commands installs a test container to check that all is well.

I configured this server with an external NIC (eth1) in addition to the NAT NIC (eth0)

I cloned this server twice, renaming to docker1 and docker2

Swarm

On manager
docker swarm init --advertise-addr 192.168.10.16 (the IP supplied by my DHCP server for the MAC on the manager vm)

on docker1 and docker2
I used the the docker swarm join command, as supplied when the docker swarm init was called to add the two 'worker' vms to the swarm.

'dockerDevelopment-vm' Machine

Took cloned the base vm and changed the hostname by
updating /etc/hostname
and
/etc/hosts
then rebooted

Installed task-desktop which installs the task-gnome-desktop by default
Wing IDE pro I have a licensed version for work, so why not?
git-all


Virtual Environments

There are two common ways/places to install virtualenvs. All in one place, oftern in the home dir in a directory such as .venv or .virtualenv or just venv etc the otheris to have the environment placed into each project.
So far I've commonly used the former however, as recomended by The Hitch Hitchers Guide to Python I'll use the per-project way.

 First we need pip3 to handle the installation the python3 versions of the virtual environments, rather than Debian's packages for them
so
sudo apt-get install python3-pip
sudo pip3 install virtualenvwrapper
This should install virtualenv as a dependency  I expect
mkdir ~/.virtualenvs
added
if [ -d "$HOME/.virtualenvs" ];then
    export PIP_REQUIRE_VIRTUALENV=true
    export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    export WORKON_HOME=$HOME/.virtualenvs
    export PROJECT_HOME=$HOME/repos/mastaba
    source /usr/local/bin/virtualenvwrapper.sh
fi
to the bottom of  ~/.profile

Friday, August 29, 2025

A new install with Trixie

Intentions

I have an old ThinkCentre M73, not super powerful;  Intel Core i5-4570T Processor, 250G hard drive and 8G memory.

I need low resource apps and tools.

The install

Starting with a basic netinst install of trixie and then the following packages:

  • neovim
I'm not a fan of nano.
  • awesome
  • awesome-extra
  • xorg
The awesome Windows Manager, with very VIM-like key bindings.
  • arandr
to manage the displays
  • luakit
Browser, also with very VIM-like key bindings.
  • terminator
I have never tried this terminal emulator before and have heard good things, so thought I'd give it a go in this install.
  • alsa-utils
for handling sound easily.
  • wine
I enjoy playing DiscworldMUD and Quow has modified MUSHClient with some excellent and indespensable pluggins sadly MUSHClient is windows only.

I lament Quow not working with the excellent Mudlet for his plugins, which I use to use but appreciate his hardwork.
  • git 
to install some drivers for the wavlink dock I use.

`apt install neovim awesome awesome-extra luakit xorg terminator alsa-utils git wine`


Boot to my user and start the windows manager

`sudo systemctl edit getty@.service` to create a drop-in unit at /etc/systemd/system/getty@.service.d/override.conf with the following contents:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --noclear --autologin keith %I $TERM

I then ran `sudo systemctl enable getty@tty1.service`

I added `startx`to the bottom of my .profile file in my home directory.

Using a decent editor ;)

`sudo update-alternatives --config editor`

Install and configure the drivers for the dock


git clone https://github.com/AdnanHodzic/displaylink-debian.git
cd displaylink-debian
sudo ./displaylink-debian.sh

running xrandr --listproviders did no showed me any more than the one provider, 
which meant that the drivers were not active.
vim /etc/X11/xorg.conf.d/20-displaylink.conf
an replaced th content with the following and rebooted:
Section "OutputClass"
    Identifier  "DisplayLink"
    MatchDriver "evdi"
    Driver      "modesetting"
    Option      "AccelMethod" "none"
EndSection
xrandr --setprovideroutputsource 1 0
xrandr --setprovideroutputsource 2 0
xrandr --setprovideroutputsource 3 0
xrandr --setprovideroutputsource 4 0
I configured the displays with arandr, don't forget to activate the dispalys you need in the Outputs drop down.

Shortcuts


Terminator is a bit long to type every time I want a terminal, which I do often.

About Me

I love to travel and meet new people, motorbikes, moving my body through dance, martial arts and yoga. I'm a lifelong learner interested in how things work, and the way people think and make their decisions. My choice of superpower would be to speak with someone and understand them completely, including their intention and for me to be able to communicate my intention to them clearly in their own language. As an Amazon Associate, I may earn from links to qualifying purchases.