`
sillycat
  • 浏览: 2486702 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

MetaBase UI Console(2)Docker on MySQL

阅读更多
MetaBase UI Console(2)Docker on MySQL

Setup MetaBase on CentOS 7
Install JAVA
> sudo yum install java-1.8.0-openjdk-devel

> java -version
openjdk version "1.8.0_191"

Once the java ENV are there, we can directly run the command
> java -jar metabase-metabase-2018-11-27.jar

Try to Set up Docker for That

Create a Database First
> create database metabase;
> grant all privileges on metabase.* to metabase@"%" identified by 'metabase';
> flush privileges;

Backend will use MySQL. Make the docker information.

Dockerfile will describe all the ENV we need.
#Set Up PHP FPM

#Prepre the OS
FROM centos:7
MAINTAINER Carl Luo <luohuazju@gmail.com>

#install the softwarea
RUN yum -y update
RUN yum install -y java-1.8.0-openjdk-devel

#install metabase
RUN      mkdir -p /tool/
ADD        install/metabase.jar /tool/
WORKDIR /tool/

#start the application
EXPOSE  3000
RUN     mkdir -p /app/
ADD     start.sh /app/
WORKDIR /app/
CMD    [ "./start.sh" ]

Makefile will describe all the ENV we have.
PORT = 3001
MB_DB_USER = metabase
MB_DB_PASS = metabase
MB_DB_HOST = localhost

IMAGE=sillycat/public
TAG=centos7-metabase
NAME=centos7-metabase-$(PORT)

prepare:
    wget http://downloads.metabase.com/v0.31.1/metabase.jar -P install/

docker-context:

build: docker-context
    docker build -t $(IMAGE):$(TAG) .

run:
    docker run -d -p $(PORT):3000 -e MB_DB_USER=${MB_DB_USER} -e MB_DB_PASS=${MB_DB_PASS} -e MB_DB_HOST=${MB_DB_HOST} --name $(NAME) $(IMAGE):$(TAG)

debug:
    docker run -ti -p $(PORT):3000 --name $(NAME) $(IMAGE):$(TAG) /bin/bash

clean:
    docker stop ${NAME}
    docker rm ${NAME}

logs:
    docker logs ${NAME}

publish:
    docker push ${IMAGE}

start.sh is the file to Start the metabase application
#!/bin/sh -ex

export MB_DB_TYPE=mysql
export MB_DB_DBNAME=metabase
export MB_DB_PORT=3306
export MB_JETTY_HOST=0.0.0.0

cd /tool/
java -jar -Xms2048M -Xmx2048M -XX:NewSize=512m -XX:MaxNewSize=1024m metabase.jar


References:
http://sillycat.iteye.com/blog/2434410

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics