Skip to content
Draft

WIP #2156

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
18 changes: 18 additions & 0 deletions .dev/mailpit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM axllent/mailpit:v1.28.0

EXPOSE 1025
EXPOSE 8025
41 changes: 41 additions & 0 deletions .dev/mailpit/manifests/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2025 Google LLC

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# https://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Pod
metadata:
name: mailpit
labels:
app.kubernetes.io/name: mailpit
spec:
containers:
- name: mailpit
image: mailpit
imagePullPolicy: Never # Need this for pushing directly into minikube
ports:
- containerPort: 1025
name: smtp-port
- containerPort: 8025
name: web-ui-port
readinessProbe:
tcpSocket:
port: 1025
initialDelaySeconds: 10
resources:
limits:
cpu: 250m
memory: 128Mi
requests:
cpu: 100m
memory: 64Mi
30 changes: 30 additions & 0 deletions .dev/mailpit/manifests/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2025 Google LLC

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# https://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Service
metadata:
name: mailpit
spec:
selector:
app.kubernetes.io/name: mailpit
ports:
- name: smtp
protocol: TCP
port: 1025
targetPort: smtp-port
- name: web-ui
protocol: TCP
port: 8025
targetPort: web-ui-port
31 changes: 31 additions & 0 deletions .dev/mailpit/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: skaffold/v4beta9
kind: Config
metadata:
name: mailpit-config
profiles:
- name: local
build:
artifacts:
- image: mailpit
context: .
local:
useBuildkit: true
manifests:
rawYaml:
- manifests/*
deploy:
kubectl: {}
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The above skaffold command deploys multiple resources:
| valkey | Valkey | N/A | valkey:6379 |
| auth | Auth Emulator | http://localhost:9099<br />http://localhost:9100/auth (ui) | http://auth:9099<br />http://auth:9100/auth (ui) |
| wiremock | Wiremock | http://localhost:8087 | http://api-github-mock.default.svc.cluster.local:8080 (GitHub Mock) |
| pubsub | Pub/Sub Emulator | N/A | http://pubsub:8060 |
| pubsub | Pub/Sub Emulator | http://localhost:8060 | http://pubsub:8060 |
| gcs | GCS Emulator | N/A | http://gcs:4443 |

_In the event the servers are not responsive, make a temporary change to a file_
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ check-local-ports:
$(call wait_for_port,9010,spanner)
$(call wait_for_port,8086,datastore)
$(call wait_for_port,8087,wiremock)
$(call wait_for_port,8060,pubsub)
$(call wait_for_port,8025,mailpit)


port-forward-manual: port-forward-terminate
Expand All @@ -98,13 +100,17 @@ port-forward-manual: port-forward-terminate
kubectl wait --for=condition=ready pod/datastore
kubectl wait --for=condition=ready pod/spanner
kubectl wait --for=condition=ready pod/wiremock
kubectl wait --for=condition=ready pod/pubsub
kubectl wait --for=condition=ready pod/mailpit
kubectl port-forward --address 127.0.0.1 pod/frontend 5555:5555 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/backend 8080:8080 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/auth 9099:9099 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/auth 9100:9100 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/spanner 9010:9010 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/datastore 8086:8086 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/wiremock 8087:8080 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/pubsub 8060:8060 2>&1 >/dev/null &
kubectl port-forward --address 127.0.0.1 pod/mailpit 8025:8025 2>&1 >/dev/null &
make check-local-ports

port-forward-terminate:
Expand All @@ -115,6 +121,8 @@ port-forward-terminate:
fuser -k 9010/tcp || true
fuser -k 8086/tcp || true
fuser -k 8087/tcp || true
fuser -k 8060/tcp || true
fuser -k 8025/tcp || true

# Prerequisite target to start minikube if necessary
minikube-running:
Expand Down
21 changes: 21 additions & 0 deletions backend/cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/GoogleChrome/webstatus.dev/backend/pkg/httpserver"
"github.com/GoogleChrome/webstatus.dev/lib/auth"
"github.com/GoogleChrome/webstatus.dev/lib/cachetypes"
"github.com/GoogleChrome/webstatus.dev/lib/gcppubsub"
"github.com/GoogleChrome/webstatus.dev/lib/gcppubsub/gcppubsubadapters"
"github.com/GoogleChrome/webstatus.dev/lib/gcpspanner"
"github.com/GoogleChrome/webstatus.dev/lib/gcpspanner/spanneradapters"
"github.com/GoogleChrome/webstatus.dev/lib/gds"
Expand Down Expand Up @@ -197,11 +199,30 @@ func main() {

}

pubsubProjectID := os.Getenv("PUBSUB_PROJECT_ID")
if pubsubProjectID == "" {
slog.ErrorContext(ctx, "missing pubsub project id")
os.Exit(1)
}

ingestionTopicID := os.Getenv("INGESTION_TOPIC_ID")
if ingestionTopicID == "" {
slog.ErrorContext(ctx, "missing ingestion topic id")
os.Exit(1)
}

queueClient, err := gcppubsub.NewClient(ctx, pubsubProjectID)
if err != nil {
slog.ErrorContext(ctx, "unable to create pub sub client", "error", err)
os.Exit(1)
}

srv := httpserver.NewHTTPServer(
"8080",
baseURL,
datastoreadapters.NewBackend(fs),
spanneradapters.NewBackend(spannerClient),
gcppubsubadapters.NewBackendAdapter(queueClient, ingestionTopicID),
cache,
routeCacheOptions,
func(token string) *httpserver.UserGitHubClient {
Expand Down
1 change: 1 addition & 0 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require (
cloud.google.com/go/logging v1.13.1 // indirect
cloud.google.com/go/longrunning v0.7.0 // indirect
cloud.google.com/go/monitoring v1.24.3 // indirect
cloud.google.com/go/pubsub/v2 v2.0.0 // indirect
cloud.google.com/go/secretmanager v1.16.0 // indirect
cloud.google.com/go/spanner v1.86.1 // indirect
cloud.google.com/go/storage v1.57.2 // indirect
Expand Down
4 changes: 4 additions & 0 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ cloud.google.com/go/pubsub v1.26.0/go.mod h1:QgBH3U/jdJy/ftjPhTkyXNj543Tin1pRYcd
cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0=
cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8=
cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4=
cloud.google.com/go/pubsub/v2 v2.0.0 h1:0qS6mRJ41gD1lNmM/vdm6bR7DQu6coQcVwD+VPf0Bz0=
cloud.google.com/go/pubsub/v2 v2.0.0/go.mod h1:0aztFxNzVQIRSZ8vUr79uH2bS3jwLebwK6q1sgEub+E=
cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg=
cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k=
cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM=
Expand Down Expand Up @@ -1105,6 +1107,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go.einride.tech/aip v0.68.1 h1:16/AfSxcQISGN5z9C5lM+0mLYXihrHbQ1onvYTr93aQ=
go.einride.tech/aip v0.68.1/go.mod h1:XaFtaj4HuA3Zwk9xoBtTWgNubZ0ZZXv9BZJCkuKuWbg=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
Expand Down
6 changes: 6 additions & 0 deletions backend/manifests/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ spec:
value: auth:9099
- name: GITHUB_API_BASE_URL
value: http://api-github-mock.default.svc.cluster.local:8080/
- name: PUBSUB_PROJECT_ID
value: local
- name: PUBSUB_EMULATOR_HOST
value: pubsub:8060
- name: INGESTION_TOPIC_ID
value: 'ingestion-jobs-topic-id'
resources:
limits:
cpu: 250m
Expand Down
6 changes: 6 additions & 0 deletions backend/pkg/httpserver/create_saved_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,11 @@ func (s *Server) CreateSavedSearch(ctx context.Context, request backend.CreateSa
}, nil
}

err = s.eventPublisher.PublishSearchConfigurationChanged(ctx, output, user.ID, true)
if err != nil {
// We should not mark this as a failure. Only log it.
slog.WarnContext(ctx, "unable to publish search configuration changed event during create", "error", err)
}

return backend.CreateSavedSearch201JSONResponse(*output), nil
}
Loading
Loading