Skip to content

Latest commit

 

History

History
132 lines (104 loc) · 4.51 KB

build-aws.md

File metadata and controls

132 lines (104 loc) · 4.51 KB

Deploying through Prebid Server Deployment on AWS Solution

Prebid Server can be automatically deployed into an AWS account using the Prebid Server Deployment on AWS Solution. Users retain full control over bidding decision logic and transaction data for real-time ad monetization, within their own AWS environment. It also offers enterprise-grade scalability to handle a variety of requests and enhances data protection using the robust security capabilities of the AWS Cloud. It is open-source and includes a comprehensive Implementation Guide and the accompanying AWS CloudFormation template for a one-click launch.

Creating project ZIP package and deploying it to AWS Elastic Beanstalk

Follow next steps to create zip which can be deployed to AWS Elastic Beanstalk.

Build project as described here. Then get prebid-server.jar file from generated target directory

Create next configuration file:

  • prebid-logging.xml

The content of these file can be found here.

Copy sample directory from project root (it will contain two files)

  • prebid-config.yaml
  • sample-app-settings.yaml

Create Procfile which tells how to start application:

nano Procfile

For example, if run.sh starts the server content should be:

web: ./run.sh

where ./run.sh - script is used for running the server. How to create this file will be described below.

Create run.sh script which will start the server:

nano run.sh

With the next content:

exec java -jar prebid-server.jar -Dlogging.config=$LOGGING_FILE --spring.config.additional-location=$CONFIG_FILE

where

  • $LOGGING_FILE - file with configuration for logger (prebid-logging.xml from example above)
  • $CONFIG_FILE - file with prebid server configuration (prebid-config.yaml from sample directory above)

If you follow same naming convention, your run.sh script should be similar to:

exec java -jar prebid-server.jar -Dlogging.config=prebid-logging.xml  --spring.config.additional-location=sample/configs/prebid-config.yaml

Make run.sh executable using the next command:

chmod +x run.sh
  • .ebextensions

Create hidden directory .ebextensions:

mkdir .ebextensions

Move to directory .ebextensions:

cd .ebextensions

Create next file inside .ebextensions:

  • server-logs.config

With content:

files:
  "/opt/elasticbeanstalk/tasks/taillogs.d/prebid-server.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
      /var/log/prebid.log

  "/opt/elasticbeanstalk/tasks/bundlelogs.d/prebid-server.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
      /var/log/prebid.log

  "/opt/elasticbeanstalk/tasks/publishlogs.d/prebid-server.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
      /var/log/prebid.log

It is used to configure tasks for tail logs, bundle logs, and log rotation.

Move back to the project root directory and create zip file:

cd ..
zip -j $ZIPFILE target/prebid-server.jar $PROCFILE $LOGGING_FILE $RUN_SH

where

  • $ZIPFILE - name for zip file will be create by the command above
  • $PROCFILE - path to file describes how to start prebid-server (Procfile from example above)
  • $LOGGING_FILE - path to file with configuration for logger (prebid-logging.xml from example above)
  • $CONFIG_FILE - path to file with prebid server configuration (prebid-config.yaml from sample directory above)
  • $RUN_SH - script to start application (run.sh from example above)

If you follow same naming convention, your command should be similar to:

zip -j prebid-server.zip prebid-server.jar Procfile prebid-logging.xml run.sh

Save project root directory to env variable:

export ROOT_DIR=$(pwd)

Add sample to created in previous step zip archive using the command:

zip -ur "$ROOT_DIR/$ZIPFILE" sample

Add .ebextensions to zip archive using the command:

zip -ur "$ROOT_DIR/$ZIPFILE" .ebextensions

Deploy created zip-file to the selected Beanstalk environment.