{"id":18646755,"url":"https://github.com/metabase/mba","last_synced_at":"2025-04-11T12:31:57.215Z","repository":{"id":49094491,"uuid":"337202698","full_name":"metabase/mba","owner":"metabase","description":"metabase assembler","archived":false,"fork":false,"pushed_at":"2024-08-08T13:53:22.000Z","size":1539,"stargazers_count":7,"open_issues_count":8,"forks_count":1,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-03-25T14:11:15.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","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.org","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,"publiccode":null,"codemeta":null}},"created_at":"2021-02-08T20:36:39.000Z","updated_at":"2024-08-08T13:41:41.000Z","dependencies_parsed_at":"2024-11-08T10:15:28.475Z","dependency_job_id":null,"html_url":"https://github.com/metabase/mba","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%2Fmba","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmba/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmba/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmba/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metabase","download_url":"https://codeload.github.com/metabase/mba/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401991,"owners_count":21097328,"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:27.216Z","updated_at":"2025-04-11T12:31:56.889Z","avatar_url":"https://github.com/metabase.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"* Overview\n  Metabase Assembler is a development and repro tool based on\n  docker-compose.\n* Dependencies\n  - docker \u0026 docker-compose\n  - [[https://github.com/babashka/babashka/][babashka]] 2.12 or higher.\n\n* Install\n  - install babashka. [[https://github.com/babashka/babashka/releases/][Download]]\n  - install docker \u0026\u0026 docker-compose\n  - git clone https://github.com/metabase/mba\n  - If you want it in your path: =ln -s ./mba/src/main.clj ~/bin/mba=\n  - =mba --help= or =./mba/src/main.clj --help=\n\n\n* BugBash Instructions\n  If you're bugbashing:\n  - =mba --mb dockerhub:metabase/metabase-head pull=. Will pull latest\n    metabase-head image.\n  - =mba --mb dockerhub:metabase/metabase-head up=. Will spin metabase linked to\n    a postgresql and maildev. Open `localhost:3000` and `localhost:1080`.\n  - When you're done, =mba --mb dockerhub:metabase/metabase-head down=. containers\n    and data will be wiped.\n  - Emergency hatch: =mba nuke= will kill everything mba related.\n\n* Usage \u0026 Commands\n\n  - =mba up= . creates the stack\n  - =mba pull= . pulls images from the stack. (useful if you use =*-head=)\n  - =mba shell=. gives a shell inside the main metabase container\n  - =mba dbconsole=. console into the app-db\n  - =mba run ls=. runs one-off commands in the mb container\n  - =mba logs=. show logs\n  - =mba compose logs -- --tail=100 -f=. same, using raw compose command\n  - =mba logs postgres=. show logs and tail of postgres container\n  - =mba compose logs -- --tail=100 -f postgres=. same, using raw compose command\n  - =mba down=. destroys the stack\n  - =mba ps=. show all mba containers running in the system.\n  - =mba compose ps=. show running containers from this stack\n  - =mba compose ...=. proxy to all docker-compose commands\n  - =mba compose config=. show generated yml\n  - =mba nuke=. kill all mba containers dead\n\n  mba wraps docker-compose, and using the command =compose=, it will pass all\n  further commands to the underlying docker-compose.\n\n  =mba compose config= is equivalent to =docker-compose -f tmp.yml config= and\n  will show the yml file that is generating with your current flags.\n\n  By default, it will share ports. ==--publish false= will jail the\n  whole stack not publishing any port.\n\n  If current directory is not a metabase source dir, by default it\n  will use dockerhub's =metabase/metabase= image. This WILL start\n  automatically.\n\n  If it is ran in a metabase source directory, it will run the\n  .devcontainer image, so you should shell into it and run the\n  commands manually to start the app.\n\n  SUPERHACK: ENV vars are passed around at the moment, to have the commands available\n  #+begin_src bash\n    mba up\n    mba shell\n    lein repl     # or `eval $MBA_CLI`. lein repl as cider-jack-in would call it with\n                  # fixed host 0.0.0.0 and port 7888 (which is the exported port by mba)\n\n    mba shell\n    yarn build-hot # or `eval $MBA_YARN_BUILD`, as a tunnable command to\n                   # run the proper yarn build. It used to be a place to\n                   # put special flags like --host 0.0.0.0, but now the\n                   # flag is merged in master\n\n  #+end_src\n  so hacky, amazing.\n\n  - mba --help may help you with the commands and option, but for the\n    values, explore src/main.clj\n\n  - to pass flags to docker-compose , or any command underlying mba,\n    the way to pass as a parameter to inside is with =--=: =mba\n    --app-db postgres compose logs -- -f=\n\n* Flags\n  **tl;dr**:\n  #+begin_src bash\n    mba --mb ~/prj/metabase \\\n        --app-db postgres:13 \\\n        --data-db mariadb \\\n        --proxy nginx\\\n        --env FOO=bar\\\n        --network n1\\\n        --prefix mb1\\\n        up\n  #+end_src\n** --mb / -M\n   Main metabase app source or image.\n\n   If mba runs in a metabase source directory, it will default to the current\n   directory. Else, it defaults to dockerhub:metabase/metabase-enterprise docker\n   image.\n\n   Set it explicitly like the following:\n\n   - =mba --help= will show the options accepted by mba.\n   - =cd ~/src/metabase; mba -M ./=\n   - =mba --mb ~/src/metabase/=\n   - =mba --mb file:~/src/metabase/=\n   - =mba --mb docker:metabase/metabase:v0.37=\n   - =mba --mb git:ref=  \u003c- not implemented\n\n** --app-db / -d\n   App db for metabase. Defaults to =postgres=. Valid options are:\n\n   - =postgresql=\n   - =postgres=\n   - =postgres:13= Or wtv version\n   - =mysql=\n   - =mariadb=\n   - =h2=\n\n** --data-db / -D\n   Datawarehouse db. Defaults to nil. Valid options are:\n\n   - =postgresql=\n   - =mariadb=\n   - =mysql=\n   - =mongodb=\n   - =vertica=\n   - =presto=\n   - =sparksql=\n   - =sqlserver=\n\n** --proxy\n    Proxy infrastructure. Defaults to nil. Valid options are:\n\n   - =nginx=\n   - =haproxy=\n   - =envoy=\n\n** --env / -e\n   Injects env variables to the metabase container. Can be present\n   multiple times. For example, this would start a metabase image with\n   a custom h2 file:\n\n  #+begin_src bash\n   mba --mb dockerhub:metabase/metabase\\\n       --env MB_DB_FILE=/root/testdb \\\n       --app-db h2\\\n       up\n  #+end_src\n\n  Remember that =/root/testdb= means =~/.mba/.mba-home/= from your\n  host.\n\n** --publish\n   Publish ports. Boolean. Defaults to true.\n\n** --prefix / -p\n   stack name. Defaults to \"mba-[somehash]\". Useful when running multiple\n   instances.\n\n** --network / -n\n   Network name. By default it creates an anonymous network per stack,\n   Fixing it is useful to make many metabase join the same network.\n\n* ports\n  By default, the stack will share ports:\n  - 3000: backend\n  - 8080: frontend\n  - 7888: for lein repl\n  - 1025: maildev mail port\n  - 1080: maildev http\n  - 8081 if --proxy is set\n\n* networks\n   By default it will create a new unnamed network, but we can tell\n   mba to create a named network with =-n foo=. This and\n   =docker-compose run= allows us to run different mb versions in the\n   same environment to test upgrades and the like.\n\n   #+begin_src bash\n     # this will start the \"main\" one\n     mba --mb docker:metabase/metabase:v0.37.9 --app-db postgres -n n1 up\n     # attach a new container to the network. Can run migrations.\n     # or hit http://metabase:3000/api/session/properties\n     mba --mb file:~/workspace/metabase --app-db postgres -n n1 run metabase bash\n   #+end_src\n\n   Note: you can't =run bash= on a docker image that we provide (see\n   https://github.com/metabase/metabase/issues/14528), but you can run\n   normally, and then exec into it and run sh. That works ok.\n\n* Troubleshooting\n** I'm using docker:metabase/metabase and mba is using an old version\n   Use =mba --mb docker:metabase/metabase:v0.37.9 up= or use the\n   =pull= command: =mba --mb docker:metabase/metabase pull=\n\n* modifications done (or to be done) to make it work as a dev env\n** clojure\nAdd :port and :host.\n\n  #+begin_src bash\n  lein repl :headless :host 0.0.0.0 :port 7888\n  #+end_src\n\n** How to see actual Metabase queries sent to the database\n\n  #+begin_src bash\n   ./src/main.clj --app-db postgres --data-db postgres logs postgres | grep -A 5 \"queryHash\"\n  #+end_src\n\n** cypress\n   TODO\n\n** how to see what is the actual compose being built\n  #+begin_src bash\n   ./src/main.clj --data-db postgres --app-db postgres compose config | less\n  #+end_src\n\n* See also\n  - Mba is heavily inspired on [[https://github.com/Kong/gojira][Gojira]]. Nearly an exact port, molded to\n    cover a slightly different usecase.\n  - https://evilmartians.com/chronicles/reusable-development-containers-with-docker-compose-and-dip\n  - https://danlebrero.com/2017/09/25/how-do-docker-compose-development-environement/\n  - https://opensource.com/article/20/4/how-containerize-build-system\n  - https://github.com/microsoft/vscode-dev-containers/tree/master/containers/java-8\n  - https://earthly.dev/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fmba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetabase%2Fmba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fmba/lists"}