less logs

This commit is contained in:
joshhunt
2025-07-01 13:24:21 +01:00
parent 38f871e9c2
commit b643911882
3 changed files with 22 additions and 15 deletions
+5 -4
View File
@@ -17,7 +17,7 @@ type GrafanaServiceOpts struct {
func GrafanaService(ctx context.Context, d *dagger.Client, opts GrafanaServiceOpts) (*dagger.Service, error) {
container := d.Container().From("alpine:3").
WithExec([]string{"apk", "add", "--no-cache", "bash", "tar", "netcat-openbsd"}).
WithExec([]string{"apk", "add", "--no-cache", "bash", "tar", "netcat-openbsd", "util-linux"}).
WithMountedFile("/src/grafana.tar.gz", opts.GrafanaTarGz).
WithExec([]string{"mkdir", "-p", "/src/grafana"}).
WithExec([]string{"tar", "--strip-components=1", "-xzf", "/src/grafana.tar.gz", "-C", "/src/grafana"}).
@@ -25,9 +25,10 @@ func GrafanaService(ctx context.Context, d *dagger.Client, opts GrafanaServiceOp
WithDirectory("/src/grafana/e2e/test-plugins", opts.HostSrc.Directory("./e2e/test-plugins")).
WithDirectory("/src/grafana/scripts", opts.HostSrc.Directory("./scripts")).
WithWorkdir("/src/grafana").
WithEnvVariable("GF_APP_MODE", "development").
// Only set config variables here that are specific to the dagger/GHA runner.
// Prefer to configure scripts/grafana-server/custom.ini instead so they're also used
// when running locally.
WithEnvVariable("GF_SERVER_HTTP_PORT", fmt.Sprint(grafanaPort)).
WithEnvVariable("GF_SERVER_ROUTER_LOGGING", "1").
WithExposedPort(grafanaPort)
var licenseArg string
@@ -45,7 +46,7 @@ func GrafanaService(ctx context.Context, d *dagger.Client, opts GrafanaServiceOp
}
}
svc := container.AsService(dagger.ContainerAsServiceOpts{Args: []string{"bash", "-x", "scripts/grafana-server/start-server", licenseArg}})
svc := container.AsService(dagger.ContainerAsServiceOpts{Args: []string{"bash", "scripts/grafana-server/start-server", licenseArg}})
return svc, nil
}
+5
View File
@@ -1,3 +1,8 @@
app_mode = development
[log]
level = error
filters = http.server:info,settings:info
[security]
content_security_policy = true
+12 -11
View File
@@ -60,17 +60,18 @@ cp devenv/dashboards.yaml $PROV_DIR/dashboards
cp devenv/alert_rules.yaml $PROV_DIR/alerting
cp devenv/plugins.yaml $PROV_DIR/plugins
cp -r devenv $RUNDIR
cp -r devenv $
echo -e "Starting Grafana Server port $PORT"
echo -e "Starting Grafana server port $PORT"
$RUNDIR/bin/"$ARCH"grafana-server \
--homepath=$HOME_PATH \
--pidfile=$RUNDIR/pid \
cfg:server.http_port=$PORT \
cfg:server.router_logging=1 \
cfg:app_mode=development \
cfg:enterprise.license_path=$1
# 2>&1 > $RUNDIR/output.log &
# cfg:log.level=debug \
# We get a lot of "context canceled" errors from navigating away from pages,
# so filter them out because they're not useful
{
exec "$RUNDIR/bin/${ARCH}grafana" server \
--homepath="$HOME_PATH" \
--pidfile="$RUNDIR/pid" \
cfg:server.http_port="$PORT" \
cfg:enterprise.license_path="$1" \
2>&1
} | grep -v -i "context canceled"