Giter VIP home page Giter VIP logo

2-vm_task's Introduction

2-VM_Task

What is monolithic architecture ?

  • Monolithic applications consist of a single codebase that interacts with a single database. The application’s client interface, single database, frontend, backend and business logic are incorporated into one codebase. There is only one test and deployment pipeline to maintain.

mon

Two Virtual Machines

new final dia

Vagrant File to create 2 Virtual Machines:

Vagrant.configure("2") do |config|
    config.vm.define "app" do |app|  ## this will create first machine named 'app'
      app.vm.box = "ubuntu/bionic64"  # creating a virtual machine ubuntu
      app.vm.network "private_network", ip: "192.168.10.100"  # add private network
      app.vm.synced_folder ".", "/home/vagrant/app" # change it to your home location  ## now let's sync our app folder from localhost and sync it to VM
      app.vm.provision "shell", path: "provision.sh", privileged: false    ## config provision file
                                     # provide path for your provision.sh 
    end
  
    config.vm.define "db" do |db|  ## this will create second machine called 'db'
      db.vm.box = "ubuntu/bionic64"
      db.vm.network "private_network", ip: "192.168.10.150"
      
    end
  end

Provision.sh file to automate the installation tasks:

  ## Automate download of dependencies

## update & upgrade
sudo apt-get update -y
sudo apt-get upgrade -y

## Install nginx
sudo apt-get install nginx -y

sudo systemctl enable ngninx # to enable nginx

sudo systemctl start nginx  # to start nginx

## Download nodejs version 6 or above
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -  # to navigate the web link to download nodejs version 6 or above

## Install nodejs

sudo apt-get install nodejs -y

## Install pm2

sudo npm install pm2 -g

Reverse proxy

  • We need to create reverse proxy in VM-1 (app)
  • To do that, first run 'vagrant ssh app'
  • Inside app VM run 'sudo nano /etc/nginx/sites-available/default'
  • Now, you'll land into default file, in that file go to the server_name and under location block add 'proxy_pass http://localhost:3000;'

rever pro

  • after editing, save it and exit the file.
  • Now, check the syntax error by running 'sudo nginx -t'
  • Now go to app/app and run 'npm start'

new today dia

final add

2-vm_task's People

Contributors

arpitb95 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.