sidebar_position |
---|
1 |
These instructions are given for Linux environments and assume you have the following packages installed on your system and your user is in the sudoers list (can execute commands with root access using sudo). If you plan to contribute to the code, a GitHub account is also required to commit your change and/or make pull requests.
The following packages must be installed
Privacy Sandbox APIs use the domain name in the URL (site origin) to allow/block cross site data sharing, identify topics etc. Thus we cannot rely only on the "localhost" domain for development.
We will remap domain name to loopback address (127.0.0.1) so each service could be accessed via a URL like :
There are 2 ways to achieve that
- Remap hosts to loopback address by editing /etc/hosts on your local machine
Edit /etc/hosts
file
# /etc/hosts
127.0.0.1 privacy-sandbox-demos.dev
127.0.0.1 privacy-sandbox-demos-home.dev
127.0.0.1 privacy-sandbox-demos-dsp.dev
127.0.0.1 privacy-sandbox-demos-shop.dev
127.0.0.1 privacy-sandbox-demos-travel.dev
127.0.0.1 privacy-sandbox-demos-ssp.dev
127.0.0.1 privacy-sandbox-demos-news.dev
Verifying mapping with :
nslookup privacy-sandbox-demos-news.dev
If the mapping isn’t reflected in Chrome, try clearing your DNS cache
chrome://net-internals/#dns
- If you use Google Chrome, --host-resolver-rules flag can be used instead.
Start Google chrome with the following argument
google_chrome --host-resolver-rules="MAP privacy-sandbox-demos-* 127.0.0.1"
https://
scheme requires a valid certificate for your browser, this is done by using mkcert to create a local certification authority that will be trusted by your local browser. Later we will be creating a certificate for each of the privacy sandbox demos service and configure nginx to serve those certificates.
Run the command below to create the development Certificate Authority:
mkcert -install
- Fork https://github.com/privacysandbox/privacy-sandbox-demos and clone locally
- Setting up with npm scripts
# Download packages and dependencies :
$ npm install
# Generate the SSL Certificates for Nginx proxy service :
$ npm run cert
# Build and run the docker containers (docker must be run with root permission) :
$ sudo npm run start
- Open the home page: https://privacy-sandbox-demos-home.dev