以下のVagrantfileを使用して、Redis CommanderとRedis Serverがインストールされた仮想マシンを構築できます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.2"
config.vm.hostname = "db92rediscommander"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db92rediscommander"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network :public_network, ip:"192.168.1.118"
config.vm.provision "shell", inline: <<-SHELL
apt-get -y install task-japanese
sed -i -e 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
update-locale LANG=ja_JP.UTF-8
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.118:8081/';
init 5
SHELL
end
〇Redis Commanderの画面
0 件のコメント:
コメントを投稿