Skip to content
Merged
Show file tree
Hide file tree
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
44 changes: 25 additions & 19 deletions dashboard/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
# Updating dashboard
# Sanitizer Dashboard

To build a new binary and upload it to the GCE instance:
The dashboard is automatically built and updated from `master` on the GCE instance via [`start_script.sh`](start_script.sh).

```
go build --ldflags '-linkmode external -extldflags=-static' && \
gcloud compute ssh --project "sanitizer-bots" --zone "us-east1-d" dashboard-v2 --command "sudo rm -f /opt/sanitizers" && \
gcloud compute --project "sanitizer-bots" scp --zone "us-east1-d" sanitizers "dashboard-v2:/opt" && \
gcloud compute ssh --project "sanitizer-bots" --zone "us-east1-d" dashboard-v2 --command "sudo chown root:root /opt/sanitizers"
```

or
## Creating the GCE instance

```bash
gcloud compute instances create dashboard-v3 \
--project="sanitizer-bots" \
--zone="us-east1-d" \
--machine-type="e2-micro" \
--network-tier="STANDARD" \
--address="35.207.33.19" \
--tags="http-server,https-server" \
--no-service-account \
--no-scopes \
--shielded-secure-boot \
--shielded-vtpm \
--shielded-integrity-monitoring \
--image-family="debian-13" \
--image-project="debian-cloud" \
--boot-disk-size="10GB" \
--metadata=startup-script='#! /bin/bash
command -v curl >/dev/null || (apt-get -qq update && apt-get -qq install -y curl)
while true; do
curl -fsSL https://raw.githubusercontent.com/google/sanitizers/master/dashboard/start_script.sh | bash >/var/log/sanitizer-dashboard.log 2>&1
sleep 600
done'
```
go build --ldflags '-linkmode external -extldflags=-static' && \
gcloud compute config-ssh --remove && gcloud compute config-ssh --force-key-file-overwrite && \
ssh dashboard-v2.us-east1-d.sanitizer-bots "sudo rm -f /opt/sanitizers" && \
scp sanitizers "dashboard-v2.us-east1-d.sanitizer-bots:/opt" && \
ssh dashboard-v2.us-east1-d.sanitizer-bots "sudo chown root:root /opt/sanitizers"
```

Note: If you get a message about "scp: /opt/sanitizers: Text file busy", wait a
few seconds and try again.
29 changes: 29 additions & 0 deletions dashboard/start_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail

if ! command -v go >/dev/null || ! command -v git >/dev/null || ! command -v lighttpd >/dev/null; then
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
apt-get -qq install -y golang-go git curl lighttpd
rm -f /var/www/html/index.lighttpd.html
fi

export HOME="${HOME:-/root}"
REPO_DIR="/tmp/sanitizer-dashboard/sanitizers"

if [[ ! -d "${REPO_DIR}/.git" ]]; then
rm -rf "${REPO_DIR}"
mkdir -p "$(dirname "${REPO_DIR}")"
git clone --depth=1 https://github.com/google/sanitizers.git "${REPO_DIR}"
else
git -C "${REPO_DIR}" fetch --depth=1 origin master
git -C "${REPO_DIR}" reset --hard FETCH_HEAD
fi

cd "${REPO_DIR}/dashboard"
go build -o /opt/sanitizers .

mkdir -p /var/www/html
/opt/sanitizers > /var/www/html/index.new.html
chmod 644 /var/www/html/index.new.html
mv -f /var/www/html/index.new.html /var/www/html/index.html
Loading