Let's understand the Cloud and Cloud computing:
- Cloud is a term is used to describe globally available storage and computing resources. It provides a remote and virtualized infrastructure
- Cloud Computing In general, cloud computing is a "Methodology that enables highly available and quickly scalable resources.
- A computing methodology that provides services to provision and delivers resources via the Internet. It helps in reducing infrastructure management cost reduction and makes application development and?maintenance easy
- Cloud Providers: Provides access to cloud infrastructure and resources via Service Level Agreements (SLAs)
- Cloud Consumer: Who can access the cloud resources to develop and deploy the applications
- End User: Who uses the application deployed in the cloud, Does not have any knowledge about the?application backend.
What is Infrastructure as a Service (IaaS)?
- It offers to compute, storage, and networking resources on demand
- The company buys its own server. You manage your own servers and infrastructure If something breaks, you need to fix it
- Delegate Infrastructure Management Move your physical infrastructure to the cloud You just rent the servers on demand?
Infrastructure as Service Providers:
- The most used IaaS Providers are Amazon Web Service (AWS), Microsoft Azure, Google Cloud Platform (GCP)
- AWS most used one: Powerful, but complex learn
- For Demo purposes, I'm using Digital Ocean cloud provider
Setup Server on DigitalOcean:
- Servers on DigitalOcean are called "Droplets"
- Droplets are Linux-based virtual machines (VMs)
- Pre-Requisite: Create a Digital Ocean account (with new signup credits - free tier)
- Configure SSH keys
- Create a Droplet with Linux Ubuntu distribution
- Open SSH port 22 on the server using firewall configuration
- SSH into the server using public IP address
- Install Java to run the Java application on it
Setup Server on Digital Ocean: To run packaged java application (jar file)
Configure SSH keys: To be able to access any server on Do from a local computer using SSH
Create Droplet: With Linux Ubuntu distribution
- Open SSH port 22 on the server by creating a new Firewall configuration
- Inbound Rule = for incoming traffic
- Outbound Rule = for outgoing traffic
- By using the public IP address of the server
- Once the ssh is on the server, check if java is installed and get installation commands. Just type in the terminal java
Install java to run the Java application on it
- Command to install java: apt install openjdk-8-jre-headless
Run packaged Java Application on prepared Digital Ocean server
- In the real world, applications will run on a remote server!
- The server prepared to run the java application jar
- Build jar file
- Copy to a remote server
- Run the application
- I'm using build toll as Gradle
- Command to execute the build the java application: ./gradlew build
- Command to copy the jar file: scp build/libs/java-react-example.jar [email protected]:/root
Run the application on the Digital ocean server:
- Command to execute the Java application: java -jar java-react-example.jar
- Create a separate Linux user on a remote server
- Every cloud platform configuration for their remote servers is different
- On droplet, per default, you work with the "root" user
- Create a new "admin" user
- Using the "admin" user, create your own users for each application you run (e.g Jenkins, my-app, nexus, Nginx)
- Give it only the permission it needs to run that application
- Don't work with the root user!