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.
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.yamlsample-app-settings.yaml
Create Procfile which tells how to start application:
nano ProcfileFor 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.shWith 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.xmlfrom example above) - $CONFIG_FILE - file with prebid server configuration (
prebid-config.yamlfromsampledirectory 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 .ebextensionsMove 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_SHwhere
- $ZIPFILE - name for zip file will be create by the command above
- $PROCFILE - path to file describes how to start prebid-server (
Procfilefrom example above) - $LOGGING_FILE - path to file with configuration for logger (
prebid-logging.xmlfrom example above) - $CONFIG_FILE - path to file with prebid server configuration (
prebid-config.yamlfromsampledirectory above) - $RUN_SH - script to start application (
run.shfrom 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.shSave 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" sampleAdd .ebextensions to zip archive using the command:
zip -ur "$ROOT_DIR/$ZIPFILE" .ebextensionsDeploy created zip-file to the selected Beanstalk environment.