From 11ef6456aff198d3510cfe1054eccfcbe9a5f1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Schl=C3=B6ffel?= Date: Tue, 9 Jun 2026 09:54:39 +0200 Subject: [PATCH] Add GreptimeDB Alpine service packaging --- .gitea/workflows/build.yml | 7 ++ README.md | 8 +-- bin/greptimedb | 13 ++++ packaging/alpine/local/greptimedb/APKBUILD | 61 ++++++++++++++++- packaging/alpine/local/greptimedb/README.md | 16 ++++- .../alpine/local/greptimedb/datanode.toml | 47 ++++++++++++++ .../alpine/local/greptimedb/flownode.toml | 38 +++++++++++ .../alpine/local/greptimedb/frontend.toml | 65 +++++++++++++++++++ .../greptimedb/greptimedb.datanode.confd | 6 ++ .../greptimedb/greptimedb.flownode.confd | 4 ++ .../greptimedb/greptimedb.frontend.confd | 4 ++ .../alpine/local/greptimedb/greptimedb.initd | 61 +++++++++++++++++ .../local/greptimedb/greptimedb.metasrv.confd | 5 ++ .../local/greptimedb/greptimedb.pre-install | 7 ++ .../greptimedb/greptimedb.standalone.confd | 5 ++ .../alpine/local/greptimedb/metasrv.toml | 24 +++++++ .../local/greptimedb/scripts/test-install.sh | 31 +++++++-- .../alpine/local/greptimedb/standalone.toml | 46 +++++++++++++ scripts/apk/export-ci-assets.sh | 39 +++++++++++ 19 files changed, 472 insertions(+), 15 deletions(-) create mode 100755 bin/greptimedb create mode 100644 packaging/alpine/local/greptimedb/datanode.toml create mode 100644 packaging/alpine/local/greptimedb/flownode.toml create mode 100644 packaging/alpine/local/greptimedb/frontend.toml create mode 100644 packaging/alpine/local/greptimedb/greptimedb.datanode.confd create mode 100644 packaging/alpine/local/greptimedb/greptimedb.flownode.confd create mode 100644 packaging/alpine/local/greptimedb/greptimedb.frontend.confd create mode 100755 packaging/alpine/local/greptimedb/greptimedb.initd create mode 100644 packaging/alpine/local/greptimedb/greptimedb.metasrv.confd create mode 100755 packaging/alpine/local/greptimedb/greptimedb.pre-install create mode 100644 packaging/alpine/local/greptimedb/greptimedb.standalone.confd create mode 100644 packaging/alpine/local/greptimedb/metasrv.toml create mode 100644 packaging/alpine/local/greptimedb/standalone.toml create mode 100755 scripts/apk/export-ci-assets.sh diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 59f3eb5..6a472c7 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -38,8 +38,15 @@ jobs: scripts/apk/clean.sh find packaging/alpine/local -mindepth 2 -maxdepth 2 -name APKBUILD -exec apkbuild-lint {} + scripts/apk/ci-build.sh + scripts/apk/export-ci-assets.sh scripts/apk/list-packages.sh + - name: Upload generated CI assets + uses: actions/upload-artifact@v3 + with: + name: greptimedb-musl-binaries + path: packages/ci-assets/ + - name: Smoke test run: scripts/apk/ci-smoke.sh diff --git a/README.md b/README.md index 8c88e0b..9f69881 100644 --- a/README.md +++ b/README.md @@ -323,8 +323,8 @@ Repository variables: ```text INSTANCE_URL=https://code.factoring.digital -PACKAGE_OWNER=fsp-ops -PACKAGE_NAME=seaweedfs-alpine +PACKAGE_OWNER=public +PACKAGE_NAME=alpine-packages ``` Repository secrets: @@ -344,8 +344,8 @@ Publish already-built local packages manually: ```sh INSTANCE_URL=https://code.factoring.digital \ -PACKAGE_OWNER=fsp-ops \ -PACKAGE_NAME=seaweedfs-alpine \ +PACKAGE_OWNER=public \ +PACKAGE_NAME=alpine-packages \ PACKAGE_USER=... \ PACKAGE_TOKEN=... \ mise run apk:publish-gitea diff --git a/bin/greptimedb b/bin/greptimedb new file mode 100755 index 0000000..32e8d18 --- /dev/null +++ b/bin/greptimedb @@ -0,0 +1,13 @@ +#!/usr/bin/env -S mise tool-stub +# GrepTimeDB 1.0.2 release binary. + +version = "1.0.2" +bin = "greptime" + +[platforms.linux-x64] +url = "https://github.com/GreptimeTeam/greptimedb/releases/download/v1.0.2/greptime-linux-amd64-v1.0.2.tar.gz" +checksum = "sha256:1ad1f9312ce18a49494434cf52cf9fa00093c4712728508bff4578d060fb2d89" + +[platforms.linux-arm64] +url = "https://github.com/GreptimeTeam/greptimedb/releases/download/v1.0.2/greptime-linux-arm64-v1.0.2.tar.gz" +checksum = "sha256:e6567f5d97fd34b876b5653c22877c238a1633ecbe26b3b7c22b95892656c39c" diff --git a/packaging/alpine/local/greptimedb/APKBUILD b/packaging/alpine/local/greptimedb/APKBUILD index f116191..c622e68 100644 --- a/packaging/alpine/local/greptimedb/APKBUILD +++ b/packaging/alpine/local/greptimedb/APKBUILD @@ -1,17 +1,18 @@ # Maintainer: Joachim Schlöffel pkgname=greptimedb pkgver=1.0.2 -pkgrel=0 +pkgrel=1 pkgdesc="Cloud-native observability database for metrics, logs, and traces" url="https://github.com/GreptimeTeam/greptimedb" arch="x86_64" license="Apache-2.0" -depends="ca-certificates" +depends="ca-certificates /bin/sh" makedepends=" binutils clang cmake coreutils + curl lld linux-headers make @@ -27,8 +28,29 @@ makedepends=" zstd-dev zstd-static " +install="$pkgname.pre-install" +subpackages=" + $pkgname-datanode-openrc:_openrc_datanode:noarch + $pkgname-flownode-openrc:_openrc_flownode:noarch + $pkgname-frontend-openrc:_openrc_frontend:noarch + $pkgname-metasrv-openrc:_openrc_metasrv:noarch + $pkgname-standalone-openrc:_openrc_standalone:noarch + " options="net" -source="$pkgname-$pkgver.tar.gz::https://github.com/GreptimeTeam/greptimedb/archive/refs/tags/v$pkgver.tar.gz" +source=" + $pkgname-$pkgver.tar.gz::https://github.com/GreptimeTeam/greptimedb/archive/refs/tags/v$pkgver.tar.gz + datanode.toml + flownode.toml + frontend.toml + greptimedb.datanode.confd + greptimedb.flownode.confd + greptimedb.frontend.confd + greptimedb.initd + greptimedb.metasrv.confd + greptimedb.standalone.confd + metasrv.toml + standalone.toml + " _rust_toolchain="nightly-2026-03-21" _cargo_profile="nightly" @@ -64,8 +86,41 @@ check() { package() { install -Dm755 "$builddir"/target/"$_cargo_profile"/greptime \ "$pkgdir"/usr/bin/greptime + local _config + for _config in datanode flownode frontend metasrv standalone; do + install -Dm644 "$srcdir"/$_config.toml \ + "$pkgdir"/etc/greptimedb/$_config.toml + done } +_openrc_service() { + local _service="$1" + pkgdesc="$pkgdesc (OpenRC $_service service)" + depends="$pkgname=$pkgver-r$pkgrel openrc" + + install -Dm755 "$srcdir"/greptimedb.initd \ + "$subpkgdir"/etc/init.d/greptimedb.$_service + install -Dm644 "$srcdir"/greptimedb.$_service.confd \ + "$subpkgdir"/etc/conf.d/greptimedb.$_service +} + +_openrc_datanode() { _openrc_service datanode; } +_openrc_flownode() { _openrc_service flownode; } +_openrc_frontend() { _openrc_service frontend; } +_openrc_metasrv() { _openrc_service metasrv; } +_openrc_standalone() { _openrc_service standalone; } + sha512sums=" 7f4ac722b84a26816030e65d504b37a53edfca15de669a4f6ee7a903f1a29c8358dcc2376a0a6cfd9ded13b0c5d7550a6856b9b10dc8cd080c6b12970553a0ea greptimedb-1.0.2.tar.gz +29cc3376753487b216748e3f85e12639830e1ac4a763e94f330f87c3651a8ef9de35732958311c0049e1b7cbb4e90a9e602b3aff43297fe088c5ce795a110a79 datanode.toml +52790808cb4f5cf0220ac2ab169b623fe76b6318d27d7f003e1197e850373cb915bfd40556098bcb7650f293d751039cb3bccbf9107bb160b8284887794ba975 flownode.toml +e3e19ab3c7a345ecf8cf0a507f7fc95dd3b036a4a797385cf77fcf1999f2e4f053042c7bbda8de73ed43ff72e87aad81e4ac6d4a34d01773bbc1f6d0d967d9f7 frontend.toml +313ed7d9ccd174b1869f3009e174266cdc414599e0b0f8307c8aaf2b73841eb36ce4c1b2f6244a0358b5a587a4edaa621b781fbd767835088b3fa13623fcc0df greptimedb.datanode.confd +daf8efacc8bf2b74abd9f4900f889585295b57333a8a562a722de0596d35f25d5f9149e0879f4140bfdf727caa59c3f55b1380212722df92c588d912275530b8 greptimedb.flownode.confd +e3e61b1df00f8172a3b1d4a0d37ed2574a8c5cd27676b4e2ce14d15ad8933d233baabe8da374f715d00cfaee26f665244c1ba00f70197fcc713c4e9af9c3229e greptimedb.frontend.confd +c00740aee566b161bbe3610e0e0d6e8340022055750e6778772262474ffd6484d9f58be2fd498beafe28d0943e259e2277930af691bedea7650726e6c8998881 greptimedb.initd +df495367d85844dcba99e5aa01e5a23fd14799b7521a72d9ea00d29fc0e5fbc5c5d06ee88e88d9637e260f8337249a39d2b0115de58da4899824d20bd844254a greptimedb.metasrv.confd +882a79e969cac42adfada22060e6507fb687755a6d266d6728154b3e4da5777d2eaf5ad9bc331ed050448249ca609e6a61977b624d9faf25d83ed975345452cf greptimedb.standalone.confd +8120ec338ebe1330d43b20d9b34a8f5f778ea13cb056febd3c8e9dc189d0de2380b90e5474a0990294d7004827c6133d44d2dd3e32d463b9259c47c82592d257 metasrv.toml +7e625a40460b363415b69e59142fd202c4dbb51296286e6afdeb94d6303e5bf097f2d83196bfeea8cf1182aa90ffd4a503a939426e7eeeea4c14b7242bb99ddb standalone.toml " diff --git a/packaging/alpine/local/greptimedb/README.md b/packaging/alpine/local/greptimedb/README.md index 91419d0..9d4d6c4 100644 --- a/packaging/alpine/local/greptimedb/README.md +++ b/packaging/alpine/local/greptimedb/README.md @@ -1,11 +1,11 @@ # GreptimeDB Alpine Package -This package builds `greptime` from the upstream GreptimeDB source release. +This package builds `greptime` from the upstream GreptimeDB source release and packages OpenRC service subpackages plus default `/etc/greptimedb` configuration. The APKBUILD builds the release directly: ```sh -cargo build --release --locked --bin greptime --features servers/dashboard +cargo build --profile nightly --locked --bin greptime --features servers/dashboard ``` ## Package Commands @@ -22,11 +22,21 @@ Build only this package: ALPINE_PACKAGE=greptimedb mise run apk:build ``` -Install-test an existing build without recompiling: +Install-test an existing local build without recompiling: ```sh ALPINE_PACKAGE=greptimedb SKIP_BUILD=1 mise run apk:test-install ``` +Install-test from a published Gitea Alpine repository: + +```sh +ALPINE_PACKAGE=greptimedb \ +SKIP_BUILD=1 \ +ALPINE_REPOSITORY_URL=https://code.factoring.digital/api/packages/public/alpine/v3.23/alpine-packages \ +ALPINE_REPOSITORY_KEY_URL=https://code.factoring.digital/api/packages/public/alpine/key \ +mise run apk:test-install +``` + The full build can take close to an hour. Do not run it as part of lightweight metadata or script checks. diff --git a/packaging/alpine/local/greptimedb/datanode.toml b/packaging/alpine/local/greptimedb/datanode.toml new file mode 100644 index 0000000..d7023e8 --- /dev/null +++ b/packaging/alpine/local/greptimedb/datanode.toml @@ -0,0 +1,47 @@ +node_id = 1 +default_column_prefix = "greptime" +require_lease_before_startup = false +init_regions_in_background = false +init_regions_parallelism = 16 +max_concurrent_queries = 0 + +[http] +addr = "127.0.0.1:4004" +timeout = "0s" +body_limit = "64MB" + +[grpc] +bind_addr = "127.0.0.1:3001" +server_addr = "127.0.0.1:3001" +runtime_size = 8 +max_recv_message_size = "512MB" +max_send_message_size = "512MB" +flight_compression = "arrow_ipc" + +[grpc.tls] +mode = "disable" + +[heartbeat] +interval = "3s" +retry_interval = "3s" + +[meta_client] +metasrv_addrs = ["127.0.0.1:3002"] +timeout = "3s" +ddl_timeout = "10s" +connect_timeout = "1s" +tcp_nodelay = true +metadata_cache_max_capacity = 100000 +metadata_cache_ttl = "10m" +metadata_cache_tti = "5m" + +[wal] +dir = "/var/lib/greptimedb/datanode/wal" + +[storage] +data_home = "/var/lib/greptimedb/datanode" + +[logging] +dir = "/var/log/greptimedb/datanode" +level = "info" +enable_otlp_tracing = false diff --git a/packaging/alpine/local/greptimedb/flownode.toml b/packaging/alpine/local/greptimedb/flownode.toml new file mode 100644 index 0000000..37699fc --- /dev/null +++ b/packaging/alpine/local/greptimedb/flownode.toml @@ -0,0 +1,38 @@ +node_id = 1 + +[flow] + +[flow.batching_mode] + +[flow.batching_mode.frontend_tls] + +[grpc] +bind_addr = "127.0.0.1:6800" +server_addr = "127.0.0.1:6800" +runtime_size = 2 +max_recv_message_size = "512MB" +max_send_message_size = "512MB" + +[http] +addr = "127.0.0.1:4005" +timeout = "0s" +body_limit = "64MB" + +[meta_client] +metasrv_addrs = ["127.0.0.1:3002"] +timeout = "3s" +ddl_timeout = "10s" +connect_timeout = "1s" +tcp_nodelay = true +metadata_cache_max_capacity = 100000 +metadata_cache_ttl = "10m" +metadata_cache_tti = "5m" + +[heartbeat] +interval = "3s" +retry_interval = "3s" + +[logging] +dir = "/var/log/greptimedb/flownode" +level = "info" +enable_otlp_tracing = false diff --git a/packaging/alpine/local/greptimedb/frontend.toml b/packaging/alpine/local/greptimedb/frontend.toml new file mode 100644 index 0000000..16aecae --- /dev/null +++ b/packaging/alpine/local/greptimedb/frontend.toml @@ -0,0 +1,65 @@ +default_timezone = "UTC" +default_column_prefix = "greptime" + +[heartbeat] +interval = "18s" +retry_interval = "3s" + +[http] +addr = "127.0.0.1:4000" +timeout = "0s" +body_limit = "64MB" +enable_cors = true +prom_validation_mode = "strict" + +[grpc] +bind_addr = "127.0.0.1:4001" +server_addr = "127.0.0.1:4001" +runtime_size = 8 +flight_compression = "arrow_ipc" + +[grpc.tls] +mode = "disable" + +[internal_grpc] +bind_addr = "127.0.0.1:4010" +server_addr = "127.0.0.1:4010" +runtime_size = 8 +flight_compression = "arrow_ipc" + +[internal_grpc.tls] +mode = "disable" + +[mysql] +enable = true +addr = "127.0.0.1:4002" +runtime_size = 2 +keep_alive = "0s" +prepared_stmt_cache_size = 10000 + +[mysql.tls] +mode = "disable" + +[postgres] +enable = true +addr = "127.0.0.1:4003" +runtime_size = 2 +keep_alive = "0s" + +[postgres.tls] +mode = "disable" + +[meta_client] +metasrv_addrs = ["127.0.0.1:3002"] +timeout = "3s" +ddl_timeout = "10s" +connect_timeout = "1s" +tcp_nodelay = true +metadata_cache_max_capacity = 100000 +metadata_cache_ttl = "10m" +metadata_cache_tti = "5m" + +[logging] +dir = "/var/log/greptimedb/frontend" +level = "info" +enable_otlp_tracing = false diff --git a/packaging/alpine/local/greptimedb/greptimedb.datanode.confd b/packaging/alpine/local/greptimedb/greptimedb.datanode.confd new file mode 100644 index 0000000..563d148 --- /dev/null +++ b/packaging/alpine/local/greptimedb/greptimedb.datanode.confd @@ -0,0 +1,6 @@ +# Defaults for "greptime datanode start". +GREPTIMEDB_CONFIG="/etc/greptimedb/datanode.toml" +GREPTIMEDB_LOG_DIR="/var/log/greptimedb/datanode" +GREPTIMEDB_DATA_HOME="/var/lib/greptimedb/datanode" +GREPTIMEDB_WAL_DIR="/var/lib/greptimedb/datanode/wal" +GREPTIMEDB_OPTS="" diff --git a/packaging/alpine/local/greptimedb/greptimedb.flownode.confd b/packaging/alpine/local/greptimedb/greptimedb.flownode.confd new file mode 100644 index 0000000..2d70af9 --- /dev/null +++ b/packaging/alpine/local/greptimedb/greptimedb.flownode.confd @@ -0,0 +1,4 @@ +# Defaults for "greptime flownode start". +GREPTIMEDB_CONFIG="/etc/greptimedb/flownode.toml" +GREPTIMEDB_LOG_DIR="/var/log/greptimedb/flownode" +GREPTIMEDB_OPTS="" diff --git a/packaging/alpine/local/greptimedb/greptimedb.frontend.confd b/packaging/alpine/local/greptimedb/greptimedb.frontend.confd new file mode 100644 index 0000000..a55fbab --- /dev/null +++ b/packaging/alpine/local/greptimedb/greptimedb.frontend.confd @@ -0,0 +1,4 @@ +# Defaults for "greptime frontend start". +GREPTIMEDB_CONFIG="/etc/greptimedb/frontend.toml" +GREPTIMEDB_LOG_DIR="/var/log/greptimedb/frontend" +GREPTIMEDB_OPTS="" diff --git a/packaging/alpine/local/greptimedb/greptimedb.initd b/packaging/alpine/local/greptimedb/greptimedb.initd new file mode 100755 index 0000000..30bc208 --- /dev/null +++ b/packaging/alpine/local/greptimedb/greptimedb.initd @@ -0,0 +1,61 @@ +#!/sbin/openrc-run + +service_name="${RC_SVCNAME#greptimedb.}" +description="GreptimeDB ${service_name} service" + +command="/usr/bin/greptime" +command_user="${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}" +command_background="yes" +pidfile="/run/greptimedb/${RC_SVCNAME}.pid" +output_log="${GREPTIMEDB_LOG:-/var/log/greptimedb/${RC_SVCNAME}.log}" +error_log="${GREPTIMEDB_ERRLOG:-/var/log/greptimedb/${RC_SVCNAME}.log}" + +build_command_args() { + config_file="${GREPTIMEDB_CONFIG:-/etc/greptimedb/${service_name}.toml}" + log_dir="${GREPTIMEDB_LOG_DIR:-/var/log/greptimedb/${service_name}}" + data_home="${GREPTIMEDB_DATA_HOME:-/var/lib/greptimedb/${service_name}}" + wal_dir="${GREPTIMEDB_WAL_DIR:-/var/lib/greptimedb/${service_name}/wal}" + + command_args="${GREPTIMEDB_GLOBAL_OPTS:-} ${service_name} start -c ${config_file} --log-dir ${log_dir}" + + case "$service_name" in + datanode) + command_args="$command_args --data-home ${data_home} --wal-dir ${wal_dir}" + ;; + metasrv|standalone) + command_args="$command_args --data-home ${data_home}" + ;; + esac + + command_args="$command_args ${GREPTIMEDB_OPTS:-}" +} + +build_command_args + +depend() { + need net + case "$service_name" in + datanode|flownode|frontend) + after greptimedb.metasrv + ;; + esac +} + +start_pre() { + checkpath -d -m 0755 -o "${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}" \ + /run/greptimedb \ + /var/log/greptimedb \ + /var/lib/greptimedb \ + "$log_dir" + + case "$service_name" in + datanode) + checkpath -d -m 0750 -o "${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}" \ + "$data_home" "$wal_dir" + ;; + metasrv|standalone) + checkpath -d -m 0750 -o "${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}" \ + "$data_home" + ;; + esac +} diff --git a/packaging/alpine/local/greptimedb/greptimedb.metasrv.confd b/packaging/alpine/local/greptimedb/greptimedb.metasrv.confd new file mode 100644 index 0000000..8f8ae71 --- /dev/null +++ b/packaging/alpine/local/greptimedb/greptimedb.metasrv.confd @@ -0,0 +1,5 @@ +# Defaults for "greptime metasrv start". +GREPTIMEDB_CONFIG="/etc/greptimedb/metasrv.toml" +GREPTIMEDB_LOG_DIR="/var/log/greptimedb/metasrv" +GREPTIMEDB_DATA_HOME="/var/lib/greptimedb/metasrv" +GREPTIMEDB_OPTS="" diff --git a/packaging/alpine/local/greptimedb/greptimedb.pre-install b/packaging/alpine/local/greptimedb/greptimedb.pre-install new file mode 100755 index 0000000..699794e --- /dev/null +++ b/packaging/alpine/local/greptimedb/greptimedb.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +addgroup -S greptimedb 2>/dev/null +adduser -S -D -H -h /var/lib/greptimedb -s /sbin/nologin \ + -G greptimedb -g greptimedb greptimedb 2>/dev/null + +exit 0 diff --git a/packaging/alpine/local/greptimedb/greptimedb.standalone.confd b/packaging/alpine/local/greptimedb/greptimedb.standalone.confd new file mode 100644 index 0000000..560369d --- /dev/null +++ b/packaging/alpine/local/greptimedb/greptimedb.standalone.confd @@ -0,0 +1,5 @@ +# Defaults for "greptime standalone start". +GREPTIMEDB_CONFIG="/etc/greptimedb/standalone.toml" +GREPTIMEDB_LOG_DIR="/var/log/greptimedb/standalone" +GREPTIMEDB_DATA_HOME="/var/lib/greptimedb/standalone" +GREPTIMEDB_OPTS="" diff --git a/packaging/alpine/local/greptimedb/metasrv.toml b/packaging/alpine/local/greptimedb/metasrv.toml new file mode 100644 index 0000000..bbf9bb0 --- /dev/null +++ b/packaging/alpine/local/greptimedb/metasrv.toml @@ -0,0 +1,24 @@ +data_home = "/var/lib/greptimedb/metasrv" +store_addrs = [] +store_key_prefix = "" +backend = "memory_store" +selector = "round_robin" +enable_region_failover = false +region_failure_detector_initialization_delay = "10m" +allow_region_failover_on_local_wal = false +node_max_idle_time = "24hours" + +[http] +addr = "127.0.0.1:3000" +timeout = "0s" +body_limit = "64MB" + +[grpc] +bind_addr = "127.0.0.1:3002" +server_addr = "127.0.0.1:3002" +runtime_size = 8 + +[logging] +dir = "/var/log/greptimedb/metasrv" +level = "info" +enable_otlp_tracing = false diff --git a/packaging/alpine/local/greptimedb/scripts/test-install.sh b/packaging/alpine/local/greptimedb/scripts/test-install.sh index 91f93a1..1cadebd 100755 --- a/packaging/alpine/local/greptimedb/scripts/test-install.sh +++ b/packaging/alpine/local/greptimedb/scripts/test-install.sh @@ -5,6 +5,8 @@ repo_root="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../.." && package_name="${PACKAGE_NAME:-greptimedb}" alpine_version="${ALPINE_VERSION:-3.23}" arch="${ALPINE_ARCH:-x86_64}" +repository_url="${ALPINE_REPOSITORY_URL:-}" +repository_key_url="${ALPINE_REPOSITORY_KEY_URL:-}" case "${arch}" in x86_64) @@ -19,11 +21,11 @@ case "${arch}" in ;; esac -if [[ "${SKIP_BUILD:-0}" != "1" ]]; then +if [[ -z "${repository_url}" && "${SKIP_BUILD:-0}" != "1" ]]; then ALPINE_PACKAGE="${package_name}" "${repo_root}/scripts/apk/build.sh" build "${arch}" fi -if [[ ! -d "${repo_root}/packages/local/${arch}" ]]; then +if [[ -z "${repository_url}" && ! -d "${repo_root}/packages/local/${arch}" ]]; then printf 'missing local repository: packages/local/%s\n' "${arch}" >&2 printf 'run: ALPINE_PACKAGE=%s mise run apk:build\n' "${package_name}" >&2 exit 1 @@ -32,16 +34,35 @@ fi docker run --rm --platform "${platform}" \ -e "ALPINE_ARCH=${arch}" \ -e "PACKAGE_NAME=${package_name}" \ + -e "ALPINE_REPOSITORY_URL=${repository_url}" \ + -e "ALPINE_REPOSITORY_KEY_URL=${repository_key_url}" \ -v "${repo_root}/packages/local:/repo:ro" \ "alpine:${alpine_version}" \ sh -lc ' set -e - cp "/repo/${ALPINE_ARCH}"/*.rsa.pub /etc/apk/keys/ - printf "%s\n" /repo >> /etc/apk/repositories + if [ -n "${ALPINE_REPOSITORY_URL}" ]; then + if [ -n "${ALPINE_REPOSITORY_KEY_URL}" ]; then + apk add --no-cache curl >/dev/null + cd /etc/apk/keys + curl -fsSLOJ "${ALPINE_REPOSITORY_KEY_URL}" + fi + printf "%s\n" "${ALPINE_REPOSITORY_URL}" >> /etc/apk/repositories + else + cp "/repo/${ALPINE_ARCH}"/*.rsa.pub /etc/apk/keys/ + printf "%s\n" /repo >> /etc/apk/repositories + fi apk update - apk add "${PACKAGE_NAME}" + apk add \ + "${PACKAGE_NAME}" \ + "${PACKAGE_NAME}-datanode-openrc" \ + "${PACKAGE_NAME}-flownode-openrc" \ + "${PACKAGE_NAME}-frontend-openrc" \ + "${PACKAGE_NAME}-metasrv-openrc" \ + "${PACKAGE_NAME}-standalone-openrc" test -x /usr/bin/greptime greptime --version + ls -1 /etc/greptimedb + find /etc/init.d -maxdepth 1 -name "greptimedb.*" -print | sort ' diff --git a/packaging/alpine/local/greptimedb/standalone.toml b/packaging/alpine/local/greptimedb/standalone.toml new file mode 100644 index 0000000..eafda12 --- /dev/null +++ b/packaging/alpine/local/greptimedb/standalone.toml @@ -0,0 +1,46 @@ +default_timezone = "UTC" +default_column_prefix = "greptime" +init_regions_in_background = false +init_regions_parallelism = 16 +max_concurrent_queries = 0 + +[http] +addr = "127.0.0.1:4000" +timeout = "0s" +body_limit = "64MB" +enable_cors = true +prom_validation_mode = "strict" + +[grpc] +bind_addr = "127.0.0.1:4001" +runtime_size = 8 + +[grpc.tls] +mode = "disable" + +[mysql] +enable = true +addr = "127.0.0.1:4002" +runtime_size = 2 +keep_alive = "0s" +prepared_stmt_cache_size = 10000 + +[mysql.tls] +mode = "disable" + +[postgres] +enable = true +addr = "127.0.0.1:4003" +runtime_size = 2 +keep_alive = "0s" + +[postgres.tls] +mode = "disable" + +[storage] +data_home = "/var/lib/greptimedb/standalone" + +[logging] +dir = "/var/log/greptimedb/standalone" +level = "info" +enable_otlp_tracing = false diff --git a/scripts/apk/export-ci-assets.sh b/scripts/apk/export-ci-assets.sh new file mode 100755 index 0000000..f4bb4f3 --- /dev/null +++ b/scripts/apk/export-ci-assets.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +repo_name="${ALPINE_REPO_NAME:-local}" +package_name="${ALPINE_PACKAGE:-greptimedb}" +package_root="${repo_root}/packages/${repo_name}" +assets_dir="${CI_ASSETS_DIR:-${repo_root}/packages/ci-assets}" + +if [[ ! -d "${package_root}" ]]; then + printf 'missing local package repository: %s\n' "${package_root}" >&2 + exit 1 +fi + +mkdir -p "${assets_dir}" + +shopt -s nullglob +apks=("${package_root}"/*/"${package_name}"-[0-9]*.apk) +shopt -u nullglob + +if [[ "${#apks[@]}" -eq 0 ]]; then + printf 'no %s APK files found under %s\n' "${package_name}" "${package_root}" >&2 + exit 1 +fi + +for apk in "${apks[@]}"; do + arch="$(basename "$(dirname "${apk}")")" + pkgver="$( + tar -xOf "${apk}" .PKGINFO 2>/dev/null \ + | awk -F' = ' '$1 == "pkgver" { print $2; exit }' + )" + version="${pkgver%-r*}" + asset="${assets_dir}/greptime-linux-${arch}-musl-v${version}" + + printf 'Exporting %s\n' "${asset}" + tar -xOf "${apk}" usr/bin/greptime > "${asset}" + chmod 0755 "${asset}" + sha256sum "${asset}" > "${asset}.sha256sum" +done