The Perfrect Build Script

A build script should be simple, extensible and compile native.

Generally shell scripts do great job as build scripts. But if your development environment consist of Linux, Windows and Docker environments, shell script do not run out of the box on every platform. As well scripting languages like python need dependencies and are difficult to maintain for different platforms.

The solution would be a script which can run without dependencies on every platform. The solution I picked is “golang”. Runs as script, compiles native, easy to cross compile and does not need any dependencies.

Since all artifacts produces are docker images, the script is called “captain”

https://github.com/trieder83/captain

docker volume performance (portworx, nfs, bind mount)

I consider using NFS for shared volume on Docker Swarm. So I wonder how the performance of Docker NFS volumes may be.

Docker cache or delegated volumes have a huge effect on read an mostly outperform native read by far. On direct io this options do not have any effect.

The test is done on local host all to the same physical disk. Network latency is no considered. The Portworx is a standalone setup and might not represent the performance of a large cluster with replication.

docker run -it --rm -v jenkins_vol:/demo -v nfstest:/nfs ubuntu 
/bin/bash

root@686890cca159:/# set -o vi                                                                                                                                                                                                                                                                                                                                                                                                                                                   
root@686890cca159:/# dd if=/dev/zero of=/bindmount/test bs=1M count=1000 oflag=direct                                                                                                                                                                     
1000+0 records in                                                                                                                                                                                                                                        
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 4.80277 s, 218 MB/s
root@686890cca159:/# dd if=/dev/zero of=/portworxvolume/test bs=1M count=1000 oflag=direct                                                                                                                                                               
1000+0 records in                                                                                                                                                                                                                                        
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 6.08722 s, 172 MB/s
root@686890cca159:/# dd if=/dev/zero of=/nfs/test bs=1M count=1000 oflag=direct                                                                                                                                                                          
1000+0 records in                                                                                                                                                                                                                                        
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 15.3807 s, 68.2 MB/s

But still the NFS seem to be significantly slower. NFS tuning did not change write performance.

Scale docker application with HAProxy

To be able to scale a docker service a instance can not have a static port definition for export.
HAProxy is a simple way to load balance traffic to diffrenet docker containers.

 
The concpet is that every container expose a port (can be the same for all), but not publish any ports.
HAProxy exports one port which gets distributed to all containers.

 
The application has to set the environment varialbe SERVICE_PORTS (for swarm). That’s all.

 
See this docker-comose (for stack):

  
version: '3'
services:
  app:
    build: .
    image: rit_app
    environment:
      - SERVICE_PORTS=80
    expose:
      - 80
    networks:
      - nw-rit
  ha:
    image: dockercloud/haproxy
    depends_on:
      - app
    environment:
      - BALANCE=roundrobin
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8102:80"
    networks:
      - nw-rit
    deploy:
      placement:
        constraints: [node.role == manager]
...

Oracle on Docker (I): Backup / Restore Oracle RDBMS on Docker

Running Oracle on Docker is a great way for Testing Features or Development environments, specially for offline development on notebooks which require an oracle database.

If you have setup an oracle Image according oracle rdbms docker and choosen to create your db on docker volumes. And mounted backup1 volume at /backup.

docker volume create oracledb1
docker volume create backup1

Create an offline backup:

docker exec -u 0 -it ora122 bash
bash-4.2# chown oracle /backup

docker exec -ti ora122 sqlplus / as sysdba
SQL> alter database close;

Database altered.

docker exec -ti ora122 rman target /
backup database format '/backup/%U' tag=bk1;

Restore Database from Backup

docker exec -ti ora122 rman target /
RMAN> restore database from tag=BK1

RMAN> shutdown immediate

RMAN> startup mount

RMAN> alter database open resetlogs;