Skip to content

Commit

Permalink
Merge pull request #313 from weaveworks/311-scope-0.13
Browse files Browse the repository at this point in the history
Update to Scope 0.13
  • Loading branch information
Alfonso Acosta committed Mar 4, 2016
2 parents 97da925 + ac991fa commit 5efb038
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 18 deletions.
7 changes: 4 additions & 3 deletions app-mapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

const (
defaultAppImage = "weaveworks/scope:0.10.0"
defaultAppImage = "weaveworks/scope:0.13.1"
defaultDBURI = "postgres://postgres@app-mapper-db/app_mapper?sslmode=disable"
)

Expand Down Expand Up @@ -98,13 +98,13 @@ func (f *flags) makeAppProvisioner() appProvisioner {

var p appProvisioner

args := []string{"--no-probe"}

args := []string{"--no-probe", "--app.weave.addr="}
switch f.appProvisioner {
case "docker":
options := dockerProvisionerOptions{
appConfig: docker.Config{
Image: f.dockerAppImage,
Env: []string{"CHECKPOINT_DISABLE=true"},
Cmd: args,
},
hostConfig: docker.HostConfig{},
Expand All @@ -120,6 +120,7 @@ func (f *flags) makeAppProvisioner() appProvisioner {
appContainer: kapi.Container{
Name: "scope",
Image: f.dockerAppImage,
Env: []kapi.EnvVar{{Name: "CHECKPOINT_DISABLE", Value: "true"}},
Args: args,
Ports: []kapi.ContainerPort{
{ContainerPort: scope.AppPort}},
Expand Down
21 changes: 19 additions & 2 deletions app-mapper/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,35 @@ func (p proxy) registerHandlers(router *mux.Router) {
p.forwardRequest(w, r, orgID)
},
)
// We believe forwards to /api/topology/{topology}/ws will normally have
// very high latencies. We separate that endpoint from the general
// We believe forwards to websocket endpoints
// /api/topology/{topology}/ws and /api/pipe/{pipeID} will normally have
// very high latencies. We separate those endpoint from the general
// PathPrefix in order to give it a special name, which we exclude from
// the latency alerting rules in our monitoring. See service #291.
router.Path("/api/app/{orgName}/api/topology/{topology}/ws").Name("api_app_topology_ws").Handler(fwd)
router.Path("/api/app/{orgName}/api/pipe/{pipeID}").Name("api_app_pipe").Handler(fwd)
router.PathPrefix("/api/app/{orgName}/").Name("api_app").Handler(fwd)

router.Path("/api/control/ws").Name("api_control").Handler(authProbeHandler(p.authenticator,
func(w http.ResponseWriter, r *http.Request, orgID string) {
p.forwardRequest(w, r, orgID)
},
))

// Pipe deletion from probe
router.Path("/api/pipe/{pipeID}").Methods("DELETE").Name("api_probe_pipe_delete").Handler(authProbeHandler(p.authenticator,
func(w http.ResponseWriter, r *http.Request, orgID string) {
p.forwardRequest(w, r, orgID)
},
))

// Pipe websocket from probe
router.Path("/api/pipe/{pipeID}/probe").Name("api_probe_pipe").Handler(authProbeHandler(p.authenticator,
func(w http.ResponseWriter, r *http.Request, orgID string) {
p.forwardRequest(w, r, orgID)
},
))

router.Path("/api/report").Name("api_report").Handler(authProbeHandler(p.authenticator,
func(w http.ResponseWriter, r *http.Request, orgID string) {
if probeID := r.Header.Get(scope.ScopeProbeIDHeader); probeID == "" {
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/organization/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default class OrganizationPage extends React.Component {
</div>
<Box>
<div style={styles.code}>
<div>sudo wget -O /usr/local/bin/scope \<br />&nbsp;&nbsp;https://github.com/weaveworks/scope/releases/download/v0.10.0/scope</div>
<div>sudo wget -O /usr/local/bin/scope \<br />&nbsp;&nbsp;https://github.com/weaveworks/scope/releases/download/v0.13.1/scope</div>
<div>sudo chmod a+x /usr/local/bin/scope</div>
<div>sudo scope launch --service-token={this.state.probeToken}</div>
</div>
Expand Down
9 changes: 7 additions & 2 deletions frontend/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ server {
proxy_pass http://app-mapper.default.svc.cluster.local$request_uri;
}

# topology (from UI) and control (from probe) websockets
location ~ ^/api/(app/[^/]+/api/topology/[^/]+|control)/ws {
# pipe delete requests from probe
location ~ ^/api/pipe/pipe-[^/]+$ {
proxy_pass http://app-mapper.default.svc.cluster.local$request_uri;
}

# topology (from UI), pipe (from both UI and probe) and control (from probe) websockets
location ~ ^/api/(app/[^/]+/api/(topology/[^/]+/ws|pipe/pipe-[^/]+)|pipe/pipe-[^/]+/probe|control/ws)$ {
proxy_pass http://app-mapper.default.svc.cluster.local$request_uri;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
Expand Down
6 changes: 5 additions & 1 deletion k8s/dev/scope/scope-app-rc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ spec:
spec:
containers:
- name: weave-scope-app
image: weaveworks/scope:0.13.0
image: weaveworks/scope:0.13.1
env:
- name: CHECKPOINT_DISABLE
value: "true"
args:
- --no-probe
- --app.weave.addr=
- --debug
ports:
- containerPort: 4040
Expand Down
6 changes: 5 additions & 1 deletion k8s/dev/scope/scope-probe-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ spec:
hostNetwork: true
containers:
- name: weave-scope-probe
image: weaveworks/scope:0.13.0
image: weaveworks/scope:0.13.1
env:
- name: CHECKPOINT_DISABLE
value: "true"
args:
- --no-app
- --probe.docker.bridge=cbr0
- --probe.docker=true
- --probe.kubernetes=true
- --probe.weave.router.addr=
- --debug

# We cannot refer to the Scope App with its Kubernetes Service
Expand Down
6 changes: 5 additions & 1 deletion k8s/local/scope/scope-app-rc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ spec:
spec:
containers:
- name: weave-scope-app
image: weaveworks/scope:0.11.1
image: weaveworks/scope:0.13.1
env:
- name: CHECKPOINT_DISABLE
value: "true"
args:
- --no-probe
- --app.weave.addr=
ports:
- containerPort: 4040
hostPort: 4040
6 changes: 5 additions & 1 deletion k8s/local/scope/scope-probe-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ spec:
hostNetwork: true
containers:
- name: weave-scope-probe
image: weaveworks/scope:0.11.1
image: weaveworks/scope:0.13.1
env:
- name: CHECKPOINT_DISABLE
value: "true"
args:
- --no-app
- --probe.docker=true
- --probe.kubernetes=true
- --probe.weave.router.addr=
# We cannot refer to the Scope App with its Kubernetes Service
# DNS name (weave-scope-app) directly because Docker doesn't
# allow customizing the DNS servers (the Kubernetes DNS add-on
Expand Down
6 changes: 5 additions & 1 deletion k8s/prod/scope/scope-app-rc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ spec:
spec:
containers:
- name: weave-scope-app
image: weaveworks/scope:0.13.0
image: weaveworks/scope:0.13.1
env:
- name: CHECKPOINT_DISABLE
value: "true"
args:
- --no-probe
- --app.weave.addr=
ports:
- containerPort: 4040
hostPort: 4040
6 changes: 5 additions & 1 deletion k8s/prod/scope/scope-probe-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ spec:
hostNetwork: true
containers:
- name: weave-scope-probe
image: weaveworks/scope:0.13.0
image: weaveworks/scope:0.13.1
env:
- name: CHECKPOINT_DISABLE
value: "true"
args:
- --no-app
- --probe.docker.bridge=cbr0
- --probe.docker=true
- --probe.kubernetes=true
- --probe.weave.router.addr=

# We cannot refer to the Scope App with its Kubernetes Service
# DNS name (weave-scope-app) directly because Docker doesn't
Expand Down
2 changes: 1 addition & 1 deletion monitoring/prometheus/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM prom/prometheus
FROM prom/prometheus:0.17.0
LABEL works.weave.role=system

COPY prometheus.yml alert.rules /etc/prometheus/
Expand Down
2 changes: 1 addition & 1 deletion monitoring/prometheus/alert.rules
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ALERT Users4xxRate
# https://github.com/prometheus/prometheus/issues/1289

ALERT AppMapperLatency
IF max(sort_desc( scope_appmapper_request_duration_nanoseconds{route!="api_control", route!="api_app_topology_ws", status_code="200", quantile="0.9"}/1e6 )) > 5000.0
IF max(sort_desc( scope_appmapper_request_duration_nanoseconds{route!="api_control", route!="api_app_topology_ws", route!="api_app_pipe", route!="api_probe_pipe", status_code="200", quantile="0.9"}/1e6 )) > 5000.0
FOR 5m
WITH { severity="warning" }
SUMMARY "app-mapper service: high latency"
Expand Down
4 changes: 2 additions & 2 deletions monitoring/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ rule_files:
scrape_configs:
- job_name: 'kubernetes-services'
kubernetes_sd_configs:
- masters:
- 'https://kubernetes.default.svc'
- api_servers:
- 'https://kubernetes.default.svc.cluster.local'
in_cluster: true

# https://github.com/prometheus/prometheus/blob/0.16.1/documentation/examples/prometheus-kubernetes.yml
Expand Down

0 comments on commit 5efb038

Please sign in to comment.