In this project, I automated a React.js website deploy inside a Ubuntu Vagrant Box using Ansible
The React.js code is from a friend of mine, he is still updating it with some changes, the link of his GitHub repo is: https://github.com/Lucca-GB/NetflixClone.git
- Create Vagrant box automatically with Vagrantfile
- Automated Git clone
- Automatically build React.js code
- Automatically deploy it in Apache2
- Automate git pull's from source repository
Before the next steps, make sure you have Vagrant, Ansible and git installed and working in your machine. Also you need to be using a linux operating system and make the necessary changes in "Additional information"
git clone https://www.github.com/ian-soares/deploy-with-ansible app
cd app
chmod +x run.sh
./run.sh
- In the ssh-keys folder, you need to change the id.rsa file to match with your ssh key;
- It is very important that you check your bridge network interface and change it in Vagrantfile, where mine was enp2s0;
- Also in Vagrantfile, define your Ubuntu Box ip matching to the bridge interface range (mine was 192.168.15.0/24, then I chose .205). If you notice that you need to change it, also modify the ip in ansible/inventory.ini;
- After the test, you can just run
vagrant halt
to stop the VM orvagrant destroy
to destroy it (you need to be in vagrant directory);