構築後、http://192.168.55.105:8080にアクセスします。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604metabase"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604metabase"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.105", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.105", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
# update packages
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
# install postgresql
apt-get -y install postgresql
echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
echo "standard_conforming_strings=off" >> /etc/postgresql/9.5/main/postgresql.conf
#sed -i 's/host.*all.*all.*127.0.0.1/#host all all 127.0.0.1/g' /etc/postgresql/9.5/main/pg_hba.conf
echo "host all all 127.0.0.1/32 password" >> /etc/postgresql/9.5/main/pg_hba.conf
echo "host all all 192.168.1.0/24 password" >> /etc/postgresql/9.5/main/pg_hba.conf
echo "host all all 192.168.55.0/24 password" >> /etc/postgresql/9.5/main/pg_hba.conf
su - postgres << EOF
createdb metabase
psql -c "
alter user postgres with password 'postgres';
create user metabase with password 'metabase';
grant all privileges on database metabase to metabase;
"
EOF
echo "postgres:postgres" | chpasswd
systemctl restart postgresql.service
systemctl enable postgresql.service
# install openjdk
apt-get -y install openjdk-8-jdk
# install metabase
wget http://downloads.metabase.com/v0.25.2/metabase.jar
mkdir -p /opt/metabase
cp metabase.jar /opt/metabase
cat << EOF > /etc/systemd/system/metabase.service
[Unit]
Description=metabase
[Service]
Type=simple
Environment="MB_JETTY_PORT=8080"
Environment="MB_DB_TYPE=postgres"
Environment="MB_DB_DBNAME=metabase"
Environment="MB_DB_PORT=5432"
Environment="MB_DB_USER=metabase"
Environment="MB_DB_PASS=metabase"
Environment="MB_DB_HOST=localhost"
ExecStart=/usr/bin/java -Xmx2g -jar /opt/metabase/metabase.jar
WorkingDirectory=/opt/metabase
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
systemctl enable metabase.service
systemctl start metabase.service
echo 'access http://192.168.55.105:8080'
echo 'user: metabase, password: metabase'
SHELL
end
○関連情報
・Metabaseに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿