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

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;