Skip to content

Commit

Permalink
Merge branch 'master' into engine-compat-sqlc
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercactapus committed Dec 23, 2024
2 parents 6773c9a + a568546 commit cb8fe61
Show file tree
Hide file tree
Showing 144 changed files with 4,854 additions and 2,143 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/bin
/storybook-static
/playwright/.cache
/web/src/app/editor/expr-parser.ts
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ updates:
timezone: 'Asia/Kolkata'
allow:
- dependency-type: 'direct'
groups:
go-deps:
patterns: ['*']

- package-ecosystem: 'gradle'
directory: '/'
Expand Down Expand Up @@ -125,6 +128,16 @@ updates:
timezone: 'Asia/Kolkata'
allow:
- dependency-type: 'direct'
groups:
js-mui-deps:
patterns: ['@mui/*']
js-deps:
patterns: ['*']
exclude-patterns:
- '@mui/*'
update-types:
- 'patch'
- 'minor'

- package-ecosystem: 'nuget'
directory: '/'
Expand Down
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ YARN_VERSION=4.3.1
PG_VERSION=13

# add all files except those under web/src/build and web/src/cypress
NODE_DEPS=.pnp.cjs .yarnrc.yml .gitrev $(shell find web/src -path web/src/build -prune -o -path web/src/cypress -prune -o -type f -print)
NODE_DEPS=.pnp.cjs .yarnrc.yml .gitrev $(shell find web/src -path web/src/build -prune -o -path web/src/cypress -prune -o -type f -print) web/src/app/editor/expr-parser.ts

# Use sha256sum on linux and shasum -a 256 on mac
SHA_CMD := $(shell if [ -x "$(shell command -v sha256sum 2>/dev/null)" ]; then echo "sha256sum"; else echo "shasum -a 256"; fi)
Expand Down Expand Up @@ -58,6 +58,8 @@ ifeq ($(PUSH), 1)
PUSH_FLAG=--push
endif

CONTAINER_TOOL ?= docker

all: test

release: container-demo container-goalert bin/goalert-linux-amd64.tgz bin/goalert-linux-arm.tgz bin/goalert-linux-arm64.tgz bin/goalert-darwin-amd64.tgz bin/goalert-windows-amd64.zip ## Build all release artifacts
Expand Down Expand Up @@ -156,12 +158,12 @@ start-prod: web/src/build/static/app.js bin/mockoidc $(BIN_DIR)/tools/prometheus
$(MAKE) $(MFLAGS) bin/goalert BUNDLE=1
go run ./devtools/runproc -f Procfile.prod -l Procfile.local


start-swo: bin/psql-lite bin/goalert bin/waitfor bin/mockoidc bin/runproc $(NODE_DEPS) web/src/schema.d.ts $(BIN_DIR)/tools/prometheus $(BIN_DIR)/tools/mailpit ## Start the developer version of the application in switchover mode (SWO)
reset-swo: bin/psql-lite bin/goalert bin/waitfor
./bin/waitfor -timeout 1s "$(DB_URL)" || make postgres
./bin/goalert migrate --db-url=postgres://goalert@localhost/goalert
./bin/psql-lite -d postgres://goalert@localhost -c "update switchover_state set current_state = 'idle'; truncate table switchover_log; drop database if exists goalert2; create database goalert2;"
./bin/goalert migrate --db-url=postgres://goalert@localhost/goalert2
start-swo: reset-swo bin/goalert bin/mockoidc bin/runproc $(NODE_DEPS) web/src/schema.d.ts $(BIN_DIR)/tools/prometheus $(BIN_DIR)/tools/mailpit ## Start the developer version of the application in switchover mode (SWO)
GOALERT_VERSION=$(GIT_VERSION) ./bin/runproc -f Procfile.swo -l Procfile.local

reset-integration: bin/waitfor bin/goalert.cover bin/psql-lite bin/resetdb
Expand Down Expand Up @@ -301,6 +303,13 @@ tools:
yarn install && touch "$@"


web/src/app/editor/expr-parser.ts: web/src/app/editor/expr.grammar .pnp.cjs
# we need to use .tmp.ts as the extension because lezer-generator will append .ts to the output file
yarn run lezer-generator $< --noTerms --typeScript -o $@.tmp.ts
yarn run prettier -l --write $@.tmp.ts
cat $@.tmp.ts | sed "s/You probably shouldn't edit it./DO NOT EDIT/" >$@
rm $@.tmp.ts

web/src/build/static/explore.js: web/src/build/static/app.js
web/src/build/static/app.js: $(NODE_DEPS)
$(MAKE) ensure-yarn
Expand Down
47 changes: 10 additions & 37 deletions Makefile.binaries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,48 +36,21 @@ LD_FLAGS+=-X github.com/target/goalert/version.buildDate=$(BUILD_DATE)
IMAGE_REPO=docker.io/goalert
IMAGE_TAG=$(GIT_VERSION)

CONTAINER_TOOL:=$(shell which podman || which docker || exit 1)
PUSH:=0

container-goalert-manifest:
podman manifest rm $(IMAGE_REPO)/goalert:$(IMAGE_TAG) &>/dev/null || true
podman manifest create $(IMAGE_REPO)/goalert:$(IMAGE_TAG)

container-demo-manifest:
podman manifest rm $(IMAGE_REPO)/demo:$(IMAGE_TAG) &>/dev/null || true
podman manifest create $(IMAGE_REPO)/demo:$(IMAGE_TAG)


container-demo-amd64: container-demo-manifest bin/goalert-linux-amd64.tgz bin/linux-amd64/resetdb
podman pull --platform=linux/amd64 docker.io/library/alpine:3.14
podman build --format docker --build-arg ARCH=amd64 --platform=linux/amd64 --manifest $(IMAGE_REPO)/demo:$(IMAGE_TAG) -f devtools/ci/dockerfiles/demo/Dockerfile.prebuilt .
container-goalert-amd64: container-goalert-manifest bin/goalert-linux-amd64.tgz
podman pull --platform=linux/amd64 docker.io/library/alpine:3.14
podman build --format docker --build-arg ARCH=amd64 --platform=linux/amd64 --manifest $(IMAGE_REPO)/goalert:$(IMAGE_TAG) -f devtools/ci/dockerfiles/goalert/Dockerfile.prebuilt .

container-demo-arm: container-demo-manifest bin/goalert-linux-arm.tgz bin/linux-arm/resetdb
podman pull --platform=linux/arm docker.io/library/alpine:3.14
podman build --format docker --build-arg ARCH=arm --platform=linux/arm --manifest $(IMAGE_REPO)/demo:$(IMAGE_TAG) -f devtools/ci/dockerfiles/demo/Dockerfile.prebuilt .
container-goalert-arm: container-goalert-manifest bin/goalert-linux-arm.tgz
podman pull --platform=linux/arm docker.io/library/alpine:3.14
podman build --format docker --build-arg ARCH=arm --platform=linux/arm --manifest $(IMAGE_REPO)/goalert:$(IMAGE_TAG) -f devtools/ci/dockerfiles/goalert/Dockerfile.prebuilt .

container-demo-arm64: container-demo-manifest bin/goalert-linux-arm64.tgz bin/linux-arm64/resetdb
podman pull --platform=linux/arm64 docker.io/library/alpine:3.14
podman build --format docker --build-arg ARCH=arm64 --platform=linux/arm64 --manifest $(IMAGE_REPO)/demo:$(IMAGE_TAG) -f devtools/ci/dockerfiles/demo/Dockerfile.prebuilt .
container-goalert-arm64: container-goalert-manifest bin/goalert-linux-arm64.tgz
podman pull --platform=linux/arm64 docker.io/library/alpine:3.14
podman build --format docker --build-arg ARCH=arm64 --platform=linux/arm64 --manifest $(IMAGE_REPO)/goalert:$(IMAGE_TAG) -f devtools/ci/dockerfiles/goalert/Dockerfile.prebuilt .

container-demo: container-demo-amd64 container-demo-arm container-demo-arm64
PUSH_ARG=
ifeq ($(PUSH),1)
podman manifest push --all $(IMAGE_REPO)/demo:$(IMAGE_TAG) docker://$(IMAGE_REPO)/demo:$(IMAGE_TAG)
endif
container-goalert: container-goalert-amd64 container-goalert-arm container-goalert-arm64
ifeq ($(PUSH),1)
podman manifest push --all $(IMAGE_REPO)/goalert:$(IMAGE_TAG) docker://$(IMAGE_REPO)/goalert:$(IMAGE_TAG)
PUSH_ARG=--push
endif

PREBUILT:=.prebuilt

container-goalert: bin/goalert-linux-amd64.tgz bin/goalert-linux-arm.tgz bin/goalert-linux-arm64.tgz
docker buildx build --platform linux/amd64,linux/arm64,linux/arm -t $(IMAGE_REPO)/goalert:$(IMAGE_TAG) -f devtools/ci/dockerfiles/goalert/Dockerfile$(PREBUILT) $(PUSH_ARG) .

container-demo: bin/goalert-linux-amd64.tgz bin/linux-amd64/resetdb bin/goalert-linux-arm.tgz bin/linux-arm/resetdb bin/goalert-linux-arm64.tgz bin/linux-arm64/resetdb
docker buildx build --platform linux/amd64,linux/arm64,linux/arm -t $(IMAGE_REPO)/demo:$(IMAGE_TAG) -f devtools/ci/dockerfiles/demo/Dockerfile$(PREBUILT) $(PUSH_ARG) .

$(BIN_DIR)/build/integration/cypress/plugins/index.js: package.json yarn.lock web/src/esbuild.cypress.js $(shell find ./web/src/cypress)
rm -rf $@
yarn run esbuild-cy
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build: while true; do make -qs bin/goalert || make bin/goalert || (echo '\033[0;31mBuild Failure'; sleep 3); sleep 0.1; done

@watch-file=./bin/goalert
goalert: ./bin/goalert -l=localhost:3030 --ui-dir=web/src/build --db-url=postgres://goalert@localhost --listen-sysapi=localhost:1234 --listen-prometheus=localhost:2112 --smtp-listen=localhost:9025 --email-integration-domain=localhost --listen-pprof=localhost:6060 --pprof-mutex-profile-fraction=1 --pprof-block-profile-rate=1000
goalert: ./bin/goalert -l=localhost:3030 --ui-dir=web/src/build --db-url=postgres://goalert@localhost --listen-sysapi=localhost:1234 --listen-prometheus=localhost:2112 --smtp-listen=localhost:9025 --email-integration-domain=localhost --listen-pprof=localhost:6060 --pprof-mutex-profile-fraction=1 --pprof-block-profile-rate=1000 --enable-secure-headers

smtp: ./bin/tools/mailpit -s localhost:1025 -l localhost:8025
prom: bin/tools/prometheus --log.level=warn --config.file=devtools/prometheus/prometheus.yml --storage.tsdb.path=bin/prom-data/ --web.listen-address=localhost:9090
Expand Down
2 changes: 1 addition & 1 deletion Procfile.cypress
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build: while true; do make -qs bin/goalert.cover || make bin/goalert.cover || (echo '\033[0;31mBuild Failure'; sleep 3); sleep 0.1; done

@watch-file=./bin/goalert.cover
goalert: go run ./devtools/waitfor postgres://postgres@127.0.0.1:5433 && go run ./devtools/procwrap -test=127.0.0.1:3042 bin/goalert.cover -l=127.0.0.1:3042 --ui-dir=web/src/build --db-url=postgres://postgres@127.0.0.1:5433 --slack-base-url=http://127.0.0.1:3040/slack --stub-notifiers --log-errors-only --public-url=http://127.0.0.1:3040$HTTP_PREFIX
goalert: go run ./devtools/waitfor postgres://postgres@127.0.0.1:5433 && go run ./devtools/procwrap -test=127.0.0.1:3042 bin/goalert.cover -l=127.0.0.1:3042 --ui-dir=web/src/build --db-url=postgres://postgres@127.0.0.1:5433 --slack-base-url=http://127.0.0.1:3040/slack --stub-notifiers --log-errors-only --public-url=http://127.0.0.1:3040$HTTP_PREFIX --enable-secure-headers

@watch-file=./web/src/esbuild.config.js
ui: yarn run esbuild --watch
Expand Down
2 changes: 1 addition & 1 deletion Procfile.cypress.ci
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@oneshot
cypress: go run ./devtools/waitfor http://127.0.0.1:3042 && CYPRESS_DB_URL=$DB_URL yarn cypress $CY_ACTION --config baseUrl=http://127.0.0.1:3040$HTTP_PREFIX

goalert: go run ./devtools/waitfor $DB_URL && go run ./devtools/procwrap -test=127.0.0.1:3042 bin/goalert.cover -l=127.0.0.1:3042 --db-url=$DB_URL --slack-base-url=http://127.0.0.1:3040/slack --stub-notifiers --log-errors-only --public-url=http://127.0.0.1:3040$HTTP_PREFIX
goalert: go run ./devtools/waitfor $DB_URL && go run ./devtools/procwrap -test=127.0.0.1:3042 bin/goalert.cover -l=127.0.0.1:3042 --db-url=$DB_URL --slack-base-url=http://127.0.0.1:3040/slack --stub-notifiers --log-errors-only --public-url=http://127.0.0.1:3040$HTTP_PREFIX --enable-secure-headers

slack: go run ./devtools/mockslack/cmd/mockslack -client-id=000000000000.000000000000 -client-secret=00000000000000000000000000000000 -access-token=xoxp-000000000000-000000000000-000000000000-00000000000000000000000000000000 -prefix=/slack -single-user=bob -addr=127.0.0.1:3046

Expand Down
2 changes: 1 addition & 1 deletion Procfile.cypress.prod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build: while true; do make -qs bin/goalert.cover BUNDLE=1 >/dev/null || make bin/goalert.cover BUNDLE=1 || (echo '\033[0;31mBuild Failure'; sleep 3); sleep 0.1; done

@watch-file=./bin/goalert.cover
goalert: go run ./devtools/waitfor postgres://postgres@127.0.0.1:5433 && go run ./devtools/procwrap -test=127.0.0.1:3042 bin/goalert.cover -l=127.0.0.1:3042 --db-url=postgres://postgres@127.0.0.1:5433 --slack-base-url=http://127.0.0.1:3040/slack --stub-notifiers --log-errors-only --public-url=http://127.0.0.1:3040$HTTP_PREFIX
goalert: go run ./devtools/waitfor postgres://postgres@127.0.0.1:5433 && go run ./devtools/procwrap -test=127.0.0.1:3042 bin/goalert.cover -l=127.0.0.1:3042 --db-url=postgres://postgres@127.0.0.1:5433 --slack-base-url=http://127.0.0.1:3040/slack --stub-notifiers --log-errors-only --public-url=http://127.0.0.1:3040$HTTP_PREFIX --enable-secure-headers

slack: go run ./devtools/mockslack/cmd/mockslack -client-id=000000000000.000000000000 -client-secret=00000000000000000000000000000000 -access-token=xoxp-000000000000-000000000000-000000000000-00000000000000000000000000000000 -prefix=/slack -single-user=bob -addr=127.0.0.1:3046

Expand Down
2 changes: 1 addition & 1 deletion Procfile.prod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build: while true; do make -qs bin/goalert BUNDLE=1 || make bin/goalert BUNDLE=1 || (echo '\033[0;31mBuild Failure'; sleep 3); sleep 0.1; done

@watch-file=./bin/goalert
goalert: ./bin/goalert -l=localhost:3030 --db-url=postgres://goalert@localhost --listen-sysapi=localhost:1234 --listen-prometheus=localhost:2112 --listen-pprof=localhost:6060 --pprof-mutex-profile-fraction=1 --pprof-block-profile-rate=1000
goalert: ./bin/goalert -l=localhost:3030 --db-url=postgres://goalert@localhost --listen-sysapi=localhost:1234 --listen-prometheus=localhost:2112 --listen-pprof=localhost:6060 --pprof-mutex-profile-fraction=1 --pprof-block-profile-rate=1000 --enable-secure-headers

smtp: ./bin/tools/mailpit -s localhost:1025 -l localhost:8025
prom: bin/tools/prometheus --log.level=warn --config.file=devtools/prometheus/prometheus.yml --storage.tsdb.path=bin/prom-data/ --web.listen-address=localhost:9090
Expand Down
18 changes: 9 additions & 9 deletions Procfile.swo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build: while true; do make -qs bin/goalert || make bin/goalert || (echo '\033[0;31mBuild Failure'; sleep 3); sleep 0.1; done

@watch-file=./bin/goalert
goalert: ./bin/goalert -l=localhost:3040 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435 --listen-sysapi=localhost:1234 --listen-prometheus=localhost:2112 --db-url-next=postgres://goalert@localhost:5435/goalert2
goalert: ./bin/goalert -l=localhost:3040 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435 --listen-sysapi=localhost:1234 --listen-prometheus=localhost:2112 --db-url-next=postgres://goalert@localhost:5435/goalert2 --enable-secure-headers

smtp: ./bin/tools/mailpit -s localhost:1025 -l localhost:8025

Expand All @@ -11,28 +11,28 @@ prom: bin/tools/prometheus --log.level=warn --config.file=devtools/prometheus/pr
ui: yarn run esbuild --watch

@watch-file=./bin/goalert
ga2: ./bin/goalert -l=localhost:3050 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2113 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only
ga2: ./bin/goalert -l=localhost:3050 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2113 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only --enable-secure-headers

@watch-file=./bin/goalert
ga3: ./bin/goalert -l=localhost:3051 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2114 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only
ga3: ./bin/goalert -l=localhost:3051 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2114 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only --enable-secure-headers

@watch-file=./bin/goalert
ga4: ./bin/goalert -l=localhost:3052 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2115 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only
ga4: ./bin/goalert -l=localhost:3052 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2115 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only --enable-secure-headers

@watch-file=./bin/goalert
ga5: ./bin/goalert -l=localhost:3053 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2116 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only
ga5: ./bin/goalert -l=localhost:3053 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2116 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only --enable-secure-headers

@watch-file=./bin/goalert
ga6: ./bin/goalert -l=localhost:3054 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2117 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only
ga6: ./bin/goalert -l=localhost:3054 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2117 --db-url-next=postgres://goalert@localhost:5435/goalert2 --api-only --enable-secure-headers

@watch-file=./bin/goalert
ga7: ./bin/goalert -l=localhost:3055 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2118 --db-url-next=postgres://goalert@localhost:5435/goalert2
ga7: ./bin/goalert -l=localhost:3055 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2118 --db-url-next=postgres://goalert@localhost:5435/goalert2 --enable-secure-headers

@watch-file=./bin/goalert
ga8: ./bin/goalert -l=localhost:3056 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2119 --db-url-next=postgres://goalert@localhost:5435/goalert2
ga8: ./bin/goalert -l=localhost:3056 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2119 --db-url-next=postgres://goalert@localhost:5435/goalert2 --enable-secure-headers

@watch-file=./bin/goalert
ga9: ./bin/goalert -l=localhost:3057 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2120 --db-url-next=postgres://goalert@localhost:5435/goalert2
ga9: ./bin/goalert -l=localhost:3057 --ui-dir=web/src/build --db-url=postgres://goalert@localhost:5435/goalert?sslmode=disable --listen-prometheus=localhost:2120 --db-url-next=postgres://goalert@localhost:5435/goalert2 --enable-secure-headers

proxy: go run ./devtools/simpleproxy -addr localhost:3030 /=http://localhost:3040,http://localhost:3050,http://localhost:3051,http://localhost:3052,http://localhost:3053,http://localhost:3054,http://localhost:3055,http://localhost:3056,http://localhost:3057

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ See our [Getting Started Guide](./docs/getting-started.md) for running GoAlert i
### Quick Start

```bash
# podman
podman run -it --rm -p 8081:8081 goalert/demo

# docker
docker run -it --rm -p 8081:8081 goalert/demo
```

Expand Down
Loading

0 comments on commit cb8fe61

Please sign in to comment.