云计算与devops
程序员文章站
2022-03-08 12:16:33
...
什么是云计算
- 以虚拟化为基础,为用户提供计算、存储、网络等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触发部署服务
在阿里云配置站点监控
上一篇: freemarker制作word模板
下一篇: 灵能传输-贪心