Manual Bidder Configuration

Before you begin

If you want more control over your bidders, you should consider configuring them manually instead of using the Open Bidder UI. This guide assumes that you have read the Bidder Server Guide and are also familiar with Google Compute Engine. You should read the related documentation and install the Cloud SDK before working through this guide.

Create a bidder instance

Before creating a bidder instance, create its binary and upload it to Google Cloud Storage. You then (1) write a startup script to download and install all necessary dependencies and (2) run your binary. For brevity, we’ll use included in open-bidder-ui.

When creating the bidder instance, instead of passing a large number of parameters with gcloud compute, consider organizing them in a file. For example, the following is a template for setting parameters:

--zone <$ZONE_NAME>
--machine-type <$MACHINE_TYPE>
--image <$IMAGE_NAME>
--boot-disk-size <$SIZE_GB>
--scopes storage-ro,logging-write
--metadata-from-file startup-script=<$PATH_TO_SCRIPT>
--metadata user_dist_uri=gs://<$GCS_BUCKET>
--metadata project_version=<$OB_PROJECT_VERSION>
--metadata jvm_parameters=-Xmx1G -Djava.awt.headless=true \ -XX:+UseConcMarkSweepGC
--metadata http_port=80
--metadata https_port=443
--metadata admin_port=9090
--metadata project_id=<$PROJECT_ID>
--metadata numeric_project_id=<$PROJECT_NUMBER>
--metadata main_parameters=<$MAIN_PARAMETERS>
--metadata doubleclick_encryption_key=<$ENCRYPTION_KEY>
--metadata doubleclick_integrity_key=<$INTEGRITY_KEY>
--metadata bid_interceptors=<$BID_INTERCEPTORS>
--metadata impression_interceptors=<$IMPRESSION_INTERCEPTORS>
--metadata click_interceptors=<$CLICK_INTERCEPTORS>
--metadata doubleclick_match_interceptors=<$DOUBLECLICK_MATCH_INTERCEPTORS>
--metadata doubleclick_match_nid=<$DOUBLECLICK_NID>
--metadata doubleclick_match_url=<$DOUBLECLICK_MATCH_URL>
--tags bidder

You can then create the bidder instance with this command:

gcloud compute instances create  < $FLAG_FILE

After it finishes initializing, the bidder instance will begin to respond to incoming requests. Use SSH to access the bidder instance to verify it is running.

Save bidder image for reuse

After you have configured a bidder, you may want to create other bidders with the same configuration. You can use Google Compute Engine to save the bidder's image, which will allow you to deploy clones of that bidder quickly. If you have successfully deployed a bidder, you can create its image as follows:

  • SSH into the bidder instance:
    gcloud compute ssh --project=<$PROJECT_ID> ssh <$INSTANCE_NAME>
  • Create an image:
    sudo gcimagebundle -d /dev/sda -o /tmp/ --log_file=/tmp/abc.log
  • Create a bucket to contain the image in Google Cloud Storage:
    gsutil mb gs://<$BUCKET_NAME>
  • Upload the image to the new bucket in Google Cloud Storage:
    gsutil cp /tmp/<$YOUR_IMAGE>.image.tar.gz gs://<$BUCKET_NAME>

You can now create new bidders with the image’s configuration:

gcloud compute instances create --project <$PROJECT_ID> --image <$IMAGE_NAME> <$INSTANCE_NAME>

Configure load balancing

You should configure your bidders' load balancing with Google Compute Engine’s built-in features. For more information, see the Load Balancing Guide.

Example: Deploy a bidder manually

To deploy a custom BidderServer binary manually to Google Compute Engine:

  1. Create your custom binary in a new module within the Open Bidder project directory.
  2. Change to the project directory:
  3. Create a flag file:
    --zone us-central1-a
    --machine-type n1-standard-4
    --image ubuntu-1604-lts
    --boot-disk-size 10
    --network test-network
    --metadata user_dist_uri=gs://<$GCS_BUCKET>
    --metadata project_version=0.9.9
    --metadata jvm_parameters=-Xmx512m -Djava.awt.headless=true
    --metadata http_port=80
    --metadata https_port=443
    --metadata admin_port=9090
    --metadata project_id=<$PROJECT_ID>
    --metadata main_parameters=<$MAIN_PARAMETERS>
    --metadata impression_url=
    --metadata click_url=
    --metadata doubleclick_encryption_key=5555555
    --metadata doubleclick_integrity_key=55555555
    --tags bidder
  4. If you haven’t yet created a network and firewall, you can create them for testing purposes with the following commands:
    gcloud compute networks create --project <$PROJECT_ID> test-network
    gcloud compute firewall-rules create --project <$PROJECT_ID> allow-tcp \
    --network test-network --allow "tcp"
  5. Verify that your instance started correctly by checking the logs. You can find the startup script log at /var/log/startupscript.log. You can view the bidder's logs with the Google Developers Console's Logs Viewer.
  6. Optionally, configure your load balancing.

Send feedback about...

Open Bidder (Beta)