Skip to content

Commit

Permalink
hobby stack deployment improvements (#7746)
Browse files Browse the repository at this point in the history
## Summary

Tweak hobby deploy to make spinning up a simpler experience.
* replace redundant `FRONTEND_URI` with `REACT_APP_FRONTEND_URI`
* add license key reporting via the `docker/.env`
* correctly serve frontend on different port than 3000
* ensure backend url not shows on setup page for self-hosted deploys

## How did you test this change?

CI
[building](https://github.com/highlight/highlight/actions/runs/7895507874)
docker image, ec2 deploy
https://www.loom.com/share/e85f3fcfe1824a1292e4441ee7be49f2

## Are there any deployment considerations?

New docker image release

## Does this work require review from our design team?

No
  • Loading branch information
Vadman97 committed Feb 15, 2024
1 parent 52b2605 commit 29246b8
Show file tree
Hide file tree
Showing 50 changed files with 188 additions and 156 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
timeout-minutes: 30
env:
IMAGE_NAME: highlight-${{ matrix.container }}
IMAGE_TAG: ${{ github.ref_name }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

Expand Down Expand Up @@ -51,9 +50,11 @@ jobs:
ANNOTATIONS="annotation-index.org.opencontainers.image.description=highlight.io production ${{ matrix.container }} image"
ANNOTATIONS="$ANNOTATIONS,annotation-index.org.opencontainers.image.source=https://github.com/highlight/highlight"
ANNOTATIONS="$ANNOTATIONS,annotation-index.org.opencontainers.image.licenses=Apache 2.0"
IMAGE_TAG=$(echo ${{ github.ref_name }} | sed 's/\//-/g')
push="--push -t ghcr.io/highlight/$IMAGE_NAME:$IMAGE_TAG"
if [[ ${{ github.event_name }} == 'release' ]]; then
push="--push -t ghcr.io/highlight/$IMAGE_NAME:$IMAGE_TAG -t ghcr.io/highlight/$IMAGE_NAME:latest"
push="${push} -t ghcr.io/highlight/$IMAGE_NAME:latest"
fi
# build docker image with common environment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/turbo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ jobs:
popd;
# wait for highlight to be ready
yarn dlx wait-on -l -s 4 https://127.0.0.1:3000/index.html http://127.0.0.1:8080/dist/index.js https://127.0.0.1:8082/health;
yarn dlx wait-on -l -s 4 http://127.0.0.1:8080/dist/index.js http://127.0.0.1:3000/index.html http://127.0.0.1:8082/health;
# run cypress tests
yarn cy:run;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ git clone --recurse-submodules https://github.com/highlight/highlight
cd docker && ./run-hobby.sh
```

After a brief frontend load time, the app should be accessible at https://localhost:3000
After a brief frontend load time, the app should be accessible at https://localhost

Good for <10k sessions and <50k errors ingested monthly. See our [docs for more info and limitations](https://www.highlight.io/docs/general/company/open-source/hosting/self-host-hobby).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func SendLogAlertsWelcomeMessage(ctx context.Context, alert *model.LogAlert, inp

description := "Log alerts will now be sent to this channel."

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
alertUrl := fmt.Sprintf("%s/%d/%s/%d", frontendURL, input.Project.Model.ID, "alerts/logs", alert.ID)
message := fmt.Sprintf("👋 %s has %s the alert \"%s\". %s %s", *adminName, input.OperationName, alert.GetName(), description, alertUrl)

Expand Down
12 changes: 6 additions & 6 deletions backend/alerts/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,34 @@ import (

func getErrorURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")

return fmt.Sprintf("%s/%d/errors/%s/instances/%d", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}

func getErrorResolveURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")

return fmt.Sprintf("%s/%d/errors/%s/instances/%d?action=resolved", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}

func getErrorIgnoreURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")

return fmt.Sprintf("%s/%d/errors/%s/instances/%d?action=ignored", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}

func getErrorSnoozeURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")

return fmt.Sprintf("%s/%d/errors/%s/instances/%d?action=snooze", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}

func getSessionURL(projectID int, session *model.Session) string {
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/sessions/%s", frontendURL, projectID, session.SecureID)
}

Expand All @@ -47,6 +47,6 @@ func getSessionCommentURL(projectID int, session *model.Session, sessionComment
}

func getMonitorURL(metricMonitor *model.MetricMonitor) string {
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/alerts/monitors/%d", frontendURL, metricMonitor.ProjectID, metricMonitor.ID)
}
4 changes: 2 additions & 2 deletions backend/email/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
SendGridOutboundEmail = "notifications@notify.highlight.io"
SessionCommentMentionsAsmId = 20950
ErrorCommentMentionsAsmId = 20994
frontendUri = os.Getenv("FRONTEND_URI")
frontendUri = os.Getenv("REACT_APP_FRONTEND_URI")
)

type EmailType string
Expand Down Expand Up @@ -110,7 +110,7 @@ func GetOptOutToken(adminID int, previous bool) string {

func GetSubscriptionUrl(adminId int, previous bool) string {
token := GetOptOutToken(adminId, previous)
return fmt.Sprintf("%s/subscriptions?admin_id=%d&token=%s", os.Getenv("FRONTEND_URI"), adminId, token)
return fmt.Sprintf("%s/subscriptions?admin_id=%d&token=%s", os.Getenv("REACT_APP_FRONTEND_URI"), adminId, token)
}

func getApproachingLimitMessage(productType string, workspaceId int) string {
Expand Down
2 changes: 1 addition & 1 deletion backend/front/front.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func OAuth(ctx context.Context, code string, currentOAuth *OAuthToken) (*OAuthTo
form.Add("refresh_token", currentOAuth.RefreshToken)
form.Add("grant_type", "refresh_token")
} else {
redirect := os.Getenv("FRONTEND_URI") + "/callback/front"
redirect := os.Getenv("REACT_APP_FRONTEND_URI") + "/callback/front"
form.Add("code", code)
form.Add("redirect_uri", redirect)
form.Add("grant_type", "authorization_code")
Expand Down
2 changes: 1 addition & 1 deletion backend/jobs/log-alerts/log-alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func processLogAlert(ctx context.Context, DB *gorm.DB, MailClient *sendgrid.Clie
}

logsUrl := tempalerts.GetLogAlertURL(alert.ProjectID, alert.Query, start, end)
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
alertUrl := fmt.Sprintf("%s/%d/alerts/logs/%d", frontendURL, alert.ProjectID, alert.ID)

templateData := map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion backend/jobs/metric-monitor/metric-monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func processMetricMonitors(ctx context.Context, DB *gorm.DB, ccClient *clickhous
log.WithContext(ctx).Error(err)
}

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
monitorURL := fmt.Sprintf("%s/%d/alerts/monitor/%d", frontendURL, metricMonitor.ProjectID, metricMonitor.ID)

for _, email := range emailsToNotify {
Expand Down
8 changes: 4 additions & 4 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import (
)

var (
frontendURL = os.Getenv("FRONTEND_URI")
frontendURL = os.Getenv("REACT_APP_FRONTEND_URI")
staticFrontendPath = os.Getenv("ONPREM_STATIC_FRONTEND_PATH")
landingStagingURL = os.Getenv("LANDING_PAGE_STAGING_URI")
sendgridKey = os.Getenv("SENDGRID_API_KEY")
Expand Down Expand Up @@ -604,7 +604,7 @@ func main() {
go func() {
w.Start(ctx)
}()
if util.IsDevEnv() {
if util.IsDevEnv() && util.UseSSL() {
log.Fatal(http.ListenAndServeTLS(":"+port, localhostCertPath, localhostKeyPath, r))
} else {
log.Fatal(http.ListenAndServe(":"+port, r))
Expand Down Expand Up @@ -635,14 +635,14 @@ func main() {
w.RefreshMaterializedViews(ctx)
}
}()
if util.IsDevEnv() {
if util.IsDevEnv() && util.UseSSL() {
log.Fatal(http.ListenAndServeTLS(":"+port, localhostCertPath, localhostKeyPath, r))
} else {
log.Fatal(http.ListenAndServe(":"+port, r))
}
}
} else {
if util.IsDevEnv() {
if util.IsDevEnv() && util.UseSSL() {
log.Fatal(http.ListenAndServeTLS(":"+port, localhostCertPath, localhostKeyPath, r))
} else {
log.Fatal(http.ListenAndServe(":"+port, r))
Expand Down
6 changes: 3 additions & 3 deletions backend/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,7 @@ func (e *ErrorGroup) GetSlackAttachment(attachment *slack.Attachment) error {
errorType := e.Type
errorState := e.State

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
errorURL := fmt.Sprintf("%s/%d/errors/%s", frontendURL, e.ProjectID, e.SecureID)

fields := []*slack.TextBlockObject{
Expand Down Expand Up @@ -1942,7 +1942,7 @@ func (s *Session) GetSlackAttachment(attachment *slack.Attachment) error {
sessionTotalDuration := formatDuration(time.Duration(s.Length * 10e5).Round(time.Second))
sessionDateStr := fmt.Sprintf("<!date^%d^{date} {time}|%s>", s.CreatedAt.Unix(), s.CreatedAt.Format(time.RFC1123))

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
sessionURL := fmt.Sprintf("%s/%d/sessions/%s", frontendURL, s.ProjectID, s.SecureID)
sessionImg := ""
userProps, err := s.GetUserProperties()
Expand Down Expand Up @@ -2391,7 +2391,7 @@ func SendWelcomeSlackMessage(ctx context.Context, obj IAlert, input *SendWelcome
slackClient = slack.New(*input.Workspace.SlackAccessToken)
}

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
alertUrl := fmt.Sprintf("%s/%d/%s/%d", frontendURL, input.Project.Model.ID, input.URLSlug, input.ID)
if !input.IncludeEditLink {
alertUrl = ""
Expand Down
4 changes: 2 additions & 2 deletions backend/otel/samples/traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@
{
"key": "log.message",
"value": {
"stringValue": "[1681426468569] Sending: 120 events, 2 messages, 0 network resources, 0 errors \nTo: https://localhost:8082/public\nOrg: 1\nSessionSecureID: tUVyYXgmLPMuJBM5FdhaEcDIOfah"
"stringValue": "[1681426468569] Sending: 120 events, 2 messages, 0 network resources, 0 errors \nTo: http://localhost:8082/public\nOrg: 1\nSessionSecureID: tUVyYXgmLPMuJBM5FdhaEcDIOfah"
}
},
{
Expand All @@ -1562,7 +1562,7 @@
{
"key": "exception.stacktrace",
"value": {
"stringValue": "[1681426468569] Sending: 120 events, 2 messages, 0 network resources, 0 errors \nTo: https://localhost:8082/public\nOrg: 1\nSessionSecureID: tUVyYXgmLPMuJBM5FdhaEcDIOfah\n at console.log (chrome-extension://dpajfcckdohlcidmbjledcaenfkjaddo/assets/js/logger.js:5:164)\n at Logger.log (http://localhost:8080/dist/index.js:15552:23)\n at Highlight.\u003canonymous\u003e (http://localhost:8080/dist/index.js:16454:23)\n at http://localhost:8080/dist/index.js:15714:65\n at __async (http://localhost:8080/dist/index.js:15698:14)\n at Highlight._sendPayload (http://localhost:8080/dist/index.js:16437:16)\n at Highlight.\u003canonymous\u003e (http://localhost:8080/dist/index.js:16400:24)\n at http://localhost:8080/dist/index.js:15714:65\n at __async (http://localhost:8080/dist/index.js:15698:14)\n at Highlight._save (http://localhost:8080/dist/index.js:16395:16)\n at http://localhost:8080/dist/index.js:16415:20\n at r (chrome-extension://dpajfcckdohlcidmbjledcaenfkjaddo/assets/js/logger.js:14:1397)"
"stringValue": "[1681426468569] Sending: 120 events, 2 messages, 0 network resources, 0 errors \nTo: http://localhost:8082/public\nOrg: 1\nSessionSecureID: tUVyYXgmLPMuJBM5FdhaEcDIOfah\n at console.log (chrome-extension://dpajfcckdohlcidmbjledcaenfkjaddo/assets/js/logger.js:5:164)\n at Logger.log (http://localhost:8080/dist/index.js:15552:23)\n at Highlight.\u003canonymous\u003e (http://localhost:8080/dist/index.js:16454:23)\n at http://localhost:8080/dist/index.js:15714:65\n at __async (http://localhost:8080/dist/index.js:15698:14)\n at Highlight._sendPayload (http://localhost:8080/dist/index.js:16437:16)\n at Highlight.\u003canonymous\u003e (http://localhost:8080/dist/index.js:16400:24)\n at http://localhost:8080/dist/index.js:15714:65\n at __async (http://localhost:8080/dist/index.js:15698:14)\n at Highlight._save (http://localhost:8080/dist/index.js:16395:16)\n at http://localhost:8080/dist/index.js:16415:20\n at r (chrome-extension://dpajfcckdohlcidmbjledcaenfkjaddo/assets/js/logger.js:14:1397)"
}
}
]
Expand Down
10 changes: 10 additions & 0 deletions backend/phonehome/phonehome.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ const SpanDeployment = "highlight-phone-home-deployment-id"
const SpanDopplerConfig = "highlight-doppler-config"
const SpanHighlightVersion = "highlight-version"
const SpanOnPrem = "highlight-is-onprem"
const SpanLicenseKey = "highlight-license-key"
const SpanSSL = "highlight-ssl"
const SpanPublicGraphUri = "highlight-public-graph-uri"
const SpanPrivateGraphUri = "highlight-private-graph-uri"
const SpanFrontendUri = "highlight-frontend-uri"

func IsOptedOut(_ context.Context) bool {
return false
Expand All @@ -72,6 +77,11 @@ func GetDefaultAttributes() ([]attribute.KeyValue, error) {
attribute.String(SpanDopplerConfig, util.DopplerConfig),
attribute.String(SpanHighlightVersion, util.Version),
attribute.String(SpanOnPrem, util.OnPrem),
attribute.String(SpanLicenseKey, util.LicenseKey),
attribute.Bool(SpanSSL, util.UseSSL()),
attribute.String(SpanPublicGraphUri, util.PublicGraphUri),
attribute.String(SpanPrivateGraphUri, util.PrivateGraphUri),
attribute.String(SpanFrontendUri, util.FrontendUri),
}, nil
}

Expand Down
6 changes: 3 additions & 3 deletions backend/private-graph/graph/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var AuthorizationError = errors.New("403 - AuthorizationError")
var (
WhitelistedUID = os.Getenv("WHITELISTED_FIREBASE_ACCOUNT")
JwtAccessSecret = os.Getenv("JWT_ACCESS_SECRET")
FrontendURI = os.Getenv("FRONTEND_URI")
FrontendURI = os.Getenv("REACT_APP_FRONTEND_URI")
)

var BytesConversion = map[string]int64{
Expand Down Expand Up @@ -1835,7 +1835,7 @@ func (r *Resolver) AWSMPCallback(ctx context.Context) func(http.ResponseWriter,
w.WriteHeader(http.StatusBadRequest)
return
}
http.Redirect(w, req, fmt.Sprintf("%s/callback/aws-mp?code=%s", os.Getenv("FRONTEND_URI"), secret), http.StatusFound)
http.Redirect(w, req, fmt.Sprintf("%s/callback/aws-mp?code=%s", os.Getenv("REACT_APP_FRONTEND_URI"), secret), http.StatusFound)
}
}

Expand Down Expand Up @@ -2532,7 +2532,7 @@ func (r *Resolver) CreateLinearAttachment(accessToken string, issueID string, ti
Title: title,
Subtitle: subtitle,
Url: url,
IconUrl: fmt.Sprintf("%s/logo_with_gradient_bg.png", os.Getenv("FRONTEND_URI")),
IconUrl: fmt.Sprintf("%s/logo_with_gradient_bg.png", os.Getenv("REACT_APP_FRONTEND_URI")),
},
}

Expand Down
8 changes: 4 additions & 4 deletions backend/private-graph/graph/schema.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1368,8 +1368,8 @@ func (r *mutationResolver) CreateOrUpdateStripeSubscription(ctx context.Context,

// If there's no existing subscription, we create a checkout.
checkoutSessionParams := &stripe.CheckoutSessionParams{
SuccessURL: stripe.String(os.Getenv("FRONTEND_URI") + "/w/" + strconv.Itoa(workspaceID) + "/current-plan/success"),
CancelURL: stripe.String(os.Getenv("FRONTEND_URI") + "/w/" + strconv.Itoa(workspaceID) + "/current-plan/update-plan"),
SuccessURL: stripe.String(os.Getenv("REACT_APP_FRONTEND_URI") + "/w/" + strconv.Itoa(workspaceID) + "/current-plan/success"),
CancelURL: stripe.String(os.Getenv("REACT_APP_FRONTEND_URI") + "/w/" + strconv.Itoa(workspaceID) + "/current-plan/update-plan"),
PaymentMethodTypes: stripe.StringSlice([]string{
"card",
}),
Expand Down Expand Up @@ -3620,7 +3620,7 @@ func (r *mutationResolver) RequestAccess(ctx context.Context, projectID int) (*b
queryParams := url.Values{
"autoinvite_email": {*admin.Email},
}
inviteLink := fmt.Sprintf("%s/w/%d/team?%s", os.Getenv("FRONTEND_URI"), workspace.ID, queryParams.Encode())
inviteLink := fmt.Sprintf("%s/w/%d/team?%s", os.Getenv("REACT_APP_FRONTEND_URI"), workspace.ID, queryParams.Encode())
if _, err := r.SendWorkspaceRequestEmail(*admin.Name, *admin.Email, *workspace.Name,
*a.Name, *a.Email, inviteLink); err != nil {
log.WithContext(ctx).Error(e.Wrap(err, "failed to send request access email"))
Expand Down Expand Up @@ -7288,7 +7288,7 @@ func (r *queryResolver) GetSourceMapUploadUrls(ctx context.Context, apiKey strin

// CustomerPortalURL is the resolver for the customer_portal_url field.
func (r *queryResolver) CustomerPortalURL(ctx context.Context, workspaceID int) (string, error) {
frontendUri := os.Getenv("FRONTEND_URI")
frontendUri := os.Getenv("REACT_APP_FRONTEND_URI")

workspace, err := r.isAdminInWorkspace(ctx, workspaceID)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion backend/public-graph/graph/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@ func (r *Resolver) AddTrackProperties(ctx context.Context, sessionID int, events
if len(formattedVal) > 0 {
fields[k] = formattedVal
}
// the value below is used for testing using https://localhost:3000/buttons
// the value below is used for testing using /buttons
testTrackingMessage := "therewasonceahumblebumblebeeflyingthroughtheforestwhensuddenlyadropofwaterfullyencasedhimittookhimasecondtofigureoutthathesinaraindropsuddenlytheraindrophitthegroundasifhewasdivingintoapoolandheflewawaywithnofurtherissues"
if fields[k] == testTrackingMessage {
return e.New(testTrackingMessage)
Expand Down
4 changes: 2 additions & 2 deletions backend/stacktraces/enhancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func TestEnhanceStackTrace(t *testing.T) {
t.Fatalf("error creating storage client: %v", err)
}

fsClient, err := storage.NewFSClient(ctx, "https://localhost:8082/public", "")
fsClient, err := storage.NewFSClient(ctx, "http://localhost:8082/public", "")
if err != nil {
t.Fatalf("error creating storage client: %v", err)
}
Expand Down Expand Up @@ -257,7 +257,7 @@ func TestEnhanceStackTrace(t *testing.T) {

func TestGetURLSourcemap(t *testing.T) {
ctx := context.Background()
fsClient, err := storage.NewFSClient(ctx, "https://localhost:8082/public", "")
fsClient, err := storage.NewFSClient(ctx, "http://localhost:8082/public", "")
if err != nil {
t.Fatalf("error creating storage client: %v", err)
}
Expand Down
10 changes: 5 additions & 5 deletions backend/temp-alerts/temp-alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func SendErrorAlerts(ctx context.Context, db *gorm.DB, mailClient *sendgrid.Clie
log.WithContext(ctx).Error(err)
}

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
errorURL := fmt.Sprintf("%s/%d/errors/%s/instances/%d", frontendURL, obj.ProjectID, input.Group.SecureID, input.ErrorObject.ID)
errorURL = routing.AttachReferrer(ctx, errorURL, routing.Email)
sessionURL := fmt.Sprintf("%s/%d/sessions/%s", frontendURL, obj.ProjectID, input.SessionSecureID)
Expand Down Expand Up @@ -158,7 +158,7 @@ func SendSessionAlerts(ctx context.Context, db *gorm.DB, mailClient *sendgrid.Cl
log.WithContext(ctx).Error(err)
}

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
sessionURL := fmt.Sprintf("%s/%d/sessions/%s", frontendURL, obj.ProjectID, input.SessionSecureID)
alertUrl := fmt.Sprintf("%s/%d/alerts/logs/%d", frontendURL, obj.ProjectID, obj.ID)

Expand Down Expand Up @@ -322,7 +322,7 @@ func sendSlackAlert(ctx context.Context, db *gorm.DB, obj *model.Alert, input *S
return nil
}

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
suffix := ""
if input.QueryParams == nil {
input.QueryParams = make(map[string]string)
Expand Down Expand Up @@ -644,7 +644,7 @@ func GetLogAlertURL(projectId int, query string, startDate time.Time, endDate ti
queryStr := url.QueryEscape(query)
startDateStr := url.QueryEscape(startDate.Format("2006-01-02T15:04:05.000Z"))
endDateStr := url.QueryEscape(endDate.Format("2006-01-02T15:04:05.000Z"))
frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/logs?query=%s&start_date=%s&end_date=%s", frontendURL,
projectId, queryStr, startDateStr, endDateStr)
}
Expand Down Expand Up @@ -780,7 +780,7 @@ func SendSlackMetricMonitorAlert(ctx context.Context, obj *model.MetricMonitor,
slackClient = slack.New(*input.Workspace.SlackAccessToken)
}

frontendURL := os.Getenv("FRONTEND_URI")
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
alertUrl := fmt.Sprintf("%s/%d/alerts/monitor/%d", frontendURL, obj.ProjectID, obj.ID)

log.WithContext(ctx).Info("Sending Slack Alert for Metric Monitor")
Expand Down

0 comments on commit 29246b8

Please sign in to comment.