Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding doc to setup the agent on linux #227

Merged
merged 3 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
|**[Benchmarking local applications](local_application.md)** | Send local application source to the agent.
|**[Benchmarking Docker containers](benchmarking_docker.md)** | Run Docker containers.
|**[Running micro-benchmarks](microbenchmarks.md)** | Run BenchmarkDotNet benchmarks.
|**[Setting up an agent on Linux](setup_linux.md)** | How to install and update the agent on a Linux machines.

## Guides

Expand Down
74 changes: 74 additions & 0 deletions docs/setup_linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
## Setting up an agent on Linux

On Linux, it is recommended to setup the Agent using the Docker file provided in this repository.
There instructions are valid for x86 and arm.
sebastienros marked this conversation as resolved.
Show resolved Hide resolved

### Installing Docker

- Install docker from the automated script

```
curl -sSL https://get.docker.com | sh
```

- Add the local account to the docker user group so that you can execute docker commands without sudo

```
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
```

- Reopen the session with the account
- Check Docker is running

```
docker run hello-world
```

### Starting the Agent

- Clone the `crank` repository

```
mkdir ~/src
cd ~/src
git clone https://github.com/dotnet/crank
```

- Build and run the Agent docker image

```
cd ~/src/crank/docker/agent
./build.sh
./run.sh
```

This will build the image with all the dependencies (perfcollect, ...) and start a container named `crank-agent`.
To stop the container, run `./stop.sh`

### Displaying the agent log

To display the live log, run the following command:

```
docker logs -f --tail 100 crank-agent
```

### Continuous integration

In order to restart and update the agent regularly, the follow cron job can be used.
sebastienros marked this conversation as resolved.
Show resolved Hide resolved

- Edit the crontab file:

```
crontab -e
```

- Add this entry:

```
0 0 * * * cd [PATH_TO_CRANK]/src/crank/docker/agent; ./stop.sh; docker rm -f $(docker ps -a -q --filter "label=benchmarks"); docker system prune --all --force --volumes; git checkout -f master; git pull; ./build.sh; ./run.sh
```

This will stop any running agent, clean all docker images used to run benchmarks, update the GitHub repositor, build and restart the agent image.