Skip to content

Instantly share code, notes, and snippets.

@jumpinjackie
Last active December 5, 2017 14:30
Show Gist options
  • Save jumpinjackie/aaccd01e5bc745acd6f393ecadd22cd7 to your computer and use it in GitHub Desktop.
Save jumpinjackie/aaccd01e5bc745acd6f393ecadd22cd7 to your computer and use it in GitHub Desktop.
docker-based FDO RDBMS test environment

Introduction

This docker environment will easily spin up all the RDBMSes so you can run the test suites for all FDO providers based on the GenericRdbms sub-framework:

  • OSGeo.MySQL
  • OSGeo.PostgreSQL
  • OSGeo.ODBC
  • OSGeo.SQLServerSpatial

With SQL Server 2017 now available not only for Linux (but as a Docker container), we have the ability to spin up all required DBMSes on a homogenous docker host. This docker environment is an easier way to set up the required FDO test environment for relational databases versus installing the required DBMSes "bare metal" on your developer environment.

Requirements

Install the Access Database Engine: https://www.microsoft.com/en-us/download/details.aspx?id=54920

Install MySQL Connector/ODBC (for ODBC MySQL tests): https://dev.mysql.com/downloads/connector/odbc/

If you have Windows 10 (Professional Edition):

  • Docker for Windows
  • Enable the containers feature

If you have an older version of Windows:

  1. Install VirtualBox
  2. Create a Ubuntu VM (recommend current LTS version) with at least 6GB RAM
  • Install docker on this VM
  • Set networking mode for this VM to: bridged

Usage

  1. Download the files in this gist. If you are using a VirtualBox VM for the docker host, download docker-compose.yml to the VM.
  2. Modify the various txt files to ensure the IP addres / hostname is the IP address / hostname of the docker host. If you have Docker on Windows 10, this would be localhost. If you are using a VirtualBox VM, this would be the IP address of the VM. The text files provided here assume the docker host name is fdodb which you can point either locally or to the VM by adding a hostname entry in %windir%\System32\drivers\etc\hosts
  3. Run docker-compose up in the directory where docker-compose.yml is downloaded
  4. [One time setup]: Drop any PostgreSQL schema that is not public from the template_postgis and postgres databases. This is to make the PostgreSQL schema tests happy as they are expecting a schema with only the public schema.
  5. Build FDO and run the unit test executables using the provided init text files
version: "3"
services:
postgis:
image: "mdillon/postgis:9.6"
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: "changeme"
mysql_55:
image: "mysql:5.5"
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "fdotest"
mssql:
image: "microsoft/mssql-server-linux"
ports:
- "1433:1433"
environment:
SA_PASSWORD: "Sql2016!"
ACCEPT_EULA: "Y"
provider=MySql;service=fdodb;username=root;password=fdotest;clean=false;
provider=Odbc;clean=true;
serviceOracle=fdodb;usernameOracle=xxxx;passwordOracle=xxxx;DSNOracle=ORACLE;
serviceMySql=fdodb;usernameMySql=root;passwordMySql=fdotest;DSNMySql=MySQL;
serviceSqlServer=fdodb;usernameSqlServer=sa;passwordSqlServer=Sql2016!;DSNSqlServer=SqlServer;
AccessDriverVersion=12;DbaseDriverVersion=12;ExcelDriverVersion=12;TextDriverVersion=12;
provider=PostgreSQL;service=fdodb;username=postgres;password=changeme;clean=false;
provider=SQLServerSpatial;service=fdodb;username=sa;password=Sql2016!;clean=false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment