0728-Tomcat, Jenkins, Gitlab, Gitbash, Github

hyejin·2022년 7월 28일
0

절전 -> 시작 이점

  • 부팅속도가 줄어듬

Jenkins

tomcat.hyejin36.shop 접속

===========================mobaxterm*===========================

[ec2-user@tomcat-server ~]$ sudo su -
Last login: Wed Jul 27 14:54:07 KST 2022 on pts/1
[root@tomcat-server ~]# tomcatup
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.

-> tomcatup을 해줘야 페이지 로드

http://jenkins.hyejin36.shop:8080/ 접속

  • BuildAndDeployJob > build now > Console Output (확인)

Github 이용

https://github.com/hali-linux/hello-world에서 포크해서 내계정으로 보내기
Dashboard > BuildAndDeployJob > 구성
  • Git > Repository URL 주소 내 github로 바꿔주기
  • 지금 빌드

git clone을 통해 리포지토리에서 다운받은 폴더는 이메일, 이름 따로 설정 필요하지 않음

  • Git bash
git clone https://github.com/seo369/hello-world.git
# vi index.jsp에서 2.0으로 바꿔주기
# git add index.jsp
# git commit -m "update v2.0"
# git push origin master

지금빌드 없이 자동으로 빌드 설정

  • Dashboard > BuildAndDeployJob > 구성 > 빌드 유발
  • Poll SCM 체크 -> 1분마다 확인해서 변경사항 있으면 빌드
    • Schedule : * * * * * (1분단위로 커밋부분 확인)
  • Git bash
git clone https://github.com/seo369/hello-world.git
# vi index.jsp에서 3.0으로 바꿔주기
# git add index.jsp
# git commit -m "update v3.0"
# git push origin master

GitLab 이용

  • C:\Users\r2com\hello-world\webapp\src\main\webapp 경로에 gcp.tar 복사
$ git add .
$ git commit -m "update v3.0"
$ git push origin master

ec2 Amazon Linux2 GitLab 설치

# sudo yum install -y curl policycoreutils-python openssh-server openssh-clients perl
# sudo systemctl status sshd
# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash  //ce - free
# sudo sed -i "s/\/el\/7/\/amazon\/2/g" /etc/yum.repos.d/gitlab_gitlab*.repo
# sudo yum clean metadata
# sudo yum makecache
# sudo EXTERNAL_URL="http://tomcat.hyejin36.shop" yum install -y gitlab-ce

ee : Enterprise(유료) Edition --> ce : Community(무료) Edition

GCP

인스턴스 생성

  • 이름 : gitlab
  • 머신 유형 : 4CPU, 8GB
  • 디스크 크기 : 32GB
  • 액세스 범위 : 모든 Cloud API 에 대한 전체 액세스 허용 선택
  • 방화벽 : HTTP, HTTPS
  • 보안 > 액세스 관리 : id_rsa.pub

route53에서 레코드 생성

  • gitlab.hyejin36.shop

===========================mobaxterm===============================

$ sudo apt-get update
$ sudo apt-get install -y curl openssh-server ca-certificates perl
$ sudo apt-get install -y postfix
$ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
$ sudo EXTERNAL_URL="http://gitlab.hyejin36.shop" apt-get install gitlab-ce
$ sudo cat /etc/gitlab/initial_root_password //비밀번호 확인

  • 비밀번호 변경
    Preference > Password

firefox로 접속

  • 계정 생성
  • root계정에서 새로 만든 계정 approve 해주기

프로젝트 생성

  • name : web-site
  • Visibility Level : Public
New Branch = master 생성
  • Git bash
$ git remote remove origin
$ git remote add origin http://gitlab.hyejin36.shop/seoes/web-site.git
$ git push -uf origin master
protection 설정

개인계정 > 프로젝트 > settings > repository > Protected branches > expand > unprotected 클릭

Default branch 설정

개인계정 > 프로젝트 > settings > repository > Default branch > expand > master 변경

0개의 댓글

관련 채용 정보