Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/metabase scalingo/csv plugin support #14

Closed
wants to merge 16 commits into from
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,29 @@ $ git push scalingo master
The following environment variables are available for you to adjust, depending
on your needs:

| Name | Description | Default value |
| -------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `BUILDPACK_URL` | URL of the buildpack to use. | https://github.com/Scalingo/multi-buildpack.git |
| `DATABASE_URL` | URL of your database addon. **Only available if you have a database addon provisioned**. | Provided by Scalingo |
| `MAX_METASPACE_SIZE` | Maximum amount of memory allocated to Java Metaspace[^1]. | `512m` (512MB) |
| `BUILDPACK_URL` | |
| --------------: | ----------------------------------------------- |
| Description | URL of the buildpack to use. |
| Required | Yes |
| Default | https://github.com/Scalingo/multi-buildpack.git |

| `DATABASE_URL` | |
| -------------: | --------------------------------------------------------------------------------------- |
| Description | URL of the database addon. **Only available if you have a database addon provisioned.** |
| Required | No |
| Default | Provided by Scalingo. |

| `MAX_METASPACE_SIZE` | |
| -------------------: | --------------------------------------------------------- |
| Description | Maximum amount of memory allocated to Java Metaspace[^1]. |
| Required | No |
| Default | `512m` (512MB) |

| `ENABLE_METABASE_CSV_PLUGIN` | |
| ---------------------------: | --------------------------------------------------------------------------------------- |
| Description | Whether to load the CSV driver plugin for Metabase or not. |
| Required | No |
| Default | `false` - **When defined**, anything but `false`, `FALSE` and `0` is considered `true`. |

Metabase also [supports many environment variables](https://www.metabase.com/docs/latest/operations-guide/environment-variables.html).

Expand Down
35 changes: 35 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're trying to convert this repository to a buildpack. But this repository is not in the chain of buildpack (see .buildpacks file).
Plus wouldn't it be better to backport those changes into the metabase buildpack and not create a new one ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I didn't think this would be an issue. But I understand your point, closing for now.


set -eu

metabase_plugin_csv_url="https://github.com/Markenson/csv-metabase-driver/releases/download/%s/csv.metabase-driver.jar"
metabase_plugin_csv_version="v1.3.1"


is_true() {
if [[ "$1" = 0 ]]
then
false
elif [[ -z "$1" ]]
then
false
elif [[ "$1" =~ [Ff][Aa][Ll][Ss][Ee] ]]
then
false
fi
}


metabase_plugins_dir="${1}/plugins"
mkdir -p "${metabase_plugins_dir}"


printf -v mb_plugin_csv_url "${metabase_plugin_csv_url}" "${metabase_plugin_csv_version}"

if is_true "${ENABLE_METABASE_CSV_PLUGIN}"
then
echo -n "- Install CSV plugin : "
cd "${metabase_plugins_dir}"
curl --location --remote-name "${mb_plugin_csv_url}"
echo "Done"
fi
4 changes: 4 additions & 0 deletions bin/detect
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

echo "Metabase"
exit 0
4 changes: 4 additions & 0 deletions scalingo.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"MAX_METASPACE_SIZE": {
"description": "Control max memory available",
"value": "512m"
},
"ENABLE_METABASE_CSV_PLUGIN": {
"description": "Whether to load the CSV driver plugin or not",
"value": "false"
}
},
"addons": ["postgresql:postgresql-starter-512"]
Expand Down