diff --git a/Aliaksandr_Dzemchanka/0/Vagrantfile b/Aliaksandr_Dzemchanka/0/Vagrantfile new file mode 100644 index 0000000..4111ec4 --- /dev/null +++ b/Aliaksandr_Dzemchanka/0/Vagrantfile @@ -0,0 +1,18 @@ +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + config.vm.box = "neve/devops-test" + config.vm.box_url = [ + "file://./devops-test.box" + ] + + config.vm.network :forwarded_port, guest: 80, host: 8080 # Apache HTTP + config.vm.network :forwarded_port, guest: 443, host: 8443 # Apache HTTPS + config.vm.network :forwarded_port, guest: 5000, host: 5000 # Flask debug server + + config.vm.provision "file", source: "files/site.conf", destination: "/tmp/site.conf" + config.vm.provision "shell", path: "files/provision.sh" + + # config.vm.synced_folder "#{ENV['HOME']}/devops-test-share", "/var/www/devops-test-share" + +end diff --git a/Aliaksandr_Dzemchanka/0/files/provision.sh b/Aliaksandr_Dzemchanka/0/files/provision.sh new file mode 100644 index 0000000..5dbd782 --- /dev/null +++ b/Aliaksandr_Dzemchanka/0/files/provision.sh @@ -0,0 +1,26 @@ +#!/bin/bash +sudo killall -r infinite-loop +sudo update-rc.d -f infinite-loop remove &2>/dev/null +sudo rm /etc/init.d/infinite-loop + +cp /tmp/site.conf /etc/apache2/sites-available/site.conf > /dev/null +sudo a2enmod ssl +a2dissite 000-default.conf +a2ensite default-ssl +a2ensite site.conf > /dev/null + +echo "generate ssl" +openssl genrsa -out /etc/apache2/server.key 2048 +openssl req -new -x509 -key /etc/apache2/server.key -out /etc/apache2/server.cert -days 3650 -subj /CN=example.com + +echo "Hi, I don't do anything right now. I'm just an example of how to do basic provisioning with shell scripts." +service apache2 restart 1>&2 > /dev/null # I lied + +echo "install memcashed" +sudo apt-get update +sudo apt install memcached + +echo "install cron" +echo "* * * * * ./exercise-memcached.sh" | crontab - -u vagrant +service cron restart + diff --git a/Aliaksandr_Dzemchanka/0/files/site.conf b/Aliaksandr_Dzemchanka/0/files/site.conf new file mode 100644 index 0000000..067de24 --- /dev/null +++ b/Aliaksandr_Dzemchanka/0/files/site.conf @@ -0,0 +1,11 @@ + + DocumentRoot /var/www/html + Redirect / https://localhost:8443/ + + + + DocumentRoot /var/www/html + SSLEngine on + SSLCertificateFile /etc/apache2/server.cert + SSLCertificateKeyFile /etc/apache2/server.key + \ No newline at end of file