Skip to content

Commit

Permalink
NOISSUE - Run Manager using Systemd Docs (#42)
Browse files Browse the repository at this point in the history
* docs for starting manager as a service

Signed-off-by: WashingtonKK <[email protected]>

* use makefile to start manager

Signed-off-by: WashingtonKK <[email protected]>

* add instructions for sev-snp

Signed-off-by: WashingtonKK <[email protected]>

---------

Signed-off-by: WashingtonKK <[email protected]>
  • Loading branch information
WashingtonKK authored Sep 16, 2024
1 parent 66171a2 commit e1e8905
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions docs/manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,37 +86,47 @@ NB: we set environment variables that we will use in the shell process where we

## Deployment

To start the service, execute the following shell script (note a server needs to be running see [here](https://github.com/ultravioletrs/cocos/tree/main/test/computations)):
To start the service, execute the following shell script (note a server needs to be running see [here](https://github.com/ultravioletrs/cocos/tree/main/test/computations)). Additionally, the required environment variables should be set in [cocos-manager.env](https://github.com/ultravioletrs/cocos/blob/main/cocos-manager.env) beforehand.

```bash
# download the latest version of the service
go get github.com/ultravioletrs/cocos

cd $GOPATH/src/github.com/ultravioletrs/cocos
```

# compile the manager
make manager
Variables should be set at this point in [cocos-manager.env](https://github.com/ultravioletrs/cocos/blob/main/cocos-manager.env).

# copy binary to bin
```bash
# builds binaries, copies them to bin and installs the env variables required for manager
make install

# set the environment variables and run the service
MANAGER_GRPC_URL=localhost:7001
MANAGER_LOG_LEVEL=debug \
MANAGER_QEMU_USE_SUDO=false \
MANAGER_QEMU_ENABLE_SEV=false \
./build/cocos-manager
# run the service
make run
```

To enable [AMD SEV](https://www.amd.com/en/developer/sev.html) support, start manager like this
To enable [AMD SEV](https://www.amd.com/en/developer/sev.html) support, start manager after setting these environment variables in [cocos-manager.env](https://github.com/ultravioletrs/cocos/blob/main/cocos-manager.env).

```sh
MANAGER_GRPC_URL=localhost:7001
MANAGER_LOG_LEVEL=debug \
MANAGER_QEMU_USE_SUDO=true \
MANAGER_QEMU_ENABLE_SEV=true \
MANAGER_QEMU_SEV_CBITPOS=51 \
./build/cocos-manager
```bash
MANAGER_QEMU_USE_SUDO=true
MANAGER_QEMU_ENABLE_SEV=true
MANAGER_QEMU_SEV_CBITPOS=51
```

You can also enable SEV_SNP through the environment variable:

```bash
MANAGER_QEMU_ENABLE_SEV_SNP=false
```

Then install the service:

```bash
# install the service with the environment variables
sudo make install

# start the service
sudo make run
```

### Verifying VM Launch
Expand All @@ -130,7 +140,7 @@ go run ./test/computations/main.go <algo-path> <public-key-path> <attested-tls-b
and in the second the manager by executing (with the environment variables of choice):

```bash
./build/cocos-manager
sudo make run
```

Ensure that the Manager can connect to the computations server by setting the MANAGER_GRPC_URL with the url value of the computations server. In the last terminal window, you can run the verification commands.
Expand All @@ -155,3 +165,13 @@ root 37989 122 13.1 5345816 4252312 pts/0 Sl+ 16:19 0:04 /usr/local/bi
```

The two processes are due to the fact that we run the command `/usr/bin/qemu-system-x86_64` as `sudo`, so there is one process for `sudo` command and the other for `/usr/bin/qemu-system-x86_64`.

You can view logs from manager using the following commands:

```bash
# check manager status
sudo systemctl status cocos-manager

# follow logs from manager
journalctl -u cocos-manager -n 20 -f
```

0 comments on commit e1e8905

Please sign in to comment.