Creating Your Bidder Server Binary

Previous Step

In the last step, you deployed the Open Bidder UI. Now we will demonstrate how to package and upload a bidder server that you can use to run the custom interceptor you created in Your First Bid Interceptor (or a sample interceptor, if you've skipped that step).

Create the bidder binary project

To access useful scripts from the Open Bidder project, you should create a new environment variable that specifies where it is installed on your machine. For example, if it were installed in your home directory, you might add the following to your shell profile:

export OPENBIDDER_HOME=$HOME/open-bidder

A bidder needs one "binary" module that will configure and start up your bidder, integrating the Open Bidder framework with your custom logic (preferably implemented by separate modules), configuration files, and dependency libraries. This guide will show you how to create a bidder binary and configure it for deployment to Google Compute Engine.

The easiest and preferred way to create a new bidder binary project is to clone the open-bidder-samples-binary project. It provides default configurations for the Maven Appassembler and Maven Assembly plugins that you can customize for your project. You probably want to rename the main class from this template, SamplesServer, let's say to MyBidderServer.

You will need to customize the main class's getModules() method to add your own modules and also any Open Bidder features which are available as extensions. At minimum, you need to include the modules for some exchange connector; the core framework is exchange-neutral so the base BidderServer won't add any connector.

public class MyBidderServer extends BidderServer {
  public MyBidderServer(String[] args) {
    super(args);
  }

  public static void main(String[] args) {
    new MyBidderServer(args).main();
  }

  @Override
  protected ImmutableList<Module> getModules() {
    return ImmutableList.<Module>builder()
        .addAll(super.getModules())
        // DoubleClick connector
        .add(new DoubleClickModule())
        .add(new DoubleClickMatchModule())
        .add(new DoubleClickImpressionModule())
        .add(new DoubleClickInterceptorsModule())
        // My own modules go here
        .add(new MyInterceptorLibraryModule())
        .add(new MyRedisClientModule())
        .add(new MyMachineLearningModule())
        .add(new MyReportingModule())
        .build();
  }
}

For a simple interceptor project such as the RandomBidInterceptor that requires no custom modules, you don't need the changes above.

Configure the bidder binary

While cloning the open-bidder-samples-binary project earlier provided us with many useful default configurations, there are some that we will still need to provide manually. The first step is customizing the project's pom.xml file; because our POM was copied from open-bidder-samples-binary, you will find there some comments suggesting where you should make changes. At minimum, in order to use the RandomBidInterceptor you created earlier as a custom module, you should add this dependency:

<dependency>
  <groupId>com.example</groupId>
  <artifactId>random-bid-interceptor</artifactId>
  <version>${randomBidInterceptorVersion}</version>
</dependency>

By including the above, you will able to configure the bidder to run the RandomBidInterceptor when you later configure your project in the Open Bidder UI.

The second step is configuring Appassembler. This Maven plugin is used to generate the script that will run the bidder binary when it is deployed to Google Compute Engine. Appassembler's configuration needs to be customized, at minimum, with the project's main class. Put it here:

<programs>
  <program>
    <name>bidder</name>
    <!-- CHANGE to your own main class, in this project. -->
    <mainClass>com.example.MyBidderServer</mainClass>
  </program>
</programs>

Package the bidder binary

Now that we have created and configured the bidder binary project, we need to generate the actual binary, packaged for deployment. To do this, run the following command:

mvn package appassembler:assemble

You should now find a tar.gz containing the project's assembled binary in its target directory.

Upload your bidder binary to Google Cloud Storage

In order to deploy your bidder binary to Google Compute Engine, you must first upload the generated tar.gz to Google Cloud Storage. We've provided gsupdate.sh in the bin directory. Check gsupdate.sh -help for usage.

Once uploaded, bidders you create through the UI will run the provided bidder binary. In order to provide additional configurations for it, such as the interceptors you want it to run, you will need to configure it in the UI.

Next steps

We're almost done! Proceed to the final step, Configuring Open Bidder.

Send feedback about...

Open Bidder (Beta)