Skip to content

Commit 894b727

Browse files
merge main
2 parents 557ee10 + 881bc00 commit 894b727

File tree

345 files changed

+2758
-1572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

345 files changed

+2758
-1572
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<div align="center">
3030

31-
[Docs](https://docs.rilldata.com/)[Install](https://docs.rilldata.com/home/install)[Quickstart](https://docs.rilldata.com/get-started/quickstart)[Guides](https://docs.rilldata.com/guides)[Reference](https://docs.rilldata.com/reference/project-files)
31+
[Docs](https://docs.rilldata.com/)[Install](https://docs.rilldata.com/developers/get-started/install)[Quickstart](https://docs.rilldata.com/developers/get-started/quickstart)[Guides](https://docs.rilldata.com/developers/guides)[Reference](https://docs.rilldata.com/reference/project-files)
3232

3333
</div>
3434

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
UPDATE deployments
2+
SET desired_status = CASE
3+
WHEN status IN (1, 2, 4, 6) THEN 2 -- Pending, Running, Errored, Updating -> Running
4+
WHEN status IN (5, 7) THEN 5 -- Stopped, Stopping -> Stopped
5+
WHEN status IN (8, 9) THEN 9 -- Deleting, Deleted -> Deleted
6+
ELSE 2 -- Default to Running for any other case
7+
END
8+
WHERE desired_status = 0;

admin/github.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ func (s *Service) processGithubPush(ctx context.Context, event *github.PushEvent
355355
// Don't trigger runtime reconcile for dev deployments, let the user manually pull changes to avoid any conflicts
356356
continue
357357
}
358-
// We don't trigger runtime reconcile if the deployment is not ready
359-
if depl.Status != database.DeploymentStatusRunning {
358+
// Only trigger a reconcile for running/updating deployments.
359+
// NOTE: Including "updating" here to avoid race conditions when there's a push and env config update happening simultaneously.
360+
if depl.Status != database.DeploymentStatusRunning && depl.Status != database.DeploymentStatusUpdating {
360361
s.Logger.Info("process github event: runtime reconcile not triggered, deployment is not ready", zap.String("project_id", project.ID), zap.String("deployment_id", depl.ID), zap.String("deployment_status", depl.Status.String()), observability.ZapCtx(ctx))
361362
continue
362363
}

admin/jobs/river/reconcile_deployment.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/rilldata/rill/admin/database"
1010
"github.com/rilldata/rill/runtime/pkg/observability"
1111
"github.com/riverqueue/river"
12+
"go.opentelemetry.io/otel/attribute"
1213
"go.uber.org/zap"
1314
)
1415

@@ -28,6 +29,7 @@ type ReconcileDeploymentWorker struct {
2829
// such as starting, updating, stopping, and deleting deployments.
2930
// We handle all deployment state transitions in this job to ensure consistency and to avoid concurrent conflicting operations on the same deployment.
3031
func (w *ReconcileDeploymentWorker) Work(ctx context.Context, job *river.Job[ReconcileDeploymentArgs]) error {
32+
observability.AddRequestAttributes(ctx, attribute.String("args.deployment_id", job.Args.DeploymentID))
3133
depl, err := w.admin.DB.FindDeployment(ctx, job.Args.DeploymentID)
3234
if err != nil {
3335
if errors.Is(err, database.ErrNotFound) {

admin/server/server.go

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,20 @@ func (s *Server) HTTPHandler(ctx context.Context) (http.Handler, error) {
179179
adminv1.RegisterAIServiceServer(grpcServer, s)
180180
adminv1.RegisterTelemetryServiceServer(grpcServer, s)
181181

182+
// Prepare CORS config.
183+
// We currently only add CORS config on the transcoder and runtime proxy handlers.
184+
// Other endpoints here don't need CORS config because they should not be used in cross-origin browser requests.
185+
transcoderCORSMiddleware := cors.New(newCORSOptions(s.opts.AllowedOrigins, true)).Handler // Allow cookies for calls from ui.rilldata.com to admin.rilldata.com
186+
runtimeProxyCORSMiddleware := cors.New(newCORSOptions([]string{"*"}, false)).Handler // Allow any origin but no cookies. In the longer term, we should add explicit domain allowlisting per org or project.
187+
182188
// Add gRPC and gRPC-to-REST transcoder.
183189
// This will be the fallback for REST routes like `/v1/ping` and GPRC routes like `/rill.admin.v1.AdminService/Ping`.
190+
var transcoder http.Handler
184191
transcoder, err := vanguardgrpc.NewTranscoder(grpcServer)
185192
if err != nil {
186193
return nil, fmt.Errorf("failed to create transcoder: %w", err)
187194
}
195+
transcoder = transcoderCORSMiddleware(transcoder)
188196

189197
// Add auth cookie refresh specifically for the GetCurrentUser RPC.
190198
// This is sufficient to refresh the cookie on each page load without unnecessarily refreshing cookies in each API call.
@@ -195,14 +203,14 @@ func (s *Server) HTTPHandler(ctx context.Context) (http.Handler, error) {
195203
mux.Handle("/rill.admin.v1.AIService/", transcoder)
196204
mux.Handle("/rill.admin.v1.TelemetryService/", transcoder)
197205

198-
// Add runtime proxy
206+
// Add runtime proxy.
199207
proxyHandler := observability.Middleware(
200208
"runtime-proxy",
201209
s.logger,
202-
s.authenticator.HTTPMiddlewareLenient(httputil.Handler(s.runtimeProxyForOrgAndProject)),
210+
runtimeProxyCORSMiddleware(s.authenticator.HTTPMiddlewareLenient(httputil.Handler(s.runtimeProxyForOrgAndProject))),
203211
)
204-
observability.MuxHandle(mux, "/v1/orgs/{org}/projects/{project}/runtime/{path...}", proxyHandler) // Backwards compatibility
205-
observability.MuxHandle(mux, "/v1/organizations/{org}/projects/{project}/runtime/{path...}", proxyHandler)
212+
observability.MuxHandle(mux, "/v1/orgs/{org}/projects/{project}/runtime/{path...}", proxyHandler)
213+
observability.MuxHandle(mux, "/v1/organizations/{org}/projects/{project}/runtime/{path...}", proxyHandler) // Backwards compatibility
206214

207215
// Add backwards compatibility alias for iframe endpoint
208216
observability.MuxHandle(mux, "/v1/organizations/{org}/projects/{project}/iframe", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -260,44 +268,9 @@ func (s *Server) HTTPHandler(ctx context.Context) (http.Handler, error) {
260268
// }
261269
// })
262270

263-
// Build CORS options for admin server
264-
265-
// If the AllowedOrigins contains a "*" we want to return the requester's origin instead of "*" in the "Access-Control-Allow-Origin" header.
266-
// This is useful in development. In production, we set AllowedOrigins to non-wildcard values, so this does not have security implications.
267-
// Details: https://github.com/rs/cors#allow--with-credentials-security-protection
268-
var allowedOriginFunc func(string) bool
269-
allowedOrigins := s.opts.AllowedOrigins
270-
for _, origin := range s.opts.AllowedOrigins {
271-
if origin == "*" {
272-
allowedOriginFunc = func(origin string) bool { return true }
273-
allowedOrigins = nil
274-
break
275-
}
276-
}
277-
278-
corsOpts := cors.Options{
279-
AllowedOrigins: allowedOrigins,
280-
AllowOriginFunc: allowedOriginFunc,
281-
AllowedMethods: []string{
282-
http.MethodHead,
283-
http.MethodGet,
284-
http.MethodPost,
285-
http.MethodPut,
286-
http.MethodPatch,
287-
http.MethodDelete,
288-
},
289-
AllowedHeaders: []string{"*"},
290-
// We use cookies for browser sessions, so this is required to allow ui.rilldata.com to make authenticated requests to admin.rilldata.com
291-
AllowCredentials: true,
292-
// Set max age to 1 hour (default if not set is 5 seconds)
293-
MaxAge: 60 * 60,
294-
}
295-
296-
// Wrap mux with CORS middleware
297-
handlerWithAuth := s.authenticator.CookieToAuthHeader(mux)
298-
handlerWithCors := cors.New(corsOpts).Handler(handlerWithAuth)
299-
handler := middleware.TraceMiddleware(handlerWithCors)
300-
271+
// Wrap mux with final middleware and return
272+
handler := s.authenticator.CookieToAuthHeader(mux) // Convert auth cookies to Authorization headers
273+
handler = middleware.TraceMiddleware(handler) // OpenTelemetry tracing
301274
return handler, nil
302275
}
303276

@@ -505,3 +478,38 @@ func checkUserAgent(ctx context.Context) (context.Context, error) {
505478

506479
return ctx, nil
507480
}
481+
482+
// newCORSOptions creates config for the CORS middleware.
483+
// It supports passing a wildcard "*" in allowed origins to allow all origins.
484+
// Pass allowCredentials=true to allow cookies to be sent in CORS requests (necessary for endpoints accessed from ui.rilldata.com).
485+
func newCORSOptions(allowedOrigins []string, allowCredentials bool) cors.Options {
486+
// If the AllowedOrigins contains a "*" we want to return the requester's origin instead of "*" in the "Access-Control-Allow-Origin" header.
487+
// This is useful in development. In production, we set AllowedOrigins to non-wildcard values, so this does not have security implications.
488+
// Details: https://github.com/rs/cors#allow--with-credentials-security-protection
489+
var allowedOriginFunc func(string) bool
490+
for _, origin := range allowedOrigins {
491+
if origin == "*" {
492+
allowedOriginFunc = func(origin string) bool { return true }
493+
allowedOrigins = nil
494+
break
495+
}
496+
}
497+
498+
return cors.Options{
499+
AllowedOrigins: allowedOrigins,
500+
AllowOriginFunc: allowedOriginFunc,
501+
AllowedMethods: []string{
502+
http.MethodHead,
503+
http.MethodGet,
504+
http.MethodPost,
505+
http.MethodPut,
506+
http.MethodPatch,
507+
http.MethodDelete,
508+
},
509+
AllowedHeaders: []string{"*"},
510+
// We use cookies for browser sessions, so this must be true on endpoints that ui.rilldata.com access on admin.rilldata.com.
511+
AllowCredentials: allowCredentials,
512+
// Set max age to 1 hour (default if not set is 5 seconds)
513+
MaxAge: 60 * 60,
514+
}
515+
}

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `docs/`
22

3-
[![Netlify Status](https://api.netlify.com/api/v1/badges/23baf08e-2d3e-44db-8bd4-938e54467a29/deploy-status)](https://app.netlify.com/sites/rill-developer/deploys)
3+
[![Netlify Status](https://api.netlify.com/api/v1/badges/23baf08e-2d3e-44db-8bd4-938e54467a29/deploy-status)](https://app.netlify.com/sites/rill-developers/deploys)
44

55
This folder contains docs for Rill, generated using [Docusaurus](https://docusaurus.io/) and deployed to [https://docs.rilldata.com](https://docs.rilldata.com).
66

docs/blog/0.10.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ description: Rill is the world's first AI-native business intelligence tool. Tru
1010
:::note
1111
⚡ Rill Developer is a tool that makes it effortless to transform your datasets with SQL and create powerful, opinionated dashboards. These are our release notes for our `0.10` release, still in Tech Preview.
1212

13-
[To try out Rill Developer, check out these instructions](/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
13+
[To try out Rill Developer, check out these instructions](/developers/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
1414
:::
1515

1616
In our 0.6 release of Rill Developer we introduced dashboard leaderboards that present the top 7 dimension values for a given measure. Understanding the leads of each dimension helps us understand major players, but it is is hard to go deeper when you can only select 1 metric at a time for the very top of the pack. In the 0.10 release of Rill Developer we introduce *expanded leaderboard tables* to help you make these comparisons easily and focus on the impact of more segments.
1717

1818
- **Expanded leaderboard metrics —** When we are exploring aggregated measures we want to be able to compare dimension values and see additional values beyond the top 7 when they are focused on a specific dimension’s impact. Our new dimension tables expand your leaderboards to provide a deeper view into all of your metrics for the top 250 values. You can use these values as filters.
1919

20-
- **Nightly binaries —** Want to stay on the bleeding edge of our development? We have added support for nightly builds of our fast install binaries. You can easily switch between the [production release](/get-started/install) and the nightly build by re-running the script for the version you want. Try it yourself using our nightly build script:
20+
- **Nightly binaries —** Want to stay on the bleeding edge of our development? We have added support for nightly builds of our fast install binaries. You can easily switch between the [production release](/developers/get-started/install) and the nightly build by re-running the script for the version you want. Try it yourself using our nightly build script:
2121

2222
`curl -s [https://cdn.rilldata.com/install.sh](https://cdn.rilldata.com/install.sh) | bash -s -- --nightly`
2323

docs/blog/0.11.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: Rill is the world's first AI-native business intelligence tool. Tru
1111
:::note
1212
⚡ Rill Developer is a tool that makes it effortless to transform your datasets with SQL and create powerful, opinionated dashboards. These are our release notes for our `0.11` release, still in Tech Preview.
1313

14-
[To try out Rill Developer, check out these instructions](/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
14+
[To try out Rill Developer, check out these instructions](/developers/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
1515
:::
1616

1717

docs/blog/0.12.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: Rill is the world's first AI-native business intelligence tool. Tru
1111
:::note
1212
⚡ Rill Developer is a tool that makes it effortless to transform your datasets with SQL and create powerful, opinionated dashboards. These are our release notes for our `0.12` release, still in Tech Preview.
1313

14-
[To try out Rill Developer, check out these instructions](/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
14+
[To try out Rill Developer, check out these instructions](/developers/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
1515
:::
1616

1717

docs/blog/0.13.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ description: Rill is the world's first AI-native business intelligence tool. Tru
1111
:::note
1212
⚡ Rill Developer is a tool that makes it effortless to transform your datasets with SQL and create powerful, opinionated dashboards. These are our release notes for our `0.13` release, still in Tech Preview.
1313

14-
[To try out Rill Developer, check out these instructions](/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
14+
[To try out Rill Developer, check out these instructions](/developers/get-started/install) and [let us know over on Discord](https://discord.gg/2ubRfjC7Rh) if you encounter any problems or have ideas about how to improve Rill Developer!
1515
:::
1616

1717

1818
Historically in Rill Developer it could be cumbersome to maintain fresh data sources through the local file system. Keeping data sources fresh and relevant to your current questions helps you proactively address what is happening in real time. If data is being collected over time and stored in a data warehouse, you would need to repeatedly track down, download, and import the files you care about to utilize the power of Rill. The process of refreshing data shouldn’t feel like a barrier to exploring the current trends.
1919

2020
In this release of Rill Developer we have added the ability to bring remotely stored files from GCS / S3 into your local Rill application through a remote connection. This gives you all of the incredible analytical power of DuckDB with Rill's powerful profiling and exploratory dashboard. Try Rill connections and spend less time digging in your data warehouse for the latest files and more time exploring what insights they hold.
2121

22-
NOTE: We will not support Docker and npm install paths moving forward to help us focus on a high quality binary install experience. Please try Rill with our [binary](/get-started/install) moving forward.
22+
NOTE: We will not support Docker and npm install paths moving forward to help us focus on a high quality binary install experience. Please try Rill with our [binary](/developers/get-started/install) moving forward.
2323

2424
- **S3 and GCS stored file connections —** Connections keep your local data fresh and evergreen by establishing the location and credentials needed to access your data stored in the cloud. Our S3 and GCS connectors bring remote parquet and CSV files into Rill Developer’s sources for exploration with the click of a button. Each time the source is refreshed it will fully replace the current source with the remote file keeping your models and dashboards current over time. Rill picks up your local environment credentials to access protected remote files making it extremely low-touch to get started. Check out [our documentation](https://docs.rilldata.com/) to learn more.
2525
- **Making your experience better —** This release included many fixes to ensure we are providing a more cohesive application experience. We aligned interactions across different surfaces, reviewed our use of color, revised our copy, fixed browser some jank, and corrected performance regressions. A few of our notable contributions include:

0 commit comments

Comments
 (0)