〇Swirlの画面
〇構築方法
1.以下のVagrantfileを使用して、Swirl/Docker/Docker Composeがインストールされた仮想マシン(Ubuntu18.04)を構築します。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.hostname = "ub1804swirl"
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"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1804swirl"
vbox.gui = true
vbox.cpus = 2
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get -y install language-pack-ja
sed -i.bak -e "s#http://archive.ubuntu.com/ubuntu/#http://ftp.riken.jp/pub/Linux/ubuntu/#g" /etc/apt/sources.list
localectl set-locale LANG=ja_JP.UTF-8
localectl set-keymap jp106
apt-get update
# install docker-ce
apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable test edge"
apt-get update
apt-get -y install docker-ce
groupadd docker
adduser vagrant docker
systemctl enable docker
docker version
# install docker compose
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
# initizalize swarm
docker swarm init --advertise-addr 192.168.55.104 | grep -e '--token' | sed -e 's/ //' - > /vagrant/joincmd.sh
# install swirl
cat << EOF > docker-compose.yml
version: '3'
services:
swirl:
image: cuigh/swirl
environment:
DB_ADDRESS: mongodb:27017/swirl
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- 8001:8001
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
depends_on:
- mongodb
mongodb:
image: mongo:3.7-jessie
container_name: "mongodb"
volumes:
- "mongodb-data:/data/db"
- "mongodb-configdb:/data/configdb"
ports:
- 27017:27017
volumes:
mongodb-data:
driver: local
mongodb-configdb:
driver: local
EOF
docker-compose up -d
echo 'access http://192.168.55.104:8001/'
SHELL
end
2.ブラウザからhttp://192.168.55.104:8001にアクセスして、管理者情報を入力します。
○関連情報
・Swirlに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿