# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 PortGroup java 1.0 name metabase version 0.49.5 revision 0 categories databases java maintainers {gmail.com:slashapp @slashapp} openmaintainer homepage https://www.metabase.com description Metabase is an open-source business intelligence platform.\ You can use Metabase to ask questions about your data,\ or embed Metabase in your app to let your customers explore\ their data on their own. long_description ${description} platforms {darwin any} supported_archs noarch license MIT master_sites https://downloads.metabase.com/v${version}/ dist_subdir ${name}/${version} set metabase_jar ${name}.jar distfiles ${metabase_jar} checksums rmd160 2cb5d71b13005bd9a93ebdba62b922e904b1ee3c \ sha256 043b49628212a9f91c129e4331e4ffba41425cc1a11604d124bcb3049c98a0bd \ size 363500884 java.version 11+ java.fallback openjdk11 use_configure no extract {} build {} test {} set metabase_wrapper ${prefix}/etc/LaunchDaemons/org.macports.${name}/${name}.wrapper set metabase_exec_dir ${prefix}/libexec/${name} set metabase_home_dir ${prefix}/var/lib/${name} set metabase_log_dir ${prefix}/var/log/${name} set metabase_run_dir ${prefix}/var/run/${name} set metabase_db_dir ${prefix}/var/db/${name} set metabase_exec ${metabase_exec_dir}/${metabase_jar} set metabase_log ${metabase_log_dir}/${name}.log set metabase_pid ${metabase_run_dir}/${name}.pid set metabase_host 127.0.0.1 set metabase_port 3000 set metabase_user metabase set metabase_group metabase set metabase_dir_list [list \ ${metabase_exec_dir} \ ${metabase_home_dir} \ ${metabase_log_dir} \ ${metabase_run_dir} \ ${metabase_db_dir} \ ] set metabase_exec_list [list \ ${distpath}/${metabase_jar} ] foreach d ${metabase_dir_list} { destroot.keepdirs-append ${destroot}${d} } destroot { foreach d ${metabase_dir_list} { xinstall -d -m 0755 -g ${metabase_group} -o ${metabase_user} \ ${destroot}${d} } foreach f ${metabase_exec_list} { xinstall -m 0644 -g ${metabase_group} -o ${metabase_user} \ ${f} \ ${destroot}${metabase_exec_dir} } } post-deactivate { # Cleanup all metabase-created files, which are significant foreach d ${metabase_dir_list} { if {${d} eq ${metabase_db_dir}} { set files [glob -nocomplain -directory ${metabase_db_dir} *] if {[llength $files] > 1} { ui_msg "********************************************************" ui_msg "To revert the system after uninstalling the port," ui_msg "delete metabase database files:" ui_msg "$ sudo rm -fr ${metabase_db_dir}" ui_msg "********************************************************" continue } } if { [file exists ${d}] } { ui_info "post-deactivate: dir exists, deleting: ${d}" delete -force ${d} } else { ui_info "post-deactivate: dir doesn't exist, skipping delete: ${d}" } } } add_users ${metabase_user} \ group=${metabase_group} \ home=${metabase_home_dir} \ shell=/bin/sh \ realname=metabase startupitem.create yes # Enable additional logging, for diagnostic purposes startupitem.logevents yes startupitem.user ${metabase_user} startupitem.group ${metabase_group} # Note: To avoid breakage when a Java port is updated/removed, use 'java_home' to select at runtime # java_home version filter not support wildcards set java_version [regsub {[^0-9.]} ${java.version} ""] startupitem.init " export JAVA_HOME=\$(/usr/libexec/java_home --failfast --version ${java_version} 2>/dev/null || /usr/libexec/java_home) export MB_PLUGINS_DIR=${metabase_exec_dir}/plugins export MB_DB_FILE=${metabase_db_dir}/${name} export MB_JETTY_HOST=${metabase_host} export MB_JETTY_PORT=${metabase_port} " startupitem.start \ "\${JAVA_HOME}/bin/java -jar ${metabase_exec}" startupitem.stop \ "kill \$(cat ${metabase_pid})" startupitem.logfile \ ${metabase_log} startupitem.pidfile \ manual ${metabase_pid} notes-append " To configure the metabase service, edit environment variables as follows: - Read document at https://www.metabase.com/docs/latest/configuring-metabase/environment-variables - \$ sudo vi ${metabase_wrapper} Once the service is enabled, metabase will: - Listen by default on: http://${metabase_host}:${metabase_port} - Write logs to: ${metabase_log} " livecheck.url "https://www.metabase.com/start/oss/jar" livecheck.regex /v(\[0-9.\]+)/${metabase_jar}