Skip to content

Commit

Permalink
Merge tag 'master' into verticles
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/prebid/server/handler/info/BiddersHandler.java
#	src/main/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListService.java
#	src/main/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2.java
#	src/main/java/org/prebid/server/spring/config/PrivacyServiceConfiguration.java
#	src/main/java/org/prebid/server/spring/config/SettingsConfiguration.java
#	src/main/java/org/prebid/server/spring/config/VertxConfiguration.java
#	src/main/resources/application.yaml
#	src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceTest.java
  • Loading branch information
And1sS committed Feb 27, 2024
2 parents 06da74f + 2322dfc commit 2636a95
Show file tree
Hide file tree
Showing 2,076 changed files with 108,275 additions and 24,983 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# From https://github.com/microsoft/vscode-dev-containers/blob/master/containers/go/.devcontainer/Dockerfile
ARG VARIANT="17-jdk-bookworm"
FROM mcr.microsoft.com/vscode/devcontainers/java:${VARIANT}
47 changes: 47 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
{
"name": "Java",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Java
"VARIANT": "17-jdk-bookworm",
}
},
"containerEnv": {
"PBS_GDPR_DEFAULT_VALUE": "0"
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Set *default* container specific settings.json values on container create.
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/bash"
}
},
"terminal.integrated.defaultProfile.linux": "bash",
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"eamodio.gitlens",
"vscjava.vscode-java-pack"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8000,8001,6060],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "mkdir ~/.ssh; ssh-keyscan github.com > ~/.ssh/known_hosts",

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
60 changes: 60 additions & 0 deletions .github/workflows/docker-image-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish Docker image for new tag/release

on:
workflow_run:
workflows: [Publish release]
types:
- completed

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Publish Docker image for new tag/release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
java: [ 17 ]
dockerfile-path: [Dockerfile, extra/Dockerfile]
include:
- dockerfile-path: Dockerfile
build-cmd: mvn clean package -Dcheckstyle.skip -Dmaven.test.skip=true
package-name: ghcr.io/${{ github.repository }}
- dockerfile-path: extra/Dockerfile
build-cmd: mvn clean package --file extra/pom.xml -Dcheckstyle.skip -Dmaven.test.skip=true
package-name: ghcr.io/${{ github.repository }}-bundle
steps:
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
cache: 'maven'
java-version: ${{ matrix.java }}
- name: Build .jar via Maven
run: ${{ matrix.build-cmd }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker Image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.package-name }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile-path }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/pr-functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
java-version: ${{ matrix.java }}

- name: Build with Maven
run: mvn -B verify -DskipUnitTests=true -Dtests.max-container-count=5 --file extra/pom.xml
run: mvn -B verify -DskipUnitTests=true -DskipModuleFunctionalTests=true -Dtests.max-container-count=5 -DdockerfileName=Dockerfile --file extra/pom.xml
36 changes: 36 additions & 0 deletions .github/workflows/pr-module-functional-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Module functional tests

on:
pull_request:
paths-ignore:
- 'docs/**'
- '.github/**'
branches:
- master
release:
types:
- created

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
java: [ 17 ]

steps:
- uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
cache: 'maven'
java-version: ${{ matrix.java }}

- name: Build with Maven
run: mvn package -DskipUnitTests=true --file extra/pom.xml

- name: Run module tests
run: mvn -B verify -DskipUnitTests=true -DskipFunctionalTests=true -Dtests.max-container-count=5 -DdockerfileName=Dockerfile-modules --file extra/pom.xml
44 changes: 44 additions & 0 deletions .github/workflows/release-asset-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish release .jar

on:
workflow_run:
workflows: [Publish release]
types:
- completed

jobs:
build:
name: Publish release .jar
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17 ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
cache: 'maven'
java-version: ${{ matrix.java }}

- name: Build base .jar via Maven
run: mvn clean package -Dcheckstyle.skip -Dmaven.test.skip=true
- name: Upload and attach base .jar to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/prebid-server.jar
asset_name: prebid-server-${{ github.ref_name }}.jar
tag: ${{ github.ref }}

- name: Build bundled .jar via Maven
run: mvn clean package --file extra/pom.xml -Dcheckstyle.skip -Dmaven.test.skip=true
- name: Upload and attach bundled .jar to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: extra/bundle/target/prebid-server-bundle.jar
asset_name: prebid-server-bundle-${{ github.ref_name }}.jar
overwrite: true
tag: ${{ github.ref }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ target/
.DS_Store

.allure/
src/main/proto/
15 changes: 15 additions & 0 deletions Dockerfile-modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM amazoncorretto:17

WORKDIR /app/prebid-server

VOLUME /app/prebid-server/conf
VOLUME /app/prebid-server/data

COPY src/main/docker/run.sh ./
COPY src/main/docker/application.yaml ./
COPY target/prebid-server-bundle.jar ./prebid-server.jar

EXPOSE 8080
EXPOSE 8060

ENTRYPOINT [ "/app/prebid-server/run.sh" ]
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,28 @@ Run your local server with the command:
```bash
java -jar target/prebid-server.jar --spring.config.additional-location=sample/prebid-config.yaml
```

For more options how to start the server, please follow [documentation](docs/run.md).

## Running prebuilt .jar
Starting from PBS Java v2.9, you can download prebuilt .jar packages from [Release Notes](https://github.com/prebid/prebid-server-java/releases) page, instead of building them by yourself.
This prebuilt packages are delivered with or without extra modules.

## Verifying

To check the server is started go to [http://localhost:8080/status](http://localhost:8080/status)
and verify response status is `200 OK`.

There are a couple of 'hello world' test requests described in sample/requests/README.txt

## Running Docker image

Starting from PBS Java v2.9, you can download prebuilt Docker images from [GitHub Packages](https://github.com/orgs/prebid/packages?repo_name=prebid-server-java) page,
and use them instead of plain .jar files. This prebuilt images are delivered with or without extra modules.

In order to run such image correctly, you should attach PBS config file. Easiest way is to mount config file into container,
using [--mount or --volume (-v) Docker CLI arguments](https://docs.docker.com/engine/reference/commandline/run/).
Keep in mind, that config file should be mounted into specific location: ```/app/prebid-server/``` or ```/app/prebid-server/conf/```.

# Documentation

## Development
Expand Down
7 changes: 6 additions & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

<module name="NewlineAtEndOfFile"/>
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileLength">
<property name="max" value="2024"/>
</module>
<module name="FileTabCharacter"/>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
Expand Down Expand Up @@ -46,6 +48,9 @@
<module name="ConstantName">
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|(.*?)[l,L]ogger)$"/>
</module>
<module name="FinalLocalVariable">
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
Expand Down
26 changes: 23 additions & 3 deletions docs/application-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ There are two ways to configure application settings: database and file. This do
the bid and log an operational warning.
- `auction.events.enabled` - enables events for account if true
- `auction.debug-allow` - enables debug output in the auction response. Default `true`.
- `auction.targeting.includewinners` - whether to include targeting for the winning bids in response. Default `false`.
- `auction.targeting.includebidderkeys` - whether to include targeting for the best bid from each bidder in response. Default `false`.
- `auction.targeting.includeformat` - whether to include the “hb_format” targeting key. Default `false`.
- `auction.targeting.preferdeals` - if targeting is returned and this is `true`, PBS will choose the highest value deal before choosing the highest value non-deal. Default `false`.
- `auction.targeting.alwaysincludedeals` - PBS-Java only. If true, generate `hb_ATTR_BIDDER` values for all bids that have a `dealid`. Default to `false`.
- `auction.targeting.prefix` - defines prefix for targeting keywords. Default `hb`.
Keep in mind following restrictions:
- this prefix value may be overridden by correspond property from bid request
- prefix length is limited by `auction.truncate-target-attr`
- if custom prefix may produce keywords that exceed `auction.truncate-target-attr`, prefix value will drop to default `hb`
- `privacy.ccpa.enabled` - enables gdpr verifications if true. Has higher priority than configuration in application.yaml.
- `privacy.ccpa.channel-enabled.web` - overrides `ccpa.enforce` property behaviour for web requests type.
- `privacy.ccpa.channel-enabled.amp` - overrides `ccpa.enforce` property behaviour for amp requests type.
Expand Down Expand Up @@ -49,7 +59,7 @@ There are two ways to configure application settings: database and file. This do
- `analytics.modules.<module-name>.*` - space for `module-name` analytics module specific configuration, may be of any shape
- `cookie-sync.default-timeout-ms` - overrides host level config
- `cookie-sync.default-limit` - if the "limit" isn't specified in the `/cookie_sync` request, this is what to use
- `cookie-sync.pri` - a comma-separated list of prioritized cookie families
- `cookie-sync.pri` - a list of prioritized bidder codes
- `cookie-sync.max-limit` - if the "limit" is specified in the `/cookie_sync` request, it can't be greater than this
value
- `cookie-sync.coop-sync.default` - if the "coopSync" value isn't specified in the `/cookie_sync` request, use this
Expand Down Expand Up @@ -108,6 +118,13 @@ Here's an example YAML file containing account-specific settings:
enabled: true
price-floors:
enabled: false
targeting:
includewinners: false
includebidderkeys: false
includeformat: false
preferdeals: false
alwaysincludedeals: false
prefix: hb
debug-allow: true
metrics:
verbosity-level: basic
Expand Down Expand Up @@ -205,7 +222,8 @@ Here's an example YAML file containing account-specific settings:
cookie-sync:
default-limit: 5
max-limit: 8
default-coop-sync: true
coop-sync:
default: true
```
## Setting Account Configuration in the Database
Expand Down Expand Up @@ -409,7 +427,9 @@ example:
"cookie-sync": {
"default-limit": 5,
"max-limit": 8,
"default-coop-sync": true
"coop-sync": {
"default": true
}
}
}
```
Expand Down
16 changes: 16 additions & 0 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,19 @@ mvn clean package
```bash
mvn clean package --file extra/pom.xml
```

## Common problems
For IntelliJ IDEA users, if IDEA can't resolve proto classes:
First of all, you need to compile these files. They are compiled from .proto files located in src.main.proto. This can be done by running the mvn protobuf:compile command in your terminal or by clicking in IntelliJ IDEA:
Maven > prebid-server > Plugins > protobuf > protobuf:compile.

This step is also performed during the compile (and test-compile for tests) phase of Maven if you build the app using Maven directly.

After that, you can build and run the application via IntelliJ IDEA. However, IntelliJ IDEA will not recognize these files with its default settings yet, and it will still report an error even though the application can be compiled. This is because intellisense does not introspect large files by default, and the compiled classes from proto files are much larger than the default classes.

Here is how to resolve this:
In IntelliJ IDEA, click `Help > Edit custom properties...` and add modify any of these properties(in kilobytes):
`idea.max.content.load.filesize=your-value-here`(for example, `idea.max.content.load.filesize=200000`) - increases max file size that IDEA is able to open
`idea.max.intellisense.filesize=your-value-here`(for example, `idea.max.intellisense.filesize=200000`) - increases max file size for coding assistance and design-time code inspection.

You can find more information about these properties here: https://www.jetbrains.com/help/objc/configuring-file-size-limit.html
1 change: 0 additions & 1 deletion docs/config-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ Removes and downloads file again if depending service cant process probably corr
- `auction.cache.expected-request-time-ms` - approximate value in milliseconds for Cache Service interacting.
- `auction.cache.only-winning-bids` - if equals to `true` only the winning bids would be cached. Has lower priority than request-specific flags.
- `auction.generate-bid-id` - whether to generate seatbid[].bid[].ext.prebid.bidid in the OpenRTB response.
- `auction.generate-source-tid` - whether to generate bidrequest.source.tid in the OpenRTB request.
- `auction.validations.banner-creative-max-size` - enables creative max size validation for banners. Possible values: `skip`, `enforce`, `warn`. Default is `skip`.
- `auction.validations.secure-markup` - enables secure markup validation. Possible values: `skip`, `enforce`, `warn`. Default is `skip`.
- `auction.host-schain-node` - defines global schain node that will be appended to `request.source.ext.schain.nodes` passed to bidders
Expand Down
Loading

0 comments on commit 2636a95

Please sign in to comment.