0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

metabaseをセルフビルドする

Posted at

初めに

https://qiita.com/m4549071758/items/253a9c806fc862dd8656
この記事のセルフビルドから抜き出したものです。

インストール

ソースのクローン

gitからソースをクローンします。

$ git clone https://github.com/metabase/metabase.git
$ cd metabase/

最大列数変更

ソースをクローン後、列数制限している部分を変更します。

src/metabase/query_processor/middleware/constraints.clj
(ns metabase.query-processor.middleware.constraints
  "Middleware that adds default constraints to limit the maximum number of rows returned to queries that specify the
  `:add-default-userland-constraints?` `:middleware` option."
  (:require
   [metabase.models.setting :as setting]
   [metabase.util.i18n :refer [deferred-tru]]))

(def ^:private ^:const default-max-results-bare-rows <任意の桁数に変更>)

;; NOTE: this was changed from a hardcoded var with value of 2000 (now moved to [[default-max-results-bare-rows]])
;; to a setting in 0.43 the setting, which allows for DB local value, can still be nil, so any places below that used
;; to reference the former constant value have to expect it could return nil instead
(setting/defsetting max-results-bare-rows
  (deferred-tru "Maximum number of rows to return specifically on :rows type queries via the API.")
  :visibility     :authenticated
  :type           :integer
  :database-local :allowed)

(def ^:private max-results
  "General maximum number of rows to return from an API query."
  <任意の桁数に変更>)

(defn default-query-constraints

ビルド環境

DockerHubから、すでにClojure環境構築済みのコンテナイメージを使用します。

https://hub.docker.com/_/clojure

bashをコンテナ側に渡すことで、ターミナルから直接操作できるようになります。

$ sudo docker run -it --rm -v $(pwd):/tmp/metabase --workdir /tmp/metabase clojure:openjdk-11-tools-deps-slim-bullseye /bin/bash

必要なモジュールをインストールします。

# apt update && apt install -y curl gnupg

# curl -sL https://deb.nodesource.com/setup_lts.x | bash -
# apt update && apt install -y nodejs

# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg |  apt-key add -
# echo "deb https://dl.yarnpkg.com/debian/ stable main" |  tee /etc/apt/sources.list.d/yarn.list
# apt update && apt install -y yarn

モジュールをアップデートします。

# npx update-browserslist-db@latest
# npx browserslist@latest --update-db
# yarn upgrade

ビルドします。

# yarn
# ./bin/build.sh

Copyright © 2023 Metabase, Inc. 

Metabase Enterprise Edition extensions are PRESENT.

Usage of Metabase Enterprise Edition features are subject to the Metabase Commercial License. See https://www.metabase.com/license/commercial/ for details.
        Finished compilation in 74.0 seconds.
      Copy resources
        Copy src
        Copy shared/src
        Copy resources
      Create uberjar
Building uber jar: /tmp/metabase/target/uberjar/metabase.jar
        Created uberjar in 32.0 seconds.
      Update META-INF/MANIFEST.MF
      Built target/uberjar/metabase.jar in 110.8 seconds.
    Uberjar built successfully.
  All build steps finished.

実行

/tmp/metabase/target/uberjarにjarファイルが出力されるので、dockerコンテナからexitして

$ java -jar metabase.jar 

で実行できます。

実行するホストOSにOpenJDK 11が必要です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?