Running Open Bidder Locally

Before proceeding, please complete the steps described in Before You Begin. You should also understand how to create a bidder server before attempting to run a local bidding instance.

How to run a local instance of the Open Bidder UI

If you made changes to the Open Bidder UI, you may want to run a local instance of it for testing purposes. In order to do so, run the following command:

mvn -pl open-bidder-ui appengine:devserver

Then access the local Open Bidder UI at: http://localhost.

How to run a local bidding instance

In order to avoid being charged for usage, we recommend that testing be performed in a local development environment rather than on Google Compute Engine.

Configuration

The Open Bidder project includes shell scripts to facilitate testing. If you have not done so already, you should create an OPENBIDDER_HOME environment variable that points to the installation directory of the Open Bidder project—this will make it easier for you to access these scripts from your own project. In this guide, we will create a simple wrapper script for maven-run-bidder.sh that provides the necessary arguments for running your bidder server with a provided set of interceptors.

By default, maven-run-bidder.sh is configured to run the open-bidder-samples-binary project with the main class SamplesServer. Below is an example of a wrapper script that you might use to modify this behavior:

#!/bin/bash
#
# Wrapper script for maven-run-bidder.sh that configures it to run with our
# own main module and other parameter defaults.

sh $OPENBIDDER_HOME/bin/maven-run-bidder.sh -module example-binary \
-main com.example.ExampleServer \
--bid_interceptors=com.example.MyBidInterceptor1,com.example.MyBidInterceptor2 \
--click_interceptors=com.example.MyClickInterceptor \
--impression_interceptors=com.example.MyImpressionInterceptor

In the wrapper script above, we run maven-run-bidder.sh with arguments that will configure the bidder server, such as which interceptors we want to use and the binary module and its main class. You can also set the environment variable OPENBIDDER_ARGS with common parameters that will be be used in every call to that script.

Bidder parameters

Open Bidder supports a long list of command-line parameters, almost all are optional or have sensible defaults. The major exception is the platform configuration, where "platform" is itself a parameter: --platform=GENERIC or --platform=GOOGLE_COMPUTE. Google Compute means a GCP instance, and Generic (the default) is anything else (including other cloud platforms without special support from Open Bidder; Amazon EC2 was tested, anything with JDK 8 should work). The table below explains the platform-dependent parameters; for others, run maven-run-bidder.sh --platform=XXX --help.

Command Notes
--project_id (GOOGLE_CLOUD, required) To get the GCE project ID:
  1. Open the Google API Console.
  2. Select the Open Bidder project.
  3. In the Dashboard, look for the ID just beneath the project name.
--numeric_project_id (GOOGLE_CLOUD, required)To get the GCE numeric project ID:
  1. Open the Google API Console.
  2. Select the Open Bidder project.
  3. In the Dashboard, look for the Project number, next to the ID, in parenthesis after '#'.
--service_account_id (GENERIC, optional) To get the service account ID (email address):
  1. Open the Google API Console Credentials page.
  2. Select the Open Bidder project.
  3. On the Credentials page, find the Service account keys section, then select the Manage Service Accounts link (to the right of Service account keys section).
  4. On the resulting Permissions page, get the email address.

    If you don't have a Service account key, follow the instructions below to create a new Service account key.

--p12_file_path (GENERIC, optional) To generate the file (you must be the project owner):
  1. Open the Google API Console Credentials page.
  2. Select the Open Bidder project.
  3. On the Credentials page, select the Create credentials drop-down, and choose Service account key.
  4. In the Service account drop-down, choose New service Account.
  5. Enter a Name for the service account. The Service account ID is automatically generated from the name and project name.
  6. Make note of the service account ID email. It will not be shown after you create the ID.
  7. Under Key type, choose P12.
  8. Click Create. The P12 file with the account's public/private key pair is saved to your Downloads folder. Make note of the private key's password.
  9. Put the generated P12 file in a safe place and provide its absolute path.

Run the bidder

Now that we've prepared our bidder server and created our wrapper script for maven-run-bidder.sh—which we'll arbitrarily name "run-bidder.sh" and place in a directory named bin in our project's root directory— we can run our bidder with the following command from within our project's root directory:

bin/run-bidder.sh

When you run this script, ExampleServer will be started with the parameters you provided.

Running a complex project

If you want to quickly try out a non-trivial bidder server project, a good place to start is open-bidder-samples-binary. This project configures a bidder server such that it can use the interceptors from open-bidder-samples and open-bidder-weather. Since maven-run-bidder.sh defaults to running open-bidder-samples-binary, we only need to specify the command-line arguments we'd like to pass to our bidder server. Assuming that you have already defined OPENBIDDER_HOME, you could start the bidder server by entering the following in the root directory of the Open Bidder project:

bin/maven-run-bidder.sh \
--bid_interceptors=com.google.openbidder.bidding.interceptor.ConfigurableBidInterceptor \
--configbid_url=https://wikipedia.org --configbid_snippet=src/main/config/samplesnippet-simple.html

The code above will configure SamplesServer to run using the ConfigurableBidInterceptor. If you look to the SamplesModule, you'll notice that the other arguments are being used to configure the interceptor with JCommander.

Send feedback about...

Open Bidder (Beta)