2018年2月12日月曜日

VagrantでMiniflux2がインストールされた仮想マシン(Ubuntu16.04)を構築する

Miniflux2はGo製のfeed readerです。
以下のVagrantfileを使用して、Miniflux2とPostgreSQLがインストールされた仮想マシン(Ubuntu16.04)を構築する事ができます。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.hostname = "ub1604miniflux"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "ub1604miniflux"
     vbox.cpus = 2
     vbox.memory = 2048
     vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
  end
config.vm.network "private_network", ip: "192.168.55.109", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.109", :netmask => "255.255.255.0"
  config.vm.provision "shell", inline: <<-SHELL
sed -i.bak -e "s#http://archive.ubuntu.com/ubuntu/#http://ftp.riken.jp/pub/Linux/ubuntu/#g" /etc/apt/sources.list
apt-get update
apt-get -y install language-pack-ja
localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
localectl set-keymap jp106
#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 -T template0 --locale=ja_JP.UTF-8 --encoding=UTF8 miniflux2
psql -c "
alter user postgres with password 'postgres';
create user miniflux with password 'miniflux';
grant all privileges on database miniflux2 to miniflux;
"
EOF
echo "postgres:postgres" | chpasswd
systemctl restart postgresql.service

wget https://github.com/miniflux/miniflux/releases/download/2.0.2/miniflux_2.0.2_amd64.deb
dpkg -i miniflux_2.0.2_amd64.deb

echo "DATABSE_URL=postgres://miniflux:miniflux@localhost/miniflux2?sslmode=disable" >> /etc/miniflux.conf

miniflux -migrate

apt-get -y install expect
/usr/bin/expect << EOF
spawn miniflux -create-admin
expect "Enter Username:"
send "admin\\r"
expect "Enter Password:"
send "admin123\\r"
expect eof
exit
EOF
systemctl enable miniflux
systemctl start miniflux

echo 'access http://192.168.55.109:8080/'
echo 'user: admin  password: admin123'
echo 'sample feed: http://serverarekore.blogspot.com/feeds/posts/default'
SHELL
end

○Miniflux2の画面


○関連情報
・Minifluxに関する他の記事はこちらを参照してください。

0 件のコメント:

コメントを投稿