Skip to content

Commit

Permalink
Merge branch 'master' into cleanup-parameters-popover
Browse files Browse the repository at this point in the history
  • Loading branch information
uladzimirdev committed May 2, 2024
2 parents 5c96cf8 + ebe0e58 commit 9014dd8
Show file tree
Hide file tree
Showing 36 changed files with 659 additions and 117 deletions.
18 changes: 8 additions & 10 deletions docs/configuring-metabase/customizing-jetty-webserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ redirect_from:

In most cases there will be no reason to modify any of the settings around how Metabase runs its embedded Jetty webserver to host the application, but if you wish to run HTTPS directly with your Metabase server or if you need to run on another port, that's all configurable.

### Running Metabase on another port
## Running Metabase on another port

By default Metabase will launch on port 3000, but if you prefer to run the application on another port you can do so by setting the following environment variable:

Expand All @@ -17,25 +17,23 @@ By default Metabase will launch on port 3000, but if you prefer to run the appli

In this example once the application starts up you will access it on port `12345` instead of the default port of 3000.

## Listening on a specific network interface

### Listening on a specific network interface

By default, Metabase will be listening on `localhost`. In some production environments you may want to listen on a different interface, which can be done by using the `MB_JETTY_HOST` environment variable:
By default, Metabase will be listening on `localhost`. In some production environments you may want to listen on a different interface, which can be done by using the `MB_JETTY_HOST` environment variable:

export MB_JETTY_HOST=0.0.0.0
java -jar metabase.jar

## Using HTTPS with Metabase

### Using HTTPS with Metabase

If you have an SSL certificate and would prefer to have Metabase run over HTTPS directly using its webserver you can do so by using the following environment variables:
If you have an SSL certificate and would prefer to have Metabase run over HTTPS directly using its webserver, you can do so by using the following environment variables:

export MB_JETTY_SSL="true"
export MB_JETTY_SSL_PORT="8443"
export MB_JETTY_SSL_KEYSTORE="path/to/keystore.jks" # replace these values with your own
export MB_JETTY_SSL_KEYSTORE_PASSWORD="storepass"
export MB_JETTY_SSL_KEYSTORE="path/to/keystore.jks" # replace this value with your own
export MB_JETTY_SSL_KEYSTORE_PASSWORD="storepass" # replace this value with your own
java -jar metabase.jar

Be sure to replace `path/to/keystore.jks` and `storepass` with the correct path to and password for your [Java KeyStore](https://www.digitalocean.com/community/tutorials/java-keytool-essentials-working-with-java-keystores). With the above settings applied you will be running Metabase on port 8443 over HTTPS using the supplied certificate.

No idea how to generate a Java KeyStore yourself? This is sort of an advanced topic, but if you're feeling froggy you can read more about how to configure SSL in Jetty [in their own documentation](https://www.eclipse.org/jetty/documentation/jetty-9/index.html#configuring-ssl). Otherwise, you'll probably find it easiest to handle SSL termination outside of Metabase.
No idea how to generate a Java KeyStore yourself? This is sort of an advanced topic, but if you're feeling froggy you can read more about how to configure SSL in Jetty [in their own documentation](https://www.eclipse.org/jetty/documentation/jetty-9/index.html#configuring-ssl). Otherwise, you'll probably find it easiest to handle SSL termination outside of Metabase.
6 changes: 6 additions & 0 deletions docs/configuring-metabase/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ redirect_from:

Once you connect your database to Metabase, you'll want to configure an email account to send system notifications to your organization's users. Metabase uses email to reset passwords, onboard new users, and notify you when something happens.

To edit email settings:

1. Click on the **gear** icon in the upper right.
2. Select **Admin Settings**.
3. From the default **Settings** tab, click on **Email** in the left sidebar.

## Metabase Cloud

Metabase Cloud manages an email server for you, so you don't need to set up email (and you won't see SMTP settings in your Admin console).
Expand Down
43 changes: 23 additions & 20 deletions docs/installation-and-operation/running-metabase-on-debian.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ redirect_from:

For those people who don't (or can't) use Docker in their infrastructure, there's still a need to easily setup and deploy Metabase in production. On Debian-based systems, this means registering Metabase as a service that can be started/stopped/uninstalled.

**Note:** This is just a *bare-bones recipe* to get you started. Anyone can take it from here to do what they need to do on their systems, and should follow best practices for setting up and securing the rest of their server.
**Note:** This is just a _bare-bones recipe_ to get you started. Anyone can take it from here to do what they need to do on their systems, and should follow best practices for setting up and securing the rest of their server.

#### Assumptions
## Assumptions

The core assumption in this guide:

* You will run Metabase using the `metabase.jar` file
* You already have `nginx` and `postgres` (or another supported database) running on your server
* You will use environment variables to configure your Metabase instance
* You have `sudo` access on your server
- You will run Metabase using the `metabase.jar` file
- You already have `nginx` and `postgres` (or another supported database) running on your server
- You will use environment variables to configure your Metabase instance
- You have `sudo` access on your server

### Create an unprivileged user to run Metabase and give him acces to app and logs
## Create an unprivileged user to run Metabase and give the user access to app and logs

For security reasons we want to have Metabase run as an unprivileged user. We will call the user simply `metabase`. Further we will create the files we will need later for logging and configuration of Metabase, and apply the correct security settings for our unprivileged user.

Expand All @@ -32,11 +32,12 @@ sudo chown syslog:adm /var/log/metabase.log
sudo touch /etc/default/metabase
sudo chmod 640 /etc/default/metabase
```
### Create a Metabase Service

## Create a Metabase Service

Every service needs a script that tells `systemd` how to manage it, and what capabilities it supports. Services are typically registered at `/etc/systemd/system/<servicename>`. So, a Metabase service should live at `/etc/systemd/system/metabase.service`.

#### The Metabase service file
### The Metabase service file

Create the `/etc/systemd/system/metabase.service` service file and open it in your editor:

Expand Down Expand Up @@ -70,7 +71,7 @@ Restart=always
WantedBy=multi-user.target
```

### Create syslog conf
## Create syslog conf

Next we need to create a syslog conf to make sure systemd can handle the logs properly.

Expand All @@ -88,11 +89,11 @@ Restart the syslog service to load the new config.
sudo systemctl restart rsyslog.service
```

### Environment Variables for Metabase
## Environment variables for Metabase

Environment variables provide a good way to customize and configure your Metabase instance on your server. On Debian systems, services typically expect to have accompanying configs inside `etc/default/<service-name>`.
[Environment variables](../configuring-metabase/environment-variables.md) provide a good way to customize and configure your Metabase instance on your server. On Debian systems, services typically expect to have accompanying configs inside `etc/default/<service-name>`.

#### The Metabase config file
### The Metabase config file

Open your `/etc/default/metabase` environment config file in your editor:

Expand All @@ -116,15 +117,16 @@ MB_DB_HOST=<localhost>
MB_EMOJI_IN_LOGS=<true|false>
# any other env vars you want available to Metabase
```
### Final Steps

## Final steps

The best part of setting up Metabase as a service on a Debian-based system is to be confident it will start up at every system boot. We only have a few more quick steps to finish registering our service and having Metabase up and running.

#### Ensure your database is ready
### Ensure your database is ready

If you're running `postgres` or some other database, you need to ensure you've already followed the instructions for your database system to create a database for Metabase, as well as a user that can access that database. These values should match what you've set in your Metabase config for the `MB_DB_TYPE`, `MB_DB_DBNAME`, `MB_DB_USER`, and `MB_DB_PASS` environment variables. If you don't have your database properly configured, Metabase won't be able to start.

#### Ensure `nginx` is setup to proxy requests to Metabase
### Ensure `nginx` is setup to proxy requests to Metabase

Getting into too much detail about configuring `nginx` is well outside the scope of this guide, but here's a quick `nginx.conf` file that will get you up and running.

Expand All @@ -142,23 +144,24 @@ server {
}
}
```
#### Register your Metabase service

### Register your Metabase service

Now, it's time to register our Metabase service with `systemd` so it will start up at system boot. We'll also ensure our log file is created and owned by the unprivileged user our service runs the `metabase.jar` as.

```
sudo systemctl daemon-reload
sudo systemctl start metabase.service
sudo systemctl status metabase.service
````
```

Once we are ok here, enable the service to startup during boot.

```
sudo systemctl enable metabase.service
````
```

#### That's it!
## Start, stop, or restart Metabase

Now, whenever you need to start, stop, or restart Metabase, all you need to do is:

Expand Down
2 changes: 1 addition & 1 deletion docs/people-and-groups/authenticating-with-jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Currently, the only algorithm Metabase supports is [HS256](https://en.wikipedia.
Assuming your site is localhost serving on port 3000:

1. Person attempts to view a question, e.g., `http://localhost:3000/question/1-superb-question`.
2. If the person isn't logged in, Metabase redirects them to `http://localhost:3000/auth/sso/`.
2. If the person isn't logged in, Metabase redirects them to `http://localhost:3000/auth/sso`.
3. Retaining the original `/question/1-superb-question` URI, Metabase redirects the person to the SSO provider (the authentication app).
4. Person logs in using the basic form.
5. In the event of a successful sign-in, your authentication app should issue a GET request to your Metabase endpoint with the token and the "return to" URI: `http://localhost:3000/auth/sso?jwt=TOKEN_GOES_HERE&return_to=/question/1-superb-question`.
Expand Down
4 changes: 2 additions & 2 deletions docs/people-and-groups/authenticating-with-saml.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ However, the names of the fields in the Metabase SAML form won't always match th

### URL the IdP should redirect back to

The redirect URL is the web address that people will be sent to after signing in with your IdP. To redirect people to your Metabase, your redirect URL should be your Metabase [Site URL](../configuring-metabase/settings.md#site-url), with `/auth/sso/` at the end.
The redirect URL is the web address that people will be sent to after signing in with your IdP. To redirect people to your Metabase, your redirect URL should be your Metabase [Site URL](../configuring-metabase/settings.md#site-url), with `/auth/sso` at the end.

For example, if your Metabase Site URL is `https://metabase.yourcompany.com`, you'll use `https://metabase.yourcompany.com/auth/sso/` as the redirect URL in your IdP's SAML form.
For example, if your Metabase Site URL is `https://metabase.yourcompany.com`, you'll use `https://metabase.yourcompany.com/auth/sso` as the redirect URL in your IdP's SAML form.

Different IdPs use different names for the redirect URL. Here are some common examples:

Expand Down
2 changes: 1 addition & 1 deletion docs/people-and-groups/saml-auth0.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Enter “Metabase” as the application name with type “Regular Web Applicatio
Now go to Settings tab inside Auth0's Metabase App and fill in the following values:

- Application Login URI: the URL of your Metabase instance.
- Allowed Callback URLs: the URL that's below **Configure your identity provider (IdP)** in SAML settings inside Metabase (it ends with `/auth/sso/`).
- Allowed Callback URLs: the URL that's below **Configure your identity provider (IdP)** in SAML settings inside Metabase (it ends with `/auth/sso`).

![Auth0 SAML Settings Page](images/auth0callbackurl.png)

Expand Down
2 changes: 2 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ To see what's new, check out all the [major release announcements](https://www.m

## Metabase Enterprise Edition releases

- [v1.49.8](https://github.com/metabase/metabase/releases/tag/v1.49.8)
- [v1.49.7](https://github.com/metabase/metabase/releases/tag/v1.49.7)
- [v1.49.6](https://github.com/metabase/metabase/releases/tag/v1.49.6)
- [v1.49.5](https://github.com/metabase/metabase/releases/tag/v1.49.5)
Expand Down Expand Up @@ -160,6 +161,7 @@ To see what's new, check out all the [major release announcements](https://www.m

## Metabase Open Source Edition releases

- [v0.49.8](https://github.com/metabase/metabase/releases/tag/v0.49.8)
- [v0.49.7](https://github.com/metabase/metabase/releases/tag/v0.49.7)
- [v0.49.6](https://github.com/metabase/metabase/releases/tag/v0.49.6)
- [v0.49.5](https://github.com/metabase/metabase/releases/tag/v0.49.5)
Expand Down
12 changes: 6 additions & 6 deletions docs/troubleshooting-guide/saml.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ After filling out the authentication form with your identity provider, you're ta
**Steps to take**:

1. You should have received an XML file of metadata from your identity provider. Open that metadata file, and look for the correct issuer or entity ID. This ID is a unique identifier for the identity provider. Depending on your provider, the issuer or entity ID usually looks something like this:
```
http://www.example.com/141xkex604w0Q5PN724v
```
```
http://www.example.com/141xkex604w0Q5PN724v
```
2. Copy the issuer or entity ID from the XML file.
3. Go to Metabase and select **Admin settings** > **Settings** > **Authentication** > **SAML**. Enter the issuer or entity ID into the **SAML Identity Provider Issuer** field.

Expand All @@ -37,13 +37,13 @@ After filling out the authentication form with your identity provider, you go ba

1. Go to Metabase and select **Admin settings** > **Settings** > **Authentication** > **SAML**. Check that the certificate that you entered into the **SAML Identity Provider Certificate** field matches the certificate in the XML file you got from your identity provider.

- Depending on your provider, you might need to download the XML file, open it in a text editor, then copy and paste the certificate's contents into the **SAML Identity Provider Certificate** field in Metabase.
- Depending on your provider, you might need to download the XML file, open it in a text editor, then copy and paste the certificate's contents into the **SAML Identity Provider Certificate** field in Metabase.

- Note that your certificate text may include header and footer comments that look like `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. These comments should be included when pasting your certificate text into Metabase.
- Note that your certificate text may include header and footer comments that look like `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. These comments should be included when pasting your certificate text into Metabase.

## Is the SSO URL correct?

Verify that the Single Sign On URL (or equivalent) that you enter on your SAML provider’s website has `/auth/sso/` appended to it. For instance, if you want your users to end up at `https://metabase.mycompany.com`, the full URL should be `https://metabase.mycompany.com/auth/sso/`.
Verify that the Single Sign On URL (or equivalent) that you enter on your SAML provider’s website has `/auth/sso` appended to it. For instance, if you want your users to end up at `https://metabase.mycompany.com`, the full URL should be `https://metabase.mycompany.com/auth/sso`.

## Searching for private key and found a null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,126 @@ describe("scenarios > dashboard > filters > management", () => {
cy.log("verify Date default value: Is");
verifyOperatorValue("Is");
});

it("should use saved parameter value when user switches back to the saved filter type", () => {
const textFilter = createMockParameter({
name: "Text Text",
slug: "string",
id: "5aefc726",
type: "string/does-not-contain",
sectionId: "string",
});

const peopleQuestionDetails = {
query: { "source-table": PEOPLE_ID, limit: 5 },
};

cy.createDashboardWithQuestions({
dashboardDetails: {
parameters: [textFilter],
},
questions: [peopleQuestionDetails],
}).then(({ dashboard, questions: cards }) => {
const [peopleCard] = cards;

updateDashboardCards({
dashboard_id: dashboard.id,
cards: [
{
card_id: peopleCard.id,
parameter_mappings: [
{
parameter_id: textFilter.id,
card_id: peopleCard.id,
target: ["dimension", ["field", PEOPLE.NAME, null]],
},
],
},
],
});

visitDashboard(dashboard.id);
});

editDashboard();

selectFilter("Text Text");

sidebar().findByDisplayValue("Does not contain").should("exist");

changeFilterType("Number");

// default value for a number type
sidebar().findByDisplayValue("Equal to").should("exist");

changeFilterType("Text or Category");

cy.log("verify the saved parameter value is restored");
sidebar().within(() => {
cy.findByDisplayValue("Does not contain").should("exist");
cy.findByDisplayValue("Text or Category").should("exist");
cy.findByDisplayValue("Text Text").should("exist");
});
});

it("should restore parameter mappings when user switches back to the saved parameter type", () => {
const textFilter = createMockParameter({
name: "Text Text",
slug: "string",
id: "5aefc726",
type: "string/does-not-contain",
sectionId: "string",
});

const peopleQuestionDetails = {
query: { "source-table": PEOPLE_ID, limit: 5 },
};

cy.createDashboardWithQuestions({
dashboardDetails: {
parameters: [textFilter],
},
questions: [peopleQuestionDetails],
}).then(({ dashboard, questions: cards }) => {
const [peopleCard] = cards;

updateDashboardCards({
dashboard_id: dashboard.id,
cards: [
{
card_id: peopleCard.id,
parameter_mappings: [
{
parameter_id: textFilter.id,
card_id: peopleCard.id,
target: ["dimension", ["field", PEOPLE.NAME, null]],
},
],
},
],
});

visitDashboard(dashboard.id);
});

editDashboard();

selectFilter("Text Text");

sidebar().findByDisplayValue("Does not contain").should("exist");

getDashboardCard().should("contain", "Person.Name");

changeFilterType("Number");

cy.log("verify that mapping is cleared");
getDashboardCard().should("not.contain", "Person.Name");

changeFilterType("Text or Category");

cy.log("verify that mapping is restored");
getDashboardCard().should("contain", "Person.Name");
});
});

describe("change parameter operator", () => {
Expand Down

0 comments on commit 9014dd8

Please sign in to comment.