Skip to content

Commit

Permalink
Chore: replace docker-compose with docker compose commands (#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolzhabayev authored Aug 21, 2024
1 parent c5daba6 commit 4344feb
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
- name: Start Grafana
run: |
cd packages/plugin-e2e
docker-compose pull
AWS_SECRET_ACCESS_KEY=${{secrets.AWS_SECRET_ACCESS_KEY}} AWS_ACCESS_KEY_ID=${{secrets.AWS_ACCESS_KEY_ID}} GOOGLE_JWT_FILE=${{secrets.GOOGLE_JWT_FILE}} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} docker-compose up -d
docker compose pull
AWS_SECRET_ACCESS_KEY=${{secrets.AWS_SECRET_ACCESS_KEY}} AWS_ACCESS_KEY_ID=${{secrets.AWS_ACCESS_KEY_ID}} GOOGLE_JWT_FILE=${{secrets.GOOGLE_JWT_FILE}} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} docker compose up -d
- name: Wait for Grafana to start
uses: nev7n/wait_for_response@v1
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/get-started/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Run the following commands to get started:
* npm exec playwright install chromium to install e2e test dependencies.
* npm run dev to build (and watch) the plugin frontend code.
* mage -v build:backend to build the plugin backend code. Rerun this command every time you edit your backend files.
* docker-compose up to start a grafana development server.
* docker compose up to start a grafana development server.
* Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.
Note: We strongly recommend creating a new Git repository by running git init in ./org-pluginname-app before continuing.
Expand Down Expand Up @@ -255,7 +255,7 @@ mage -l
To launch the Grafana development server using Docker, run:

```shell
docker-compose up --build
docker compose up --build
```

Congratulations! You've just scaffolded your first plugin which you can now access at [http://localhost:3000](http://localhost:3000).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ services:
grafana_image: ${GRAFANA_IMAGE:-grafana}
```
This example assigns the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This gives you the option to set the value when running `docker-compose` commands.
This example assigns the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This gives you the option to set the value when running `docker compose` commands.

### Debugging Backend plugin

Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/shared/create-plugin-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The Grafana [create-plugin tool](https://www.npmjs.com/package/@grafana/create-p
1. Start Grafana:

```shell
docker-compose up
docker compose up
```

1. <span>Open Grafana, by default <a href="http://localhost:3000/">http://localhost:3000/</a>, and then go to <b>Administration</b> > <b>Plugins</b>. Make sure that your {props.pluginType} plugin is there.</span>
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/shared/create-plugin-frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The Grafana [create-plugin tool](https://www.npmjs.com/package/@grafana/create-p
1. Start Grafana:

```shell
docker-compose up
docker compose up
```

1. <span>Open Grafana, by default <a href="http://localhost:3000/">http://localhost:3000/</a>, and then go to <b>Administration</b> > <b>Plugins</b>. Make sure that your {props.pluginType} plugin is there.</span>
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/snippets/plugin-e2e-ds-workflow.npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:

- name: Start Grafana
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
docker compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
- name: Wait for Grafana to start
uses: nev7n/wait_for_response@v1
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/snippets/plugin-e2e-ds-workflow.pnpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:

- name: Start Grafana
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
docker compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
- name: Wait for Grafana to start
uses: nev7n/wait_for_response@v1
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/snippets/plugin-e2e-ds-workflow.yarn.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:

- name: Start Grafana
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
docker compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
- name: Wait for Grafana to start
uses: nev7n/wait_for_response@v1
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/snippets/plugin-e2e-fe-plugin-workflow.npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:

- name: Start Grafana
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
docker compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
- name: Wait for Grafana to start
uses: nev7n/wait_for_response@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:

- name: Start Grafana
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
docker compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
- name: Wait for Grafana to start
uses: nev7n/wait_for_response@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:

- name: Start Grafana
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
docker compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
- name: Wait for Grafana to start
uses: nev7n/wait_for_response@v1
Expand Down
8 changes: 4 additions & 4 deletions docusaurus/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ module.exports = {
};
```

### I get `"image with reference <plugin-name> was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8"` after running `docker-compose up` or `npm run server`.
### I get `"image with reference <plugin-name> was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8"` after running `docker compose up` or `npm run server`.

This error is most likely to impact users of Mac computers with Apple silicon. If you have previously built an image for a plugin scaffolded with `create-plugin` prior to v1.12.2, then running `docker-compose up` may fail with the above message if the old image hasn't been removed.
This error is most likely to impact users of Mac computers with Apple silicon. If you have previously built an image for a plugin scaffolded with `create-plugin` prior to v1.12.2, then running `docker compose up` may fail with the above message if the old image hasn't been removed.

#### What you can do:

- Run `docker-compose down` to stop and remove the container.
- Run `docker compose down` to stop and remove the container.
- Remove the image using `docker rmi <plugin-name>`.
- Run `docker-compose up` or `npm run server`.
- Run `docker compose up` or `npm run server`.
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,15 @@ However, there is an easier way of doing all this.
npm run server
```

This command runs a Grafana container using docker-compose and puts the built plugins in the right place.
This command runs a Grafana container using docker compose and puts the built plugins in the right place.

2. To verify the build, go to Grafana at `https://localhost:3000`.

:::note

You may be using Docker Compose instead of docker-compose. If that is your case, you just need to change the command in the `package.json` in the project's root directory.

:::

## Step 7: Test the plugin

1. From Grafana at `https://localhost:3000`, use the default credentials: username `admin` and password `admin`. If you're not presented with a login page, click **Sign in** in the top of the page and insert the credentials.

2. Add the data source. Since we are running in our `docker-compose` environment, we don't need to install it, and it will be directly available for usage. Go to **Connections > Data sources**, using the left menu as shown in the following image:
2. Add the data source. Since we are running in our `docker compose` environment, we don't need to install it, and it will be directly available for usage. Go to **Connections > Data sources**, using the left menu as shown in the following image:

3. A new page opens, and then click **Add data source**. Grafana opens another page where you can search for the data source name that we've just created.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function printGenerateSuccessMessage(answers: TemplateData) {
`- ${getBackendCmd()} to build the plugin backend code. Rerun this command every time you edit your backend files.`,
]
: []),
'- `docker-compose up` to start a grafana development server.',
'- `docker compose up` to start a grafana development server.',
'- Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.',
];

Expand Down
2 changes: 1 addition & 1 deletion packages/create-plugin/templates/common/.config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@ services:
grafana_image: ${GRAFANA_IMAGE:-grafana}
```
In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker-compose commands, which might be convenient in some scenarios.
In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker compose commands, which might be convenient in some scenarios.

---
2 changes: 1 addition & 1 deletion packages/create-plugin/templates/common/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"e2e": "playwright test",{{/if}}{{#if useCypress}}
"e2e": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run",
"e2e:update": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run --update-screenshots",{{/if}}
"server": "docker-compose up --build",
"server": "docker compose up --build",
"sign": "npx --yes @grafana/sign-plugin@latest"
},
"author": "{{ sentenceCase orgName }}",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dev": "nodemon --exec 'tsc'",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./src",
"lint:fix": "npm run lint -- --fix",
"server": "docker-compose up --build",
"server": "docker compose up --build",
"typecheck": "tsc --emitDeclarationOnly false --noEmit",
"test": "vitest",
"playwright:test": "npx playwright test",
Expand Down

0 comments on commit 4344feb

Please sign in to comment.