26
Server Deployment BUET SADD

Server deployment

  • Upload
    bsadd

  • View
    296

  • Download
    5

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Server deployment

Server Deployment

BUET SADD

Page 2: Server deployment

Why Server Deployment ??

Page 3: Server deployment

Why use Cloud Servers???- not Dedicated Servers???

Page 4: Server deployment

Why Cloud Servers???

• Server redundancy – If a physical server fails, cloud servers can automatically be

switched to other live physical servers.• Data redundancy• Affordability

– only pay for the resources that you use• Scalability

– start with minimum resources and later you can expand them as per your requirements

– Flexible, easily done using software • No single point of failure

Page 7: Server deployment

Deployment In OpenshiftStep by Step

• Signup– Visit https://www.openshift.com/ and signup a free account– An email will be sent to your given mail address with a link, click that

to activate your account

• Open the Console and Create an Application– Go to https://

openshift.redhat.com/app/console/application_types– You’ll be provided with number of platform options in the

landing page• PHP, Ruby, Python, Java, Node.js etc

– Choose the one you need• We will deploy a sample PHP application– So we choose “PHP 5.3” under “PHP” category

Page 8: Server deployment

• In the landing page we need to provide the Public URL of your app– through this URL your application will be accessible to all– one portion of the url will always be consisting of your username and

“rhcloud”, you need to provide the other part– Can be changed later

• After providing the public URL, hit “Create Application”

Page 9: Server deployment

• In the landing page you will be provided your full public url

Page 10: Server deployment

• Openshift uses Git to manage your codebase– The needed git commands will be provided too

• At first you need to clone the default codebase into your workstation– But before that we need to setup a secure connection

by providing SSH key

Page 11: Server deployment

Setting Up SSH Key• Can be done by software , Link given in

resources section• We will use Git. OH YE !! • Open git and run the following command – ssh-keygen -t rsa -C "[email protected]"– Replace [email protected] with your own

email address – Provide a passphrase– Your key will be saved in a file “id_rsa“ in a

location similar to this “Your identification has been saved in /c/Users/you/.ssh/id_rsa.”

Page 12: Server deployment

And you are done with the SSH Key

Page 13: Server deployment

• Now first go to “My Account”• Under the “Public Keys” section– Select “Add a new key.”

Page 14: Server deployment

• Copy the content of “id_rsa.pub” file and paste it to corresponding field

• Provide a name for the key and hit create

• Now we can use Git to manage the codebase

Page 15: Server deployment

• Now go to “My Application” and choose the corresponding application name

Page 16: Server deployment

• Copy your repository address• Open git in a folder of your pc and run the command– git clone your_repository

• So all the default code in the server is now cloned/copied into that folder (say folder name is “Codebase”)

Page 17: Server deployment

• The codes are copied in a folder structure like this

• All the codes will be copied inside a folder named as your app name - “picpuzzle in our sample case”

• Inside that folder there is a folder named php• Copy all your code in that folder• You may need to change some of the config

variables before uploading like : baseurl, database name etc

Page 18: Server deployment

• Open git bash in the folder named same to your project name

• Run the command “git status” in git bash to see if the files we copied correctly or not– You should see all the copied files under untracked

files• Run “git add -A”• Run git commit –m “Fresh_project” • The run “git push origin master”– This should start uploading your codes in the server

• Go to the public url set before, after the push command finish completes execution

Page 19: Server deployment

Adding Other Functionality

• Most of the time you also need Functionalities like Database , Cron Job etc.

• Openshift provides this in the form of cartridges

• Each cartridge provides some functionality• We will add “MySQL Database” and

“phpMyAdmin” cartridge in our app

Page 20: Server deployment

Adding a cartridge

• Go to your application and hit “Add cartridge”

Page 21: Server deployment

• Select the needed cartridge , for this case “MySQL”

Page 22: Server deployment

• Then Select “Add cartridge”

• The landing page will contain the needed credentials : Root User, Root Password, Database Name

• Save this info for future use

Page 23: Server deployment

• Add phpMyAdmin cartridge like before• Save all the credentials for future use– Root User– Password– URL :

• follow the URL link to log in to phpMyAdmin providing the username password

Page 24: Server deployment

• Now you can do your database operations • You should use the corresponding IP address

(highlighted in the box – 127.3. ..) as hostname of database

Page 25: Server deployment

Resources

• http://www.vservercenter.com/dedicated-server

• http://kb.webhosting.uk.com/reasons-why-you-should-use-cloud-server-hosting/

• http://www.esecuredata.com/pricing/servers-101-cloud-servers-vs-dedicated-servers/

• http://www.cloudreviews.com/blog/free-cloud-hosting-services