以下のVagrantfileを使用して、Redis CommanderとRedis Serverがインストールされた仮想マシンを構築できます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604rediscommander"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604rediscommander"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network :public_network, ip:"192.168.1.117"
config.vm.provision "shell", inline: <<-SHELL
localectl set-locale LANG=ja_JP.UTF-8
localectl set-keymap jp106
apt-get update
# Redisのインストール
apt-get -y install redis-server
# 動作確認
redis-cli << EOF
ping
flushall
set mykey "hello world."
get mykey
EOF
# install nodejs and redis-commander
apt-get -y install curl git
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install --no-optional -g redis-commander
cat << EOF > /etc/systemd/system/rediscommander.service
[Unit]
Description=redis-commander
[Service]
Type=simple
ExecStart=/usr/bin/redis-commander
[Install]
WantedBy=multi-user.target
EOF
systemctl enable rediscommander.service
systemctl start rediscommander.service
echo 'access to http://192.168.1.117:8081/';
init 5
SHELL
end
〇Redis Commanderの画面
0 件のコメント:
コメントを投稿