---
# System prepended metadata

title: Installing & Running Final Exam

---

# Installing & Running Final Exam

## feedback

- the cluster doesn't auto shutdown and can cost money
- need to install a websocked client and manually ping to find out whether a service is up without the AWS console
- document some kind of naming convention so that we can all work together nicely
- data warehousing for performance points and proper log management

## steps for final exam init

- `git clone https://github.com/holo-host/final-exam`
- `cd final-exam`
- `git submodule init`
- `git submodule update`

## steps for cluster spinup and shutdown

### prework

- make sure to get someone to put your ssh key on the host (`final-exam.holo.host`)

### steps

#### log in and choose/modify/create config file:
- `ssh ubuntu@final-exam.holo.host`
- `cd final-exam`
- `nix-shell`
- figure out what cluster you want (see `configs/aws-pool` files) e.g.:

```
$ more configs/aws-pool/eu_1.json
[
    {
        "service": "s2h",
        "domain": "vpc-public-zone",
        "subnet": "SubnetBPublic",
        "region": "eu-central-1",
        "runtime": "docker run -d -p 9000:9000 -e AWS_REGION=eu-central-1 -v /var/log/trycp:/tmp/trycp/conductors -p 5050-5070:5050-5070 024992937548.dkr.ecr.eu-central-1.amazonaws.com/holochain/holochain-rust:trycp_server.develop",        "instance_type" : "m5.large"
    },
    {
        "service": "t1",
        "domain": "vpc-public-zone",
        "subnet": "SubnetBPublic",
        "region": "eu-central-",
        "runtime": "docker run -d -p 9000:9000 -e AWS_REGION=eu-central-1 -v /var/log/trycp:/tmp/trycp/conductors -p 5050-5070:5050-5070 024992937548.dkr.ecr.eu-central-1.amazonaws.com/holochain/holochain-rust:trycp_server.develop",
        "instance_type" : "m5.large"
    }
]
```

when the domain is `vpc-public-zone` the actual domain translates to:
domain = `{{ service }}.{{ region }}.aws-holochain.org`
when the domain is `sim2h-public-zone` the actual domain translates to:
{{ service }}.sim2h.com`

Notee that the first item in the config list is ignored by final exam as an endpoint when running tests as it is assumed to be the sim2h_server for the tests, not a trycp endpoint

#### To spin up the pool:

```
AWS_DEFAULT_REGION=eu-central-1 scripts/create-pool.sh configs/aws-pool/eu_1.json
```

#### To shut down the pool:

```
AWS_DEFAULT_REGION=eu-central-1 scripts/delete-pool.sh configs/aws-pool/eu_1.json
```

NOTE: the AWS_DEFAULT_REGION is NOT the region where the nodes will run that's configured in the config file, that is the region the script runs which should allways be eu-central-1

#### node testing
confirm that the trycp server is working with following jsonrpc message to:
ws://t1.eu-central-1.holochain-aws.org:9000/
`{"jsonrpc":"2.0","method":"ping","params":{},"id":1004}`
Response should look like:
`{"jsonrpc":"2.0","result":"{\"HDK_VERSION\": \"0.0.40-alpha1\",\"HDK_HASH\": \"2ljpzz6f10bsww8sk5pwn9d2kz08cmm0\",\"BUILD_DATE\": \"2019-12-12 19:08:19\"}","id":1004}`

confirm that the sim2h_server is working using the sim2h-client message in `hc`:
```
hc sim2h-client -u wss://s2h.us-east-1.holochain-aws.org:9000 -m status
```

config/foo.json bar to configs/network/foo.json

# running an exam
- `cd final-exam`
- `nix-shell`
- `node run -c configs/foo.json`
https://hackmd.io/Jb5-G7ZUT6e_zaFU2WHusA?both


# steps for running final exam locally:

- cd into final-exam
- make yourself a set of config files for the test you wanna run for example make copies of and chane the values to things that work for botht the nodes you want to use and the run size 
    - `configs/sanity_zippy.json`
    - `configs/network/sim2h_zippy_9002.json`
    - `configs/stress/zippy/sanity.json`

- open two extra terminals one for running trycp with:
    - `clear; RUST_LOG=debug trycp_server -c --port-range 5000-6000`
   and another for sim2h with:
    - `clear; RUST_LOG=debug sim2h_server -p 9002 -s 20`

- make sure to have checked out the branch you want and built everything first:
    - `hc-conductor-install`
    - `hc-cli-install`
    - `hc-sim2h-server-install`
    - `hc-trycp-install`

Now to run the exam.  got your final exam terminal window and type:

- `node run -n -c configs/sanity_X.json`  or what ever you called your top-level config.  You should start seeing things in both the trycp and sim2h windows.

# Logging into an amazon node.

Example:
```
ssh -i ~/.ssh/us-east-1-ec2-stress-test.pem ec2-user@tests1.us-east-1.holochain-aws.org
```