雲計算與devops

什麼是雲計算

  • 以虛擬化爲基礎,爲用戶提供計算、存儲、網絡等IT資源的設施
  • 提供產品化的服務,產品類型有(Iaas,Pass,Saas,caas…..)
  • 可彈性伸縮的

雲計算分類:
- 公有云
- 私有云

Devops

  • devops研發週期
    • dev –》CI/BUILD—》deploy—-》Ops—》feedback—》 dev
package main

import (
        "io"
        "net/http"
)

func firstPage(w http.ResponseWriter, r *http.Request){
        io.WriteString(w,"<h1>Hello,this is my first page</h1>")
}

func main(){
        http.HandleFunc("/",firstPage)
        http.ListenAndServe(":8000",nil)

}

*編譯程序*
zhongtian@zhongtian-Inspiron-7559:~/workdir/devops/newweb$ env GOOS=linux GOARCH=amd64 go build
zhongtian@zhongtian-Inspiron-7559:~/workdir/devops/newweb$ ls
main.go  newweb

package main ort (
“io”
“net/http”
“os/exec”
“log”
)

func reLaunch() {
cmd := exec.Command(“sh”, “./deploy.sh”)
err := cmd.Start()
if err != nil {
log.Fatal(err)
}
err = cmd.Wait()
}

func firstPage(w http.ResponseWriter, r *http.Request) {
    io.WriteString(w, "<h1>Hello, this is my deploy server!</h1>")
    reLaunch()
}

func main() {
    http.HandleFunc("/", firstPage)
    http.ListenAndServe(":5000", nil)
}
#! /bin/sh

kill -9 $(pgrep webserver)
cd ~/newweb/
git pull https://github.com/avenssi/newweb.git
cd webserver/
./webserver &

github地址github

  • 使用github的webhook觸發部署服務
    這裏寫圖片描述

  • 在阿里雲配置站點監控

發佈了69 篇原創文章 · 獲贊 23 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章