{"id":18646785,"url":"https://github.com/metabase/dev-scripts","last_synced_at":"2025-04-11T12:32:03.567Z","repository":{"id":40493185,"uuid":"294817464","full_name":"metabase/dev-scripts","owner":"metabase","description":"Useful scripts for Metabase development","archived":false,"fork":false,"pushed_at":"2024-03-21T11:32:17.000Z","size":1224,"stargazers_count":14,"open_issues_count":5,"forks_count":7,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-04-14T05:56:45.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metabase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-09-11T21:41:26.000Z","updated_at":"2024-03-14T15:09:00.000Z","dependencies_parsed_at":"2023-01-29T00:45:48.418Z","dependency_job_id":"95a3deea-73a9-4397-aeef-cda113276359","html_url":"https://github.com/metabase/dev-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fdev-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fdev-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fdev-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fdev-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metabase","download_url":"https://codeload.github.com/metabase/dev-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223467803,"owners_count":17150037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T06:22:36.485Z","updated_at":"2025-04-11T12:32:03.551Z","avatar_url":"https://github.com/metabase.png","language":"Shell","funding_links":[],"categories":["Metabase Examples"],"sub_categories":["Official Examples"],"readme":"Scripts that make local Metabase development handier. Currently these only consist of scripts for running different\ndatabases we support like MySQL or Spark SQL locally, but we can add scripts for other stuff in the future if we think\nof anything good.\n\n### bb tasks\n\nTo get setup you'll need:\n\n- *babashka* `brew install borkdude/brew/babashka`\n- *fzf* `brew install fzf`\n\nTo see a list of avaliable tasks, run:\n\n    bb tasks\n\n#### Setup MB_DIR\n\n    MB_DIR=/path/to/metabase\n\n#### How to get help\n\nfor help with a task, use `-h` or `--help`.\n\n    bb run-branch --help\n\n#### Using metabuild with vscode\n\nTo start repl that you can connect to from Visual Studio Code you can use following alias instead of the default `:nrepl`.\n\n`~/.clojure/deps.edn`\n```\n{:aliases\n {:vsc {:extra-deps {nrepl/nrepl {:mvn/version,\"1.0.0\"}\n                     cider/cider-nrepl {:mvn/version,\"0.28.5\"}}\n        :main-opts [\"-m\" \"nrepl.cmdline\"\n                    \"--middleware\" \"[cider.nrepl/cider-middleware]\"]}}}\n```\n\nYour startup command could then look as following:\n`bb metabuild -d postgres -e dev:ee:ee-dev:drivers:drivers-dev:vsc`\n\nIf you are running the app db in docker container from images in this repo you need to pass in also the correct credentials, eg. `MB_JETTY_PORT=10001 MB_DIR=path/to/your/mb/repo bb --config /path/to/this/repo/bb.edn metabuild -d postgres -u metabase -p Password1234 -e dev:ee:ee-dev:drivers:drivers-dev:vsc`\n\n#### Passing\n\n### Database Scripts\n\nThese scripts run the same Docker images with the same env vars we use in CI and then dump out some useful info for\nusing them. They also nuke the existing image when you run the script a second time so you can just run it again to\ncompletely reset the DB e.g. when running tests.\n\n```bash\n$ ~/mb-scripts/run-mariadb-latest.sh\nRemoving existing container...\nmaria-db-latest\nNothing to remove\n73003b822d25aaf5b55f739f9b91f94f7f8d16a5abbd43b76fb2d34116d49ceb\nStarted MariaDB latest on port 3306.\n\njdbc:mysql://localhost:3306/metabase_test?user=root\n\nMB_DB_TYPE=mysql MB_DB_DBNAME=metabase_test MB_DB_HOST=localhost MB_DB_PASS='' MB_DB_PORT=3306 MB_DB_USER=root MB_MYSQL_TEST_USER=root\n\nmysql --user=root --host=127.0.0.1 --port=3306 --database=metabase_test\n```\n\nYou need to have Docker installed to use these scripts!\n\n#### For Macbook with ARM chips\nSome drivers like oracle, vertica, sqlserver, mysql (and possibly more) are currently not able to run on Apple M chips.\nThe work around is using colima:\n1. [Install](https://github.com/abiosoft/colima#getting-started) colima\n2. Start it with `colima start --arch x86_64 --memory 4`\n3. Start the database with scripts like normal\n\n##### Colima in Feb 2025\nIf colima is not starting for you on m2 mac, looking into the issue https://github.com/abiosoft/colima/issues/1248\ncould help.\n\n#### Presto on Macbook with ARM chips\n\nRather than use Docker, you can run Presto with Postgres with the following steps:\n- Follow [these\n  steps](https://prestodb.io/docs/current/installation/deploy-brew.html#deploy-presto-on-an-apple-silicon-mac-using-homebrew)\n  to install presto using homebrew\n- Add a properties file for postgresql in `/usr/local/Cellar/prestodb/\u003cversion\u003e/libexec/etc/catalog`, called\n  `test_data.properties` (`test_data` is the catalog name) with the following contents:\n  ```\n  connector.name=postgresql\n  connection-url=jdbc:postgresql://localhost:5432/test_data\n  connection-user=\u003cmb-postgresql-test-user\u003e\n  connection-password=\u003cmb-postgresql-test-password\u003e\n  ```\n- To run the presto-jdbc driver tests, you'll need to create a database `test_data` on the postgres server that \u003cmb-postgresql-test-user\u003e has all privileges to, and create a schema in the database named \"default\".\n- Start the presto server with `/usr/local/opt/prestodb/bin/presto-server run`\n\nAlternatively, Luis has created a [Link](https://github.com/paoliniluis/metabase-presto-and-trino) for testing Presto and Trino with Docker that might work too.\n\n# Automated setup\n\nIn stacks-\u003esetup-container you'll find a Compose file that has a Metabase container along with a setup container. The setup container waits till the Metabase container is ready (status:ok in the health endpoint) and then sets up a user (a@b as the user/ metabot1 as the password). You can tweak the script as much as you want.\n\n# Metabase in HA (highly-available mode)\n\nThis stack is to test how Metabase behaves in HA mode, so you'll have a configuration like the following:\n\n```\n--------------\n|   HAProxy  |\n--------------\n    |     |\n------  ------\n| MB |  | MB |\n------  ------\n    |    |\n--------------\n|  Postgres  |\n--------------\n```\n\nHAProxy is configured to balance requests in a round-robin manner and it checks the health of the application (so you can also simulate a failure)\n\nThis will allow you to test how Metabase behaves when it scales horizontally, both on the FE (showing things like the process picker in the troubleshooting -\u003e logs section) and on the backend (health checks, queues, settings, etc). All configs in the LB can be changed from the config in stacks/ha/config/haproxy.cfg\n\n# Downloading Jars\n\n`mb-download` will let you download a jar to a given path or straight into `$JARS`.\n\n``` bash\n$ ./mb-download -h\nUsage: mb-download 0.42.2\nUsage: mb-download 1.45.2\nUsage: mb-download 1.45.2 ~/path/to/my/jars\n\nprotip: this script will read from $JARS, and use that as your jar directory.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fdev-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetabase%2Fdev-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fdev-scripts/lists"}