Skip to content
Closed
Changes from all commits
Commits
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
99 changes: 57 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,72 @@
# potsi
Steps to install Trusted Server

# Installation
FASTLY COMPUTE SETUP on Mac OS

## Pre-requisites
- Create account at Fastly if you don’t have one - manage.fastly.com

### asdf
```sh
brew install asdf
```
- Log in to the Fastly control panel. Go to Account > API tokens > Personal tokens.
- Click Create token
- Name the Token
- Choose User Token
- Choose Global API Access
- Choose what makes sense for your Org in terms of Service Access
- Copy key to a secure location because you will not be able to see it again

### Fastly
```sh
brew install fastly/tap/fastly
```
- Create new Compute Service
- Click Compute and Create Service
- Click “Create Empty Service” (below main options)
- Add your domain of the website you’ll be testing or using and click update
- 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)
- 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”
-

## rust
```sh
asdf plugin add rust
asdf install rust 1.83.0
asdf reshim
```
NOTE: 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 

 -
- Install Brew if you don’t have it. Open terminal and paste the following and follow the prompts before and afterwards (to configure system path, etc): 
 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

## viceroy (for running tests)
```sh
cargo install viceroy
```
- Install Fastly CLI

brew install fastly/tap/fastly

## Build
- Verify Installation and Version

fastly version

```sh
cargo build
```
- Create profile and follow interactive prompt for pasting your API Token created earlier:
fastly profile create

## Run
INSTALL RUST using asdf on Mac

### Fastly
- Review configuration for [local_server](fastly.toml#L16)
brew install asdf
asdf plugin add rust
asdf install rust 1.83.0
asdf reshim

- Run it with
- Edit .zshrc profile to add path for asdf shims:

```sh
fastly -i compute serve
```
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

## Test
```
cargo test
```

Note: if test fails `viceroy` will not display line number of the failed test. Rerun it with `cargo test_details`.
CREATE FASTLY COMPUTE SERVICE

- Follow prompts with information and choose Rust and an empty starter kit option
Fastly compute init


CLONE PROJECT from GH

git clone https://<username>@github.com/IABTechLab/trusted-server.git

- This will give you important files such as .tool-versions that you’ll need to run some commands
- Note that you’ll have to edit the following files for your setup:
- fastly.toml (service ID, author, description)
- Potsi.toml (KV store ID names)




FASTLY SERVICE CONFIGURATION

- Begin in the UI at manage.fastly.com
- Click Compute -> Create Service
-

## Additional Rust Commands
- `cargo fmt`: Ensure uniform code formatting
- `cargo clippy`: Ensure idiomatic code
- `cargo check`: Ensure compilation succeeds on Linux, MacOS, Windows and WebAssembly
- `cargo bench`: Run all benchmarks