mirror of
https://github.com/krislamo/graylog_demo
synced 2024-12-16 06:50:35 +00:00
Refactoring to divide services among two boxes
This commit is contained in:
parent
d9139b715a
commit
c95cbdbaa6
62
Vagrantfile
vendored
62
Vagrantfile
vendored
@ -20,6 +20,7 @@ Vagrant.configure("2") do |config|
|
||||
vbox.cpus = 4
|
||||
end
|
||||
|
||||
# Common provision
|
||||
node.vm.provision "shell", inline: <<-SHELL
|
||||
|
||||
# Set SELinux to permissive
|
||||
@ -44,20 +45,6 @@ Vagrant.configure("2") do |config|
|
||||
# Convenience
|
||||
yum install -y vim
|
||||
|
||||
# Install jq
|
||||
yum install -y epel-release
|
||||
yum install -y jq
|
||||
|
||||
# Install apache
|
||||
yum install -y httpd
|
||||
systemctl start httpd
|
||||
systemctl -q enable httpd
|
||||
|
||||
# Install rsyslog
|
||||
yum install -y rsyslog
|
||||
systemctl start rsyslog
|
||||
systemctl -q enable rsyslog
|
||||
|
||||
# Install td-agent
|
||||
cp /vagrant/td-agent.repo /etc/yum.repos.d/
|
||||
yum check-update
|
||||
@ -70,26 +57,22 @@ Vagrant.configure("2") do |config|
|
||||
systemctl restart td-agent
|
||||
systemctl -q enable td-agent
|
||||
|
||||
# Add rsyslog forwarding option if it does not exist
|
||||
if ! grep -q "127.0.0.1:5140" /etc/rsyslog.conf; then
|
||||
echo "*.* @127.0.0.1:5140" >> /etc/rsyslog.conf
|
||||
systemctl restart rsyslog
|
||||
fi
|
||||
|
||||
SHELL
|
||||
|
||||
# Install newest docker-compose
|
||||
# Commmon provision: install docker-compose
|
||||
node.vm.provision "shell", path: "install-compose.sh"
|
||||
|
||||
# Start compose services and add default input
|
||||
# Graylog specific provision
|
||||
if server == "graylog"
|
||||
node.vm.provision "shell", inline: <<-SHELL
|
||||
|
||||
# Bring up containers
|
||||
# Install jq
|
||||
yum install -y epel-release
|
||||
yum install -y jq
|
||||
|
||||
# Start Graylog
|
||||
cd /vagrant
|
||||
/usr/local/bin/docker-compose up -d 2> /dev/null
|
||||
cd /vagrant/wordpress
|
||||
/usr/local/bin/docker-compose up -d 2> /dev/null
|
||||
cd /vagrant
|
||||
|
||||
# Wait 120 seconds for Graylog to come online
|
||||
SECONDS=0
|
||||
@ -139,8 +122,35 @@ Vagrant.configure("2") do |config|
|
||||
-u admin:admin \
|
||||
"http://graylog.172.28.128.30.xip.io:8080/api/system/inputs" \
|
||||
-d @GELFTCPInput.json
|
||||
|
||||
SHELL
|
||||
|
||||
elsif server == "systems"
|
||||
node.vm.provision "shell", inline: <<-SHELL
|
||||
|
||||
# Install apache
|
||||
yum install -y httpd
|
||||
systemctl start httpd
|
||||
systemctl -q enable httpd
|
||||
|
||||
# Install rsyslog
|
||||
yum install -y rsyslog
|
||||
systemctl start rsyslog
|
||||
systemctl -q enable rsyslog
|
||||
|
||||
# Add rsyslog forwarding option if it does not exist
|
||||
if ! grep -q "127.0.0.1:5140" /etc/rsyslog.conf; then
|
||||
echo "*.* @127.0.0.1:5140" >> /etc/rsyslog.conf
|
||||
systemctl restart rsyslog
|
||||
fi
|
||||
|
||||
# Bring up WordPress test containers
|
||||
cd /vagrant/wordpress
|
||||
/usr/local/bin/docker-compose up -d 2> /dev/null
|
||||
|
||||
SHELL
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -40,8 +40,8 @@ services:
|
||||
|
||||
networks:
|
||||
traefik-net:
|
||||
external:
|
||||
name: vagrant_traefik-net
|
||||
# external:
|
||||
# name: vagrant_traefik-net
|
||||
|
||||
volumes:
|
||||
db_data: {}
|
||||
|
Loading…
Reference in New Issue
Block a user