|
1 | | -# potsi |
| 1 | +# Trusted Server |
2 | 2 |
|
3 | | -# Installation |
| 3 | +:information_source: At this time, Trusted Server is designed to work with Fastly. Follow these steps to configure Fastly Compute and deploy it. |
4 | 4 |
|
5 | | -## Pre-requisites |
| 5 | +## Fastly |
| 6 | +- Create account at Fastly if you don’t have one - manage.fastly.com |
| 7 | +- Log in to the Fastly control panel. |
| 8 | + - Go to Account > API tokens > Personal tokens. |
| 9 | + - Click Create token |
| 10 | + - Name the Token |
| 11 | + - Choose User Token |
| 12 | + - Choose Global API Access |
| 13 | + - Choose what makes sense for your Org in terms of Service Access |
| 14 | + - Copy key to a secure location because you will not be able to see it again |
| 15 | + |
| 16 | +- Create new Compute Service |
| 17 | + - Click Compute and Create Service |
| 18 | + - Click “Create Empty Service” (below main options) |
| 19 | + - Add your domain of the website you’ll be testing or using and click update |
| 20 | + - Click on “Origins” section and add your ad-server / ssp partner information as hostnames (note after you save this information you can select port numbers and TLS on/off) |
| 21 | + - IMPORTANT: when you enter the FQDN or IP ADDR information and click Add you need to enter a “Name” in the first field that will be referenced in your code so something like “my_ad_partner_1” |
| 22 | + - |
| 23 | + |
| 24 | +:warning: Fastly gives you a test domain to play on but obviously you’re free to create a CNAME to your domain when you’re ready. Note that Fastly compute ONLY accepts client traffic from TLS |
| 25 | + |
| 26 | +## Installation |
| 27 | + |
| 28 | +### Brew |
| 29 | + |
| 30 | +:warning: Follow the prompts before and afterwards (to configure system path, etc) |
| 31 | + |
| 32 | +#### Install Brew |
6 | 33 |
|
7 | | -### asdf |
8 | 34 | ```sh |
9 | | -brew install asdf |
| 35 | +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
10 | 36 | ``` |
| 37 | +### Fastly CLI |
11 | 38 |
|
12 | | -### Fastly |
| 39 | +#### Install Fastly CLI |
13 | 40 | ```sh |
14 | 41 | brew install fastly/tap/fastly |
15 | 42 | ``` |
16 | 43 |
|
17 | | -## rust |
| 44 | +#### Verify Installation and Version |
| 45 | +```sh |
| 46 | +fastly version |
| 47 | +``` |
| 48 | + |
| 49 | +#### Create profile and follow interactive prompt for pasting your API Token created earlier: |
| 50 | +```sh |
| 51 | +fastly profile create |
| 52 | +``` |
| 53 | + |
| 54 | +### Rust |
| 55 | + |
| 56 | +#### Install Rust with asdf |
18 | 57 | ```sh |
| 58 | +brew install asdf |
19 | 59 | asdf plugin add rust |
20 | 60 | asdf install rust 1.83.0 |
21 | 61 | asdf reshim |
22 | 62 | ``` |
23 | 63 |
|
24 | | -## viceroy (for running tests) |
| 64 | +#### Fix path for Bash |
| 65 | + |
| 66 | +Edit ~/.bash_profile to add path for asdf shims: |
25 | 67 | ```sh |
26 | | -cargo install viceroy |
| 68 | +export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" |
| 69 | +``` |
| 70 | + |
| 71 | +#### Fix path for ZSH |
| 72 | + |
| 73 | +Edit ~/.zshrc to add path for asdf shims: |
| 74 | +```sh |
| 75 | +export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" |
27 | 76 | ``` |
28 | 77 |
|
29 | | -## Build |
| 78 | +#### Other shells |
| 79 | +See https://asdf-vm.com/guide/getting-started.html#_2-configure-asdf |
| 80 | + |
| 81 | + |
| 82 | +### Configure Build and |
| 83 | + |
| 84 | +#### Clone Project |
| 85 | +```sh |
| 86 | +git clone [email protected]:IABTechLab/trusted-server.git |
| 87 | +``` |
| 88 | + |
| 89 | +### Configure |
| 90 | +#### Edit configuration files |
| 91 | +:information_source: Note that you’ll have to edit the following files for your setup: |
| 92 | + |
| 93 | +- fastly.toml (service ID, author, description) |
| 94 | +- Potsi.toml (KV store ID names) |
| 95 | + |
| 96 | +### Build |
30 | 97 |
|
31 | 98 | ```sh |
32 | 99 | cargo build |
33 | 100 | ``` |
34 | 101 |
|
35 | | -## Run |
| 102 | +### Deploy to Fastly |
36 | 103 |
|
37 | | -### Fastly |
38 | | -- Review configuration for [local_server](fastly.toml#L16) |
| 104 | +```sh |
| 105 | +fastly compute publish |
| 106 | +``` |
39 | 107 |
|
40 | | -- Run it with |
| 108 | +## Devleopment |
41 | 109 |
|
| 110 | +#### Install viceroy for running tests |
42 | 111 | ```sh |
43 | | -fastly -i compute serve |
| 112 | +cargo install viceroy |
44 | 113 | ``` |
45 | 114 |
|
46 | | -## Test |
| 115 | +#### Run Fastly server locally |
| 116 | +Review configuration for [local_server](fastly.toml#L16) |
| 117 | +```sh |
| 118 | +fastly -i compute serve |
47 | 119 | ``` |
| 120 | + |
| 121 | +#### Tests |
| 122 | +```sh |
48 | 123 | cargo test |
49 | 124 | ``` |
50 | 125 |
|
51 | | -Note: if test fails `viceroy` will not display line number of the failed test. Rerun it with `cargo test_details`. |
| 126 | +:warning: if test fails `viceroy` will not display line number of the failed test. Rerun it with `cargo test_details`. |
52 | 127 |
|
53 | | -## Additional Rust Commands |
| 128 | +#### Additional Rust Commands |
54 | 129 | - `cargo fmt`: Ensure uniform code formatting |
55 | 130 | - `cargo clippy`: Ensure idiomatic code |
56 | 131 | - `cargo check`: Ensure compilation succeeds on Linux, MacOS, Windows and WebAssembly |
|
0 commit comments