도커 연구 _08 목장 파이프 라인 컨테이너 기반 CICD을 사용하여 제작 노트

CICD 개요

  • CI- 지속적인 통합 (지속적인 통합) : 개발 관행의 트렁크에 통합 자주 코드 (컴파일, 출판, 자동화 된 테스트 포함) 각 통합 자동화 된 빌드는 통합 오류를 가능한 한 빨리 찾기 위해, 확인한다.
  • CD-연속 배치 (연속 배포), 테스트 자동화를 완료 구축하고 프로덕션 환경에 배포하기 위해 코드를 제출

메소드 목장에서 CI / CD를 수행

  1. 타사 도구를 사용 드론 / 트래비스 / 젠킨스,은 webhook으로, 목장 CLI는 등 업데이트의 배포를 트리거 
  2. 사용 Rancher pipeline파이프 라인 목장에 배포 된 신청서를 제출 소스에서 빌드를

목장 파이프 라인 배포

Ranche 파이프 라인은 새로운 기능 목장 V1.6.13 업데이트 릴리스입니다. 그렇지 그렇다면 V1.6.13 먼저 목장의 업그레이드해야합니다.
목장 파이프 라인 설치가 매우 간단합니다, 검색 파이프 라인 앱 스토어

기본 구성 키 배포

서비스가 시작된 후 파이프 라인의 다른 인프라 애플리케이션, 당신은 메뉴 상단에 선을 볼 것이다

아래와 같이 우선, 오픈 후의 효과를 줄 때 느리게 재생 될 것이다 UI 파일을로드에 기인 할 수있다

인증 자식 저장소

선택 gitlab

gitlab을 설정하는 프롬프트 단계에 따라

OAuth를 기반 인증의 GitLab 구성

클라이언트 ID와 비밀 키를 생성

그냥 생성 된 클라이언트 ID와 비밀 키를 작성하고 정보 Tianxie의 gitlab을 확인

권한 부여

확인을 기다리는 중

검증 성공

당신은 (다른 계정으로 다시 로그인 종료하려면 gitlab) 더 많은 계정을 추가 할 수 있습니다

GO 데모

줄을 추가

단계 추가

mkdir -p /go/src/10.240.4.160/example
ln -s $(pwd) /go/src/10.240.4.160/example/go
cd /go/src/10.240.4.160/example/go/outyet
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/outyet

docker pull 10.240.4.159/example/outyet:demo
/data/tomcat/webapps:/usr/local/tomcat/webapps

https://github.com/golang/example

创建容器的时候指定启动参数,自动挂载localtime文件到容器内
https://github.com/lawrli

##

 

 

参考文档:

将证书拷贝到如10.240.4.158客户机上并信任

scp -P 50022 10.240.4.160.crt 10.240.4.158:/usr/local/share/ca-certificates/

mattermost_external_url ‘https://10.240.4.160
mattermost_nginx[‘redirect_http_to_https’] = true
mattermost[‘gitlab_auth_endpoint’] = “https://10.240.4.160/oauth/authorize
mattermost[‘gitlab_token_endpoint’] = “https://10.240.4.160/oauth/token
mattermost[‘gitlab_user_api_endpoint’] = “https://10.240.4.160/api/v4/user

##

openssl req -new -newkey rsa:2048 -nodes -out 10.240.4.160.csr -keyout 10.240.4.160.key -subj "/C=CN/ST=Harbin/L=Harbin/O=ydgw/OU=IT/CN=10.240.4.160"

openssl x509 -in 10.240.4.160.crt -text -noout


cp 10.240.4.160.crt /usr/local/share/ca-certificates/


/data/dns-etc/resolv.dnsmasq:/etc/resolv.dnsmasq
/data/dns-etc/dnsmasqhosts:/etc/dnsmasqhosts
/data/dns-etc/dnsmasq.conf:/etc/dnsmasq.conf
/etc/localtime:/etc/localtime:ro

dns (Expected state running but got error: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "process_linux.go:398: container init caused \"rootfs_linux.go:58: mounting \\\"/data/docker-dns/dnsmasq.conf\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/3daf5708bcea4ec8da7108e5c8d6b2d030010e5a1fbe7d86349dc3db1a3fd774\\\" at \\\"/var/lib/docker/aufs/mnt/3daf5708bcea4ec8da7108e5c8d6b2d030010e5a1fbe7d86349dc3db1a3fd774/etc/dnsmasq.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type) 



docker run -d -p 53:53/tcp -p 53:53/udp --cap-add=NET_ADMIN --name dns-server andyshinn/dnsmasq


docker pull andyshinn/dnsmasq
mkdir -p /data/docker-dns
cd /data/docker-dns

vi resolv.dnsmasq
nameserver 202.97.224.68
nameserver 114.114.114.114
nameserver 8.8.8.8

vi dnsmasqhosts
10.240.4.160  gitlab  gitlab.ydgw.cn


vi dnsmasq.conf
resolv-file=/etc/dnsmasq.d/resolv.dnsmasq
addn-hosts=/etc/dnsmasq.d/dnsmasqhosts

resolv-file=/etc/dnsmasq.d/resolv.dnsmasq
addn-hosts=/etc/dnsmasq.d/dnsmasqhosts

docker tag SOURCE_IMAGE[:TAG] 10.240.4.159/app/IMAGE[:TAG]
docker-compose -f ./dns.yaml up -d

 


 

容器-Docker为什么火?
Google自2004年就开始使用容器技术,目前他们每周要启动超过20亿个容器,每秒种新启动的容器就超过3000个,在容器技术方面有大量的积累。
曾相继开源了Cgroup(Control Groups)和Imctfy(Google开源Linux容器)这两个重量级项目。Google对Docker的支持力度非常大,不仅把imctfy先进之处融入Docker之中,还把自已的容器管理系统(kubernetes)也开源出来。

技术的发展产生了大量优秀的系统和软件。
操作系统:Redhat/Centos、Debian/Ubuntu、FreeBSD、SUSE等
编程语言:Java、Python、Ruby、Golang、C/C++等
WEB服务器:Apache、Nginx、Lighttpd等
数据库:Mysql、Redis、Mongodb等

软件开发人员在这么多种类中自由选择,结果就是维护一个非常庞大的开发、测试和生产环境,开发、测试和运维人员就会被种类繁多的环境折腾的筋疲力尽。即使只选择其中一两种,随着操作系统和软件版本的更新迭代,维护工作还是变得越来越庞大。

추천

출처www.cnblogs.com/duwamish/p/10953958.html