Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme Update #3246

Merged
merged 47 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9e9b27f
Initial Commit
SyntaxNode Oct 8, 2021
65e2360
Work In Progress
SyntaxNode Oct 12, 2021
da46023
Draft 1
SyntaxNode Oct 3, 2023
c0980bf
Draft 2
SyntaxNode Oct 3, 2023
65ad8f5
Draft 3
SyntaxNode Oct 3, 2023
90a9bb1
Draft 4
SyntaxNode Oct 3, 2023
53107c6
Draft 5
SyntaxNode Oct 3, 2023
5c938b4
Getting Started
SyntaxNode Oct 3, 2023
2694da2
H1
SyntaxNode Oct 3, 2023
919a6c0
Remove BR
SyntaxNode Oct 3, 2023
528139f
Header Test
SyntaxNode Oct 3, 2023
d92a497
H1 Test
SyntaxNode Oct 3, 2023
6b189f0
Another Try 1
SyntaxNode Oct 3, 2023
2a3d167
DIV Again
SyntaxNode Oct 3, 2023
ec3e482
I'm Getting Tired Of Unique Comments
SyntaxNode Oct 3, 2023
ebd0f0e
Finally?
SyntaxNode Oct 3, 2023
383ebc7
Add Space
SyntaxNode Oct 3, 2023
4316899
Code of Conduct
SyntaxNode Oct 3, 2023
6af6104
Updates
SyntaxNode Oct 4, 2023
95d745c
Updates
SyntaxNode Oct 4, 2023
e2ea457
Importing Section
SyntaxNode Oct 4, 2023
0ef5e26
Updates
SyntaxNode Oct 6, 2023
99309a4
Hosting
SyntaxNode Oct 6, 2023
a1ac1d2
Everything But Contributing
SyntaxNode Oct 6, 2023
4425d74
Adapters
SyntaxNode Oct 6, 2023
f6f0a36
Update
SyntaxNode Oct 6, 2023
5bbd9bf
Updates
SyntaxNode Oct 6, 2023
ea26bae
Word Smithing
SyntaxNode Oct 12, 2023
0ac34a2
Remove outdated docs. These are just links.
SyntaxNode Oct 12, 2023
f15a90b
Updates
SyntaxNode Oct 21, 2023
fe07e06
Update configuration.md
SyntaxNode Oct 21, 2023
86fe06e
Update README.md
SyntaxNode Oct 21, 2023
85d1531
Update configuration.md
SyntaxNode Oct 21, 2023
8e7bfaf
Merge branch 'master' into readme_update
SyntaxNode Oct 25, 2023
8c21d5e
Update README.md
SyntaxNode Oct 25, 2023
0cf9a56
Add Code Style Section
SyntaxNode Oct 27, 2023
e1ddd1d
Update README.md
SyntaxNode Oct 27, 2023
eda648b
Update configuration.md
SyntaxNode Nov 15, 2023
54b3809
Update configuration.md
SyntaxNode Nov 15, 2023
936835a
Update README.md
SyntaxNode Jan 10, 2024
19b8203
Update configuration.md (WIP)
SyntaxNode Jan 10, 2024
4270a70
Update configuration.md (WIP)
SyntaxNode Jan 12, 2024
940bb97
Update configuration.md
SyntaxNode Jan 16, 2024
d1cd806
Update configuration.md
SyntaxNode Jan 16, 2024
61e287a
Update configuration.md
SyntaxNode Jan 16, 2024
c49cb38
Update configuration.md
SyntaxNode Jan 16, 2024
5287461
Fix Typo
SyntaxNode Jan 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 73 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,106 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/prebid/prebid-server?style=flat-square)](https://goreportcard.com/report/github.com/prebid/prebid-server)
![Go Version](https://img.shields.io/github/go-mod/go-version/prebid/prebid-server?style=flat-square)

# Prebid Server
<br />
<br />
<p align="center"><img alt="Prebid Server Logo" src="/static/pbs-logo.svg" style="width:80%; max-width:600px;"></p>
<br />

Prebid Server is an open source implementation of Server-Side Header Bidding.
It is managed by [Prebid.org](https://prebid.org/about/),
and upholds the principles from the [Prebid Code of Conduct](https://prebid.org/code-of-conduct/).
<a href="https://prebid.org/product-suite/prebid-server/">Prebid Server</a> is an open-source solution for running real-time advertising auctions in the cloud. This project is part of the <a href="https://prebid.org/">Prebid</a> ecosystem, seamlessly integrating with <a href="https://prebid.org/product-suite/prebidjs/">Prebid.js</a> and the <a href="https://prebid.org/product-suite/prebid-mobile/">Prebid Mobile SDKs</a> to deliver world-class header bidding for any ad format and for any type of digital media.

This project does not support the same set of Bidders as Prebid.js, although there is overlap.
The current set can be found in the [adapters](./adapters) package. If you don't see the one you want, feel free to [contribute it](https://docs.prebid.org/prebid-server/developers/add-new-bidder-go.html).
## Getting Started
- [What is Prebid Server](https://docs.prebid.org/prebid-server/overview/prebid-server-overview.html)
- [Intro to Header Bidding](https://docs.prebid.org/overview/intro-to-header-bidding.html)
- [Header Bidding with Prebid](https://docs.prebid.org/overview/intro.html#header-bidding-with-prebid)
- [API Endpoints](https://docs.prebid.org/prebid-server/endpoints/pbs-endpoint-overview.html)

## Configuring

For more information, see:
When hosting Prebid Server or developing locally, **you must set a default GDPR value**. This configuration determines whether GDPR is enabled when no regulatory signal is available in the request, where a value of `"0"` disables it by default and a value of `"1"` enables it. This is required as there is no consensus on a good default.
SyntaxNode marked this conversation as resolved.
Show resolved Hide resolved

- [What is Prebid?](https://docs.prebid.org/overview/intro.html)
- [Prebid Server Overview](https://docs.prebid.org/prebid-server/overview/prebid-server-overview.html)
- [Current Bidders](https://docs.prebid.org/dev-docs/pbs-bidders.html)
Refer to the [configuration guide](docs/developers/configuration.md) for additional information and a list of available configuration options.

Please consider [registering your Prebid Server](https://docs.prebid.org/prebid-server/hosting/pbs-hosting.html#optional-registration) to get on the mailing list for updates, etc.
## Hosting Prebid Server
> [!NOTE]
> Please consider [registering as a Prebid Server host](https://docs.prebid.org/prebid-server/hosting/pbs-hosting.html#optional-registration) to join the mailing list for updates and feedback.

## Installation
The quickest way to host Prebid Server is to deploy our [official Docker image](https://hub.docker.com/r/prebid/prebid-server). If you're hosting the container with Kubernetes, you can configure Prebid Server with environment variables [using a pod file](https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/) or [using a config map](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables). Alternatively, you can use a configuration file [embedded in a config map](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#populate-a-volume-with-data-stored-in-a-configmap) which Prebid Server will read from at the path `/etc/config`.

First install [Go](https://golang.org/doc/install) version 1.19 or newer.
For deploying a fork, you can create a custom Docker container using the command:
``` bash
docker build -t prebid-server .
Copy link
Contributor

@zhongshixi zhongshixi Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SyntaxNode I would suggest adding a note before we refactor the image into a state that is also ARM-friendly.

so I would suggest explicitly adding --platform linux/amd64 as part of the docker build command

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circling back to this after the winter break. Is the use case building a deployment container on an Apple processor MacBook?

```
or compile a standalone binary using the command:
``` bash
go build .
```
Ensure that you deploy the `/static` directory, as Prebid Server requires those files at startup.
SyntaxNode marked this conversation as resolved.
Show resolved Hide resolved

Note that prebid-server is using [Go modules](https://blog.golang.org/using-go-modules).
We officially support the most recent two major versions of the Go runtime. However, if you'd like to use a version <1.13 and are inside GOPATH `GO111MODULE` needs to be set to `GO111MODULE=on`.
## Developing

Download and prepare Prebid Server:
Prebid Server requires [Go](https://go.dev) version 1.19 or newer. You can develop on any operating system that Go supports; however, please note that our helper scripts are written in bash.

```bash
cd YOUR_DIRECTORY
git clone https://github.com/prebid/prebid-server src/github.com/prebid/prebid-server
cd src/github.com/prebid/prebid-server
1. Clone The Repository
``` bash
git clone git@github.com:prebid/prebid-server.git
cd prebid-server
```

Run the automated tests:
3. Download Dependencies
``` bash
go mod download
```

3. Verify Tests Pass
```bash
./validate.sh
```

Or just run the server locally:

4. Run The Server
```bash
go build .
./prebid-server
go run .
```

Run format:
```
make format
```
or
```bash
./scripts/format.sh -f true
```
SyntaxNode marked this conversation as resolved.
Show resolved Hide resolved
By default, Prebid Server will attach to port 8000. To confirm the server is running, visit `http://localhost:8000/` in your web browser.

### Code Style
To maintain consistency in the project's code, please:

- Follow the recommendations set by [Effective Go](https://go.dev/doc/effective_go). This article provides a comprehensive guide on how to write idiomatic Go code, covering topics such as naming and formatting. Many IDEs will automatically format your code upon save. If you need to manaully format your code, either run the bash script or execute the make step:
```
./scripts/format.sh -f true
```
```
make format
```

- Prefer small functions with descriptive names instead of complex functions with comments. This approach helps make the code more readable, maintainable, and testable.

- Do not discard errors. You should implement appropriate error handling, such as gracefully falling back to a default behavior or bubbling up an error.

### IDE Recommendation

Load the landing page in your browser at `http://localhost:8000/`.
For the full API reference, see [the endpoint documentation](https://docs.prebid.org/prebid-server/endpoints/pbs-endpoint-overview.html)
An option for developing Prebid Server in a reproducible environment isolated from your host OS is using Visual Studio Code with [Remote Container Setup](devcontainer.md). This is a recommendation, not a requirement. This approach is especially useful if you are developing on Windows, since the Remote Container runs within WSL providing you with the capability to execute bash scripts.

## Go Modules
## Importing Prebid Server

The packages within this repository are intended to be used as part of the Prebid Server compiled binary. If you
choose to import Prebid Server packages in other projects, please understand we make no promises on the stability
of exported types.
Prebid Server is not currently intended to be imported by other projects. Go Modules is used to manage dependencies, which also makes it possible to import Prebid Server packages. This is not supported. We offer no guarantees regarding the stability of packages and do not adhere to semantic versioning guidelines.

## Contributing
> [!IMPORTANT]
> All contributions must follow the [Prebid Code of Conduct](https://prebid.org/code-of-conduct/) and the [Prebid Module Rules](https://docs.prebid.org/dev-docs/module-rules.html).

Want to [add an adapter](https://docs.prebid.org/prebid-server/developers/add-new-bidder-go.html)? Found a bug? Great!
### Bid Adapter
Bid Adapters transform OpenRTB requests and responses for communicating with a bidding server. This may be as simple as a passthrough or as complex as mapping to a custom data model. We invite you to contribute an adapter for your company. Consult our guide on [building a bid adapter](https://docs.prebid.org/prebid-server/developers/add-new-bidder-go.html) for more information.

Report bugs, request features, and suggest improvements [on Github](https://github.com/prebid/prebid-server/issues).
### Analytics Module
Analytics Modules enable business intelligence tools to collect data from Prebid Server to provide publishers and hosts with valuable insights into their header bidding traffic. We welcome you to contribute a module for your platform. Refer to our guide on [building an analytics module](https://docs.prebid.org/prebid-server/developers/pbs-build-an-analytics-adapter.html) for further information.

Or better yet, [open a pull request](https://github.com/prebid/prebid-server/compare) with the changes you'd like to see.
### Auction Module
Auction Modules allow hosts to extend the behavior of Prebid Server at specfic spots in the auction pipeline using existing modules or by developing custom functionality. Auction Modules may provide creative validation, traffic optimization, and real time data services amoung many other potential uses. We welcome vendors and community members to contribute modules that publishers and hosts may find useful. Consult our guide on [building an auction module](https://docs.prebid.org/prebid-server/developers/add-a-module.html) for more information.

## IDE Recommendations
### Feature
We welcome everyone to contribute to this project by implementing a specification or by proposing a new feature. Please review the [prioritized project board](https://github.com/orgs/prebid/projects/4), where you can select an issue labeled "Ready For Dev". To avoid redundant effort, kindly leave a comment on the issue stating your intention to take it on. To propose a feature, [open a new issue](https://github.com/prebid/prebid-server/issues/new/choose) with as much detail as possible for consideration by the Prebid Server Committee.

The quickest way to start developing Prebid Server in a reproducible environment isolated from your host OS
is by using Visual Studio Code with [Remote Container Setup](devcontainer.md).
### Bug Fix
Bug reports may be submitted by [opening a new issue](https://github.com/prebid/prebid-server/issues/new/choose) and describing the error in detail with the steps to reproduce and example data. A member of the core development team will validate the bug and discuss next steps. You're encouraged to open an exploratory draft pull request to either demonstrate the bug by adding a test or offering a potential fix.
160 changes: 153 additions & 7 deletions docs/developers/configuration.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,160 @@
# Configuration

Configuration is handled by [Viper](https://github.com/spf13/viper), which supports [many ways](https://github.com/spf13/viper#why-viper) of setting config values.
Prebid Server is configured using environment variables, a `pbs.json` file, or a `pbs.yaml` file, in that order of precedence. Configuration files are read from either the application directory or `/etc/config`.

As a general rule, Prebid Server will log its resolved config values on startup and exit immediately if they're not valid.
Upon starting, Prebid Server logs the resolved configuration to standard out with passwords and secrets redacted. If there's an error with the configuration, the application will log the error and exit.

For development, it's easiest to define your config inside a `pbs.yaml` file in the project root.
# Sections
> [!IMPORTANT]
> As we are still developing this guide, please refer to the [configuration structures in code](../../config/config.go) for a complete definition of the options.

## Available options
- [General](#general)
- [Privacy](#privacy)
- [GDPR](#gdpr)

For now, see [the contract classes](../../config/config.go) in the code.

Also note that `Viper` will also read environment variables for config values. Prebid Server will look for the prefix `PBS_` on the environment variables, and map underscores (`_`)
to periods. For example, to set `host_cookie.ttl_days` via an environment variable, set `PBS_HOST_COOKIE_TTL_DAYS` to the desired value.
# General

### `external_url`
String value that specifies the external url to reach your Prebid Server instance. It's used for event tracking and user sync callbacks, and is shared with bidders in outgoing requests at `req.ext.prebid.server.externalurl`. Defaults to empty.

<details>
<summary>Example</summary>
<p>

JSON:
```
{
"external_url": "https://your-pbs-server.com"
}
```

YAML:
```
external_url: https://your-pbs-server.com
```

Environment Variable:
```
PBS_EXTERNAL_URL: https://your-pbs-server.com
```

</p>
</details>

### `host`
String value that specifies the address the server will listen to for connections. If the value is empty, Prebid Server will listen on all available addresses, which is a common configuration. This value is also used for the Prometheus endpoint, if enabled. Defaults to empty.

<details>
<summary>Example</summary>
<p>

JSON:
```
{
"host": "127.0.0.1"
}
```

YAML:
```
host: 127.0.0.1
```

Environment Variable:
```
PBS_HOST: 127.0.0.1
```

</p>
</details>

### `port`
Integer value that specifies the port the server will listen to for connections. Defaults to `8000`.

<details>
<summary>Example</summary>
<p>

JSON:
```
{
"port": 8000
}
```

YAML:
```
port: 8000
```

Environment Variable:
```
PBS_PORT: 8000
```

</p>
</details>

# Privacy

## GDPR

### `gdpr.enabled`
Boolean value that determines if GDPR processing for TCF signals is enabled. Defaults to `true`.
<details>
<summary>Example</summary>
<p>

JSON:
```
{
"gdpr": {
"enabled": true
}
}
```

YAML:
```
gdpr:
enabled: true
```

Environment Variable:
```
PBS_GDPR_ENABLED: true
```

</p>
</details>


### `gdpr.default_value` (required)
String value that determines whether GDPR is enabled when no regulatory signal is available in the request. A value of `"0"` disables it by default and a value of `"1"` enables it. This is a required configuration value with no default.
<details>
<summary>Example</summary>
<p>

JSON:
```
{
"gdpr": {
"default_value": "0"
}
}
```

YAML:
```
gdpr:
default_value: "0"
```

Environment Variable:
```
PBS_GDPR_DEFAULT_VALUE: 0
```

</p>
</details>
12 changes: 0 additions & 12 deletions docs/developers/features.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/endpoints.md

This file was deleted.

Loading