Skip to content

Commit

Permalink
Merge pull request #250 from cloudian/kschung/HIQ-973
Browse files Browse the repository at this point in the history
HIQ-973   Create Cloudian-customized version of Grafana 9
  • Loading branch information
kashingchungcloudian authored Jan 11, 2024
2 parents 7725977 + 20919b7 commit 515cf34
Show file tree
Hide file tree
Showing 117 changed files with 245 additions and 662 deletions.
11 changes: 0 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,6 @@ ENV BUILD_BRANCH=${BUILD_BRANCH}

RUN make build-go GO_BUILD_TAGS=${GO_BUILD_TAGS} WIRE_TAGS=${WIRE_TAGS}

FROM ${BASE_IMAGE} as tgz-builder

WORKDIR /tmp/grafana

ARG GRAFANA_TGZ="grafana-latest.linux-x64-musl.tar.gz"

COPY ${GRAFANA_TGZ} /tmp/grafana.tar.gz

# add -v to make tar print every file it extracts
RUN tar x -z -f /tmp/grafana.tar.gz --strip-components=1

# helpers for COPY --from
FROM ${GO_SRC} as go-src
FROM ${JS_SRC} as js-src
Expand Down
42 changes: 42 additions & 0 deletions cloudian_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh -e

# Log in to quay.io
if [ -z $QUAY_IO_CREDENTIALS ]; then
echo Must set QUAY_IO_CREDENTIALS before running this script
exit 1
fi
USERNAME=$(echo $QUAY_IO_CREDENTIALS | cut -d: -f1)
PASSWORD=$(echo $QUAY_IO_CREDENTIALS | cut -d: -f2)
if echo "$QUAY_IO_CREDENTIALS" | grep -vq ":"; then
echo QUAY_IO_CREDENTIALS must be in the format username:password
exit 1
fi
echo $PASSWORD | docker login quay.io -u $USERNAME --password-stdin

cd $(dirname $0)

# Determine TAG for this build
REPO=quay.io/cloudian/grafana
TAG=$(git describe)

# Strip off Git commit for release build
if [ "$1" = "release" ]; then
TAG=$(echo $TAG | cut -d- -f1-2)
fi

# Call standard build script. Use --fast so it builds only for x64
packaging/docker/build.sh --fast $TAG $REPO

# Don't include leading 'v' from the repository tag
if echo "$TAG" | grep -q "^v"; then
TAG=$(echo "$TAG" | cut -b2-)
fi

# Send to quay.io
docker push $REPO:$TAG

# If we're doing a release build, update the latest tag
if [ "$1" = "release" ]; then
docker tag $REPO:$TAG $REPO:latest
docker push $REPO:latest
fi
2 changes: 1 addition & 1 deletion conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ enabled = true
#################################### Alerting ############################
[alerting]
# Enable the legacy alerting sub-system and interface. If Unified Alerting is already enabled and you try to go back to legacy alerting, all data that is part of Unified Alerting will be deleted. When this configuration section and flag are not defined, the state is defined at runtime. See the documentation for more details.
enabled =
enabled = true

# Makes it possible to turn off alert execution but alerting UI is visible
execute_alerts = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ In this task you configure Grafana Enterprise to validate the license with AWS i
### Task 4: Start or restart Grafana

1. To restart Grafana and activate your license, update the service running Grafana to use the latest revision of the task definition that you created.
1. After you update the service, navigate to your Grafana instance, sign in with Grafana Admin credentials, and navigate to **Administration > Stats and license** to validate that your license is active.
1. After you update the service, navigate to your Grafana instance, sign in with Admin credentials, and navigate to **Administration > Stats and license** to validate that your license is active.

For more information about validating that your license is active, refer to [Grafana Enterprise license restrictions]({{< relref "../../#grafana-enterprise-license-restrictions" >}}).
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ To restart Grafana on a Kubernetes cluster,
1. Run the command `kubectl rollout restart deployment my-release`.
1. After you update the service, navigate to your Grafana instance, sign in with Grafana Admin credentials, and navigate to **Administration > Stats and license** to validate that your license is active.
1. After you update the service, navigate to your Grafana instance, sign in with Admin credentials, and navigate to **Administration > Stats and license** to validate that your license is active.
For more information about restarting Grafana, refer to [Restart Grafana]({{< relref "../../../../setup-grafana/start-restart-grafana/" >}}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Grafana allows you to manage certain aspects of your user account, including you

You can also view important information about your account, such as the organizations and roles to which you are assigned and the Grafana sessions associated with your account.

## Change your Grafana password
## Change your password

You can change your Grafana password at any time.
You can change your password at any time.

> **Note**: If your Grafana instance uses an <!--[external authentication provider]({{< relref "../../../setup-grafana/configure-security/configure-authentication/" >}})--> external authentication provider, then you might not be able to change your password in Grafana. Contact your Grafana administrator for more information.
Expand Down
6 changes: 3 additions & 3 deletions docs/sources/dashboards/create-reports/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ You can generate and save PDF files of any dashboard.
1. On the PDF tab, select a layout option for the exported dashboard: **Portrait** or **Landscape**.
1. Click **Save as PDF** to render the dashboard as a PDF file.

Grafana opens the PDF file in a new window or browser tab.
It opens the PDF file in a new window or browser tab.

## Send a report via the API

Expand Down Expand Up @@ -249,11 +249,11 @@ You can customize the branding options.

Report branding:

- **Company logo:** Company logo displayed in the report PDF. It can be configured by specifying a URL, or by uploading a file. Defaults to the Grafana logo.
- **Company logo:** Company logo displayed in the report PDF. It can be configured by specifying a URL, or by uploading a file. Defaults to the Cloudian logo.

Email branding:

- **Company logo:** Company logo displayed in the report email. It can be configured by specifying a URL, or by uploading a file. Defaults to the Grafana logo.
- **Company logo:** Company logo displayed in the report email. It can be configured by specifying a URL, or by uploading a file. Defaults to the Cloudian logo.
- **Email footer:** Toggle to enable the report email footer. Select **Sent by** or **None**.
- **Footer link text:** Text of the link in the report email footer. Defaults to `Grafana`.
- **Footer link URL:** Link of the report email footer.
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/dashboards/share-dashboards-panels/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ You can generate and save PDF files of any dashboard.
1. On the PDF tab, select a layout option for the exported dashboard: **Portrait** or **Landscape**.
1. Click **Save as PDF** to render the dashboard as a PDF file.

Grafana opens the PDF file in a new window or browser tab.
It opens the PDF file in a new window or browser tab.

## Share a panel

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/old-alerting/view-alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ You can do several things while viewing alerts.
- **Filter alerts by name -** Type an alert name in the **Search alerts** field.
- **Filter alerts by state -** In **States**, select which alert states you want to see. All others will be hidden.
- **Pause or resume an alert -** Click the **Pause** or **Play** icon next to the alert to pause or resume evaluation. See [Pause an alert rule]({{< relref "pause-an-alert-rule/" >}}) for more information.
- **Access alert rule settings -** Click the alert name or the **Edit alert rule** (gear) icon. Grafana opens the Alert tab of the panel where the alert rule is defined. This is helpful when an alert is firing but you don't know which panel it is defined in.
- **Access alert rule settings -** Click the alert name or the **Edit alert rule** (gear) icon. It opens the Alert tab of the panel where the alert rule is defined. This is helpful when an alert is firing but you don't know which panel it is defined in.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ menutitle: Send panel to support
weight: 100
---

# Send a panel to Grafana Labs support
# Send a panel to Labs support

When you encounter problems with any of your visualizations, you can send the panel JSON model to Grafana Labs Technical Support and request help with troubleshooting your issue.

Expand All @@ -22,7 +22,7 @@ The panel that you send includes all query response data and all visualizations

1. Click the menu and select **More > Get help**.

Grafana opens a standalone support dashboard that contains the data you are sending to Grafana Labs Technical Support.
It opens a standalone support dashboard that contains the data you are sending to Grafana Labs Technical Support.

If you enable iframes, the support dashboard includes the visualization that looks similar to the following image.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ return &backend.SubscribeStreamResponse{
}, nil
```

As soon as the first subscriber joins a channel Grafana opens a unidirectional stream to consume streaming frames from a plugin. To handle this and to push data towards clients we implement a `RunStream` method which provides a way to push JSON data into a channel. So we can push data frame like this (error handling skipped):
As soon as the first subscriber joins a channel it opens a unidirectional stream to consume streaming frames from a plugin. To handle this and to push data towards clients we implement a `RunStream` method which provides a way to push JSON data into a channel. So we can push data frame like this (error handling skipped):

```go
// Send frame to stream including both frame schema and data frame parts.
Expand All @@ -147,7 +147,7 @@ _ = sender.SendFrame(frame, data.IncludeAll)

Open example datasource query editor and make sure `With Streaming` toggle is on. After doing this you should see data displayed and then periodically updated by streaming frames coming periodically from `RunStream` method.

The important thing to note is that Grafana opens a unidirectional stream only once per channel upon the first subscriber joined. Every other subscription request will be still authorized by `SubscribeStream` method but the new `RunStream` won't be issued. I.e. you can have many active subscribers but only one running stream. At this moment this guarantee works for a single Grafana instance, we are planning to support this for highly-available Grafana setup (many Grafana instances behind load-balancer) in future releases.
The important thing to note is that it opens a unidirectional stream only once per channel upon the first subscriber joined. Every other subscription request will be still authorized by `SubscribeStream` method but the new `RunStream` won't be issued. I.e. you can have many active subscribers but only one running stream. At this moment this guarantee works for a single Grafana instance, we are planning to support this for highly-available Grafana setup (many Grafana instances behind load-balancer) in future releases.

The stream will be automatically closed as soon as all subscriber users left.

Expand Down
2 changes: 1 addition & 1 deletion emails/templates/reset_password.mjml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<mj-head>
<!-- ⬇ Don't forget to specifify an email subject below! ⬇ -->
<mj-title>
{{ Subject .Subject .TemplateData "Reset your Grafana password - {{.Name}}" }}
{{ Subject .Subject .TemplateData "Reset your HyperIQ password - {{.Name}}" }}
</mj-title>
<mj-include path="./partials/layout/head.mjml" />
</mj-head>
Expand Down
2 changes: 1 addition & 1 deletion emails/templates/reset_password.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[[HiddenSubject .Subject "Reset your Grafana password - [[.Name]]"]]
[[HiddenSubject .Subject "Reset your HyperIQ password - [[.Name]]"]]

Hi [[.Name]],

Expand Down
4 changes: 2 additions & 2 deletions packages/grafana-data/src/themes/createColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ class DarkColors implements ThemeColorsBase<Partial<ThemeRichColor>> {
};

gradients = {
brandHorizontal: 'linear-gradient(270deg, #F55F3E 0%, #FF8833 100%)',
brandVertical: 'linear-gradient(0.01deg, #F55F3E 0.01%, #FF8833 99.99%)',
brandHorizontal: 'linear-gradient(270deg, #c1d500 0%, #ffffff 100%)',
brandVertical: 'linear-gradient(0.01deg, #c1d500 0.01%, #ffffff 99.99%)',
};

contrastThreshold = 3;
Expand Down
1 change: 1 addition & 0 deletions packages/grafana-data/src/themes/createV1Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export function createV1Theme(theme: Omit<GrafanaTheme2, 'v1'>): GrafanaTheme {
gray7: '#fbfbfb', // not used in dark theme
redBase: '#e02f44',
redShade: '#c4162a',
green: '#b7eb19',
greenBase: '#299c46',
greenShade: '#23843b',
red: '#d44a3a',
Expand Down
1 change: 1 addition & 0 deletions packages/grafana-data/src/types/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export interface GrafanaTheme extends GrafanaThemeCommons {
// Accent colors
redBase: string;
redShade: string;
green: string;
greenBase: string;
greenShade: string;
red: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/grafana-ui/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const mainConfig: StorybookConfig = {
{ from: '../../../public/fonts', to: '/public/fonts' },
{ from: '../../../public/img/grafana_text_logo-dark.svg', to: '/public/img/grafana_text_logo-dark.svg' },
{ from: '../../../public/img/grafana_text_logo-light.svg', to: '/public/img/grafana_text_logo-light.svg' },
{ from: '../../../public/img/fav32.png', to: '/public/img/fav32.png' },
{ from: '../../../public/img/cloudian_logo_alt.png', to: '/public/img/cloudian_logo_alt.png' },
{ from: '../../../public/lib', to: '/public/lib' },
...iconPaths,
],
Expand Down
2 changes: 1 addition & 1 deletion packages/grafana-ui/.storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<link rel="icon" href="public/img/fav32.png" />
<link rel="icon" href="public/img/cloudian_logo_alt.png" />
<!--Rudderstack-->
<script type="text/javascript">
!function(){var e=window.rudderanalytics=window.rudderanalytics||[];e.methods=["load","page","track","identify","alias","group","ready","reset","getAnonymousId","setAnonymousId"],e.factory=function(t){return function(){var r=Array.prototype.slice.call(arguments);return r.unshift(t),e.push(r),e}};for(var t=0;t<e.methods.length;t++){var r=e.methods[t];e[r]=e.factory(r)}e.loadJS=function(e,t){var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://rsdk.grafana.com";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a)},e.loadJS(),
Expand Down
2 changes: 1 addition & 1 deletion packages/grafana-ui/src/components/Tabs/VerticalTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const getTabStyles = (theme: GrafanaTheme2) => {
bottom: 2px;
top: 2px;
border-radius: ${theme.shape.radius.default};
background-image: linear-gradient(0deg, #f05a28 30%, #fbca0a 99%);
background-image: linear-gradient(0deg, #c1d500 30%, #9a989b 60%, #ffffff 99%);
}
`,
suffix: css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const Examples: ComponentStory<typeof ToolbarButton> = (args) => {
<ToolbarButtonRow>
<ToolbarButton>Just text</ToolbarButton>
<ToolbarButton icon="sync" tooltip="Sync" />
<ToolbarButton imgSrc="./grafana_icon.svg">With imgSrc</ToolbarButton>
<ToolbarButton imgSrc="./cloudian_logo.png">With imgSrc</ToolbarButton>
<ToolbarButton icon="cloud" isOpen={true}>
isOpen
</ToolbarButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export const Basic: ComponentStory<typeof ToolbarButtonRow> = (args) => {
<ToolbarButtonRow {...args}>
<ToolbarButton>Just text</ToolbarButton>
<ToolbarButton icon="sync" tooltip="Sync" />
<ToolbarButton imgSrc="./grafana_icon.svg">With imgSrc</ToolbarButton>
<ToolbarButton imgSrc="./cloudian_logo.png">With imgSrc</ToolbarButton>
<ToolbarButton>Just text</ToolbarButton>
<ToolbarButton icon="sync" tooltip="Sync" />
<ToolbarButton imgSrc="./grafana_icon.svg">With imgSrc</ToolbarButton>
<ToolbarButton imgSrc="./cloudian_logo.png">With imgSrc</ToolbarButton>
</ToolbarButtonRow>
</DashboardStoryCanvas>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ $red: $red-base;
$yellow: ${theme.v1.palette.yellow};
$orange: ${theme.v1.palette.orange};
$purple: ${theme.v1.palette.purple};
$green: ${theme.v1.palette.green};
$variable: ${theme.colors.primary.text};
$brand-primary: ${theme.v1.palette.orange};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ $red: $red-base;
$yellow: ${theme.v1.palette.yellow};
$orange: ${theme.v1.palette.orange};
$purple: ${theme.v1.palette.purple};
$green: ${theme.v1.palette.green};
$variable: ${theme.colors.primary.text};
$brand-primary: ${theme.v1.palette.orange};
Expand Down
6 changes: 2 additions & 4 deletions packaging/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ docker_build () {
docker build \
--build-arg BASE_IMAGE=${base_image} \
--build-arg GRAFANA_TGZ=${grafana_tgz} \
--build-arg GO_SRC=tgz-builder \
--build-arg JS_SRC=tgz-builder \
--build-arg RUN_SH=./run.sh \
--build-arg RUN_SH=./packaging/docker/run.sh \
--tag "${tag}" \
--no-cache=true \
--file ../../Dockerfile \
--file Dockerfile \
.
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/api/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ func (hs *HTTPServer) setIndexViewData(c *contextmodel.ReqContext) (*dtos.IndexV
NewGrafanaVersionExists: hs.grafanaUpdateChecker.UpdateAvailable(),
AppName: setting.ApplicationName,
AppNameBodyClass: "app-grafana",
FavIcon: "public/img/fav32.png",
AppleTouchIcon: "public/img/apple-touch-icon.png",
AppTitle: "Grafana",
FavIcon: "public/img/cloudian_logo_alt.png",
AppleTouchIcon: "public/img/cloudian_logo_alt.png",
AppTitle: "Cloudian® HyperIQ",
NavTree: navTree,
Sentry: &hs.Cfg.Sentry,
Nonce: c.RequestNonce,
ContentDeliveryURL: hs.Cfg.GetContentDeliveryURL(hs.License.ContentDeliveryPrefix()),
LoadingLogo: "public/img/grafana_icon.svg",
LoadingLogo: "public/img/cloudian_logo.png",
}

if !hs.AccessControl.IsDisabled() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/e2eutil/grafana_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (g *GrafanaServer) Wait() {
for {
select {
case <-timeoutExceeded:
log.Printf("grafana server failed to start after %d second(s) timeout", timeout)
log.Printf("server failed to start after %d second(s) timeout", timeout)
os.Exit(1)

case <-ticker.C:
Expand Down
4 changes: 2 additions & 2 deletions pkg/middleware/recovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestRecoveryMiddleware(t *testing.T) {
sc.req.Header.Set("content-type", "application/json")

assert.Equal(t, 500, sc.resp.Code)
assert.Equal(t, "Internal Server Error - Check the Grafana server logs for the detailed error message.", sc.respJson["message"])
assert.Equal(t, "Internal Server Error - Check the HyperIQ server logs for the detailed error message.", sc.respJson["message"])
assert.True(t, strings.HasPrefix(sc.respJson["error"].(string), "Server Error"))
})
})
Expand All @@ -37,7 +37,7 @@ func TestRecoveryMiddleware(t *testing.T) {

assert.Equal(t, 500, sc.resp.Code)
assert.Equal(t, "text/html; charset=UTF-8", sc.resp.Header().Get("content-type"))
assert.Contains(t, sc.resp.Body.String(), "<title>Grafana - Error</title>")
assert.Contains(t, sc.resp.Body.String(), "<title>Cloudian® HyperIQ - Error</title>")
})
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/accesscontrol/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var (
usersWriterRole = RoleDTO{
Name: "fixed:users:writer",
DisplayName: "User writer",
Description: "Read and update all attributes and settings for all users in Grafana: update user information, read user information, create or enable or disable a user, make a user a Grafana administrator, sign out a user, update a user’s authentication token, or update quotas for all users.",
Description: "Read and update all attributes and settings for all users in Grafana: update user information, read user information, create or enable or disable a user, make a user a HyperIQ administrator, sign out a user, update a user’s authentication token, or update quotas for all users.",
Group: "User administration (global)",
Permissions: ConcatPermissions(usersReaderRole.Permissions, []Permission{
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/alerting/notifiers/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (dn *DiscordNotifier) Notify(evalContext *alerting.EvalContext) error {

footer := map[string]interface{}{
"text": "Grafana v" + setting.BuildVersion,
"icon_url": "https://grafana.com/static/assets/img/fav32.png",
"icon_url": "https://grafana.com/static/assets/img/cloudian_logo_alt.png",
}

color, _ := strconv.ParseInt(strings.TrimLeft(evalContext.GetStateModel().Color, "#"), 16, 0)
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/alerting/notifiers/discord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestDiscordNotifier(t *testing.T) {
t.Run("settings should trigger incident", func(t *testing.T) {
json := `
{
"avatar_url": "https://grafana.com/img/fav32.png",
"avatar_url": "https://grafana.com/img/cloudian_logo_alt.png",
"content": "@everyone Please check this notification",
"url": "https://web.hook/"
}`
Expand All @@ -49,7 +49,7 @@ func TestDiscordNotifier(t *testing.T) {
require.Nil(t, err)
require.Equal(t, "discord_testing", discordNotifier.Name)
require.Equal(t, "discord", discordNotifier.Type)
require.Equal(t, "https://grafana.com/img/fav32.png", discordNotifier.AvatarURL)
require.Equal(t, "https://grafana.com/img/cloudian_logo_alt.png", discordNotifier.AvatarURL)
require.Equal(t, "@everyone Please check this notification", discordNotifier.Content)
require.Equal(t, "https://web.hook/", discordNotifier.WebhookURL)
})
Expand Down
Loading

0 comments on commit 515cf34

Please sign in to comment.