Warning, /sdk/codevis/thirdparty/soci/docs/vagrant.md is written in an unsupported language. File is not indexed.

0001 # Vagrant SOCI
0002 
0003 [Vagrant](https://www.vagrantup.com/) used to build and provision
0004 virtual environments for **hassle-free** SOCI development.
0005 
0006 ## Features
0007 
0008 * Ubuntu 14.04 (Trusty) virtual machine
0009 * Multi-machine set-up with three VMs: `soci`, `oracle`, `db2`.
0010 * Support networking between the configured machines.
0011 * `soci.vm`:
0012   * hostname: `vmsoci.local`
0013   * build essentials
0014   * core dependencies
0015   * backend dependencies
0016   * FOSS databases installed with sample `soci` user and instance pre-configured
0017   * during provision, automatically clones and builds SOCI from `master` branch.
0018 * `db2.vm`:
0019   * hostname: `vmdb2.local`
0020   * IBM DB2 Express-C 9.7 installed from [archive.canonical.com](http://archive.canonical.com) packages.
0021 * `oracle.vm`:
0022   * *TODO*: provision with Oracle XE
0023 * SOCI local git repository (aka `$SOCI_HOME`) is automatically shared on host
0024   and all guest machines.
0025 
0026 ## Prerequisites
0027 
0028 * Speedy broadband, time and coffee.
0029 * Recommended 4GB or much more RAM (tested with 16GB only).
0030 
0031 ### SOCI DB2 backend
0032 
0033 The `soci.vm` will be configured properly to build the DB2 backend only if
0034 it is provisioned with complete DB2 CLI client (libraries and headers).
0035 You need to download "IBM Data Server Driver Package (DS Driver)" manually
0036 and make it visible to Vagrant:
0037 
0038 1. Go to [IBM Data Server Client Packages](http://www-01.ibm.com/support/docview.wss?uid=swg21385217).
0039 2. Download "IBM Data Server Driver Package (DS Driver)".
0040 3. Copy the package to `${SOCI_HOME}/tmp` directory, on host machine.
0041 
0042 ## Usage
0043 
0044 Below, simple and easy development workflow with Vagrant is outlined:
0045 
0046 * [Boot](https://docs.vagrantup.com/v2/getting-started/up.html)
0047 
0048 ```console
0049 vagrant up
0050 ```
0051 
0052 or boot VMs selectively:
0053 
0054 ```console
0055 vagrant up {soci|db2}
0056 ```
0057 
0058 First time you run it, be patient as Vagrant downloads VM box and
0059 provisions it installing all the necessary packages.
0060 
0061 * You can SSH into the machine
0062 
0063 ```console
0064 vagrant ssh {soci|db2}
0065 ```
0066 
0067 * Run git commands can either from host or VM `soci` (once connected via SSH)
0068 
0069 ```console
0070 cd /vagrant # aka $SOCI_HOME
0071 git pull origin master
0072 ```
0073 
0074 * You can edit source code on both, on host or VM `soci`.
0075 * For example, edit in your favourite editor on host machine, then build, run, test and debug on guest machine from command line.
0076 * Alternatively, edit and build on host machine using your favourite IDE, then test and debug connecting to DBs on guest machines via network.
0077 
0078 * Build on VM `soci`
0079 
0080 ```console
0081 vagrant ssh soci
0082 cd /vagrant    # aka $SOCI_HOME
0083 cd soci-build  # aka $SOCI_BUILD
0084 make
0085 ```
0086 
0087 You can also execute the `build.h` script provided to run CMake and make
0088 
0089 ```console
0090 vagrant ssh soci
0091 cd $SOCI_BUILD
0092 /vagrant/scripts/vagrant/build.sh
0093 ```
0094 
0095 * Debug, only on VM `soci`, for example, with gdb or remotely Visual Studio 2017.
0096 
0097 * [Teardown](https://docs.vagrantup.com/v2/getting-started/teardown.html)
0098 
0099 ```console
0100 vagrant {suspend|halt|destroy} {soci|db2}
0101 ```
0102 
0103 Check Vagrant [command-line interface](https://docs.vagrantup.com/v2/cli/index.html) for complete list of commands.
0104 
0105 ### Environment variables
0106 
0107 All variables available to the `vagrant` user on the VMs are defined in and sourced from `/vagrant/scripts/vagrant/common.env`:
0108 
0109 * `SOCI_HOME` where SOCI master is cloned (`/vagrant` on VM `soci`)
0110 * `SOCI_BUILD` where CMake generates build configuration (`/home/vagrant/soci-build` on VM `soci`)
0111 * `SOCI_HOST` network accessible VM `soci` hostname (`ping vmsoci.local`)
0112 * `SOCI_USER` default database user and database name
0113 * `SOCI_PASS` default database password for both, `SOCI_USER` and root/sysdba
0114   of particular database.
0115 * `SOCI_DB2_HOST` network accessible VM `db2` hostname (`ping vmdb2.local`)
0116 * `SOCI_DB2_USER` admin username to DB2 instance.
0117 * `SOCI_DB2_USER` admin password to DB2 instance.
0118 
0119 Note, those variables are also used by provision scripts to set up databases.
0120 
0121 ## Troubleshooting
0122 
0123 * Analyze `vagrant up` output.
0124 * On Windows, prefer `vagrant ssh` from inside MinGW Shell where  `ssh.exe` is available or learn how to use Vagrant with PuTTY.
0125 * If you modify any of `scripts/vagrant/*.sh` scripts, **ensure** they have unified end-of-line characters to `LF` only. Otherwise, provisioning steps may fail.