Skip to content

Building the System

The source code for the RTB4FREE system is located here

Pre-Requisites

To work with the source you will need:

  • Java 1.11
  • Make
  • Maven
  • Mkdocs
  • Minio Client
  • NPM
  • pg_restore
  • Python 3.6+
  • Yarn

But Debian users beware. Yarn on your distro may be the wrong program. See the next section if you are a debian user.

Debian Users Beware

By default, the yarn in the debian distro is not the yarn for working with react. Please uninstall the old yarn and install it with npm. See here:

    $yarn --version
    0.32+git

If it says ***+git, this is wrong! Now do this:

    $sudo apt remove cmdtest
    $npm install -g yarn
    $yarn --version
    1.22.11

All better now.

Clone the Repo

The goal of the makefile is to create the docker container necessary for deploying the bidder. First step is to git clone the distribution.

    $git clone https://github.com/jacamars/Newbidder.git

After cloning, set your S3 (and MINIO) configuration .env file for running docker-compose and passing your AWS credentials to the containers. Create a .env file in ~Newbidder directory (wherever you cloned the code into). In this case we will use MINIO default credentials.

AWSACCESSKEY=AKIAIOSFODNN7EXAMPLE
AWSSECRETKEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
S3ENDPOINT=http://minio:9000

Build and Start

Application

The second step is to 'make application', or simply 'make' will create all the components necessary for the docker container.

    $make application

This will compile the JAVA application into an all-in-one JAR file, it will then create the campaign manager react application, and then create the docker container.

Start Server

The second step is to start the bidder and all its other component parts

This script will run docker-compose, do some clean up, and restart docker-compose. When it is complete the system will be operationsl.

    $make firsttime

After running this script once, you can bring the system up and down with docker compose.

Minio

The third step, 'make minio' is executed after 'make application'. The purpose is to copy the initial data files the bidder uses to convert 2 character country names into 3 character names, zip code information, and CIDR blocks to block common bot addresses.

    $make minio

Note, the directory /tmp/s3 will contain the buckets and objects used by the bidder. If you want to change the location of the hosted volume, or to replace with Amazon S3, modify the makefile.

Restore-db

The fourth step is to put a sample campaign into the system. Using make restore-db.

This command will be executed after make minio. The command copies a sample campaign into the database for\ you to test with.

Use the backup-db target to save your database over this file, then you can run the restore-db target to restore your most recently saved changes.

The command restores the database.backup file to the postgres database. Note, By default it connects to localhost:54321, you will need to adjust this to point to the postgres container if localhost is not the destination.

    $make restore-db

Campaign Manager

Point your browser to localhost:8080. Then click "Campaign Manager". The credentials to login are:

Org: rtbfree
User: ben.faul@rtb4free.com
Password: zulu
Server: localhost:7379

Sample Bids

Once the system is running, you can send some sample bids with a built-in script. Type:

    $tools/samplebids

This will transmit 100 bids.

In order to send bids continuously, with wins and pixels mixed in use the following:

    $tools/load-elastic

Login to ELK

You can login to Kibana and see the information about received bids/wins/pixels/conversions by pointing your browser to localhost:5601

There is no login, the system simply starts.

Other Targets

Local

The 'make local' compiles just the JAVA application. Eg:

    $make local

This just creates the classes, it does not build the JAR file.

React

The 'make react' command compiles the REACT based campaign manager into a deployable www directory.

    $make react

This uses YARN to make the system.

Docker

The 'make docker' command creates the docker container that holds the react-based campaign manager and the JAVA based bidder. It does not compile these artifacts first.

    $make docker

This will create the linux image used by the applications, but does not compile them.

Backup-db

This command will back up your current POSTGRES database into a dump file.

    $make backup-db

By default it connects to localhost:54321, you will need to adjust this to point to the postgres container if localhost is not the destination.

It creates a file called 'database.backup' in the current working directory.

Clean

This command deletes the class files.

    $make clean