仮想マシン構築後、ブラウザからhttp://192.168.55.104:3179でWeb UIにアクセスできます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604camlistore"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604camlistorer"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.104", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.104", :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
locale-gen ja_JP.UTF-8
localectl set-locale LANG=ja_JP.UTF-8
# install go
wget https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz
tar xvfz go1.9.2.linux-amd64.tar.gz
mv go /usr/local
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
#
cd /opt
apt-get -y install git
git clone https://camlistore.googlesource.com/camlistore
cd /opt/camlistore
source /etc/profile
/usr/local/go/bin/go run make.go
useradd cs
chown -R cs:cs /opt/camlistore
cat << EOF > /etc/systemd/system/camlistore.service
[Unit]
Description=Camlistore
After=network.target
[Service]
Type=simple
ExecStart=/bin/bash -c -i 'export HOME=/opt/camlistore && cd /opt/camlistore && /opt/camlistore/bin/camlistored'
WorkingDirectory=/opt/camlistore
Restart=on-failure
User=cs
Group=cs
[Install]
WantedBy=multi-user.target
EOF
systemctl enable camlistore.service
systemctl start camlistore.service
# 3179ポートでlistenするまで待つ.
while netstat -lnt | awk '$4 ~ /:3179$/ {exit 1}'; do sleep 10; done
sleep 10
sed -i -e 's/"auth": "localhost"/"auth":"userpass:admin:admin"/' /opt/camlistore/.config/camlistore/server-config.json
chown -R cs:cs /opt/camlistore
systemctl restart camlistore.service
echo 'access http://192.168.55.104:3179'
SHELL
end
○Camlistoreの画面
0 件のコメント:
コメントを投稿