Github Actions CI / CD 설정 구현
Github Actions 는 Github 의 지속 적 인 통합 서비스 입 니 다. Actions 를 누 르 면 Github 의 프로젝트 에 프로필 을 만 듭 니 다. 실제 .github/workflows 에 저 장 된 .yml 로 끝 나 는 파일 입 니 다.1. 프로필 의 기본 용어 구조
(1) workflow (작업 절차): 한 번 의 운행 과정 을 지속 적 으로 통합 하 는 것 이 바로 workflow 입 니 다.
(2) job (퀘 스 트): 하나의 workflow 는 하나 이상 의 jobs 로 구성 되 어 있 으 며, 한 번 의 지속 적 인 통합 운영 으로 여러 작업 을 수행 할 수 있다 는 뜻 이다.
(3) step (절차): 모든 job 는 여러 step 로 구성 되 어 한 걸음 한 걸음 완성 된다.
(4) action (동작): step 마다 하나 이상 의 명령 (action) 을 순서대로 수행 할 수 있 습 니 다.
2. 인 스 턴 스 demo, Github 의 항목 을 클 라 우 드 서버 에 자동 으로 업데이트
Github 에 하나 있어 요.
관 변 시장 원 하 는 액 션 을 검색 하면 됩 니 다.... 에 있다
steps 설정uses 이 걸 인용 하 겠 습 니 다.action 의 스 크 립 트.name: Blog CI  #     
on: #     ,master  push     workflow
  push:
    branches: [ master ]
jobs:
  build:
    runs-on: ubuntu-latest #       
    steps:
    - name: Checkout  #     ,  actions/checkout@v2
      uses: actions/checkout@v2
    - name: Install Node.js #     Node  ,  actions/setup-node@v1
      uses: actions/setup-node@v1
      with:
        node-version: '12.x'
    - name: Install & Build #           
      run: |
        yarn config set registry https://registry.npm.taobao.org 
        yarn install
        yarn build
    - name: Deploy to Server #        ,  easingthemes/[email protected],  ssh     
      uses: easingthemes/[email protected]
      env:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}  #   ,         /root/.ssh/authorized_keys  
          ARGS: ${{ secrets.ARGS }} #       /   rsync  ,  -avzr --delete,                     --exclude  , --exclude /uploads/   
          SOURCE: "build/" #    
          REMOTE_HOST: ${{ secrets.REMOTE_HOST }} #      
          REMOTE_PORT: ${{ secrets.REMOTE_PORT }} # ssh     
          REMOTE_USER: root #      
          TARGET: ${{ secrets.REMOTE_TARGET }} #       
3. 민감 한 데이터 설정
클 라 우 드 서버 에 배치 하려 면 인증 이 필요 하기 때문에 해당 민감 한 데 이 터 를 직접 노출 할 수 없다. Github 에 서 는 프로젝트
setting 의 Secrets 에 해당 하 는 환경 변 수 를 설정 한 다음 ${{}} 문법 을 통 해 해당 변 수 를 방문 할 수 있다.Nginx 설치 및 설정
제 서버 가 사용 해서
Nginx 여기 간단하게 기록 을 해 볼 게 요.Nginx 는 고성능 HTTP 와 역방향 프 록 시 웹 서버 로 평소 응용 장면 은 역방향 프 록 시 서버, 정적 자원 서버, 부하 균형 등 기능 으로 사용 할 수 있다.설치 에 사용 되 는 리 눅 스 의 경우 윈도 와 맥 은 설치 패 키 지 를 직접 다운로드 할 수 있다.
1. 설치
yum install nginx -y # Centos 7.x    yum    2. 관련 폴 더
rpm -ql nginx 을 사용 하여 Nginx 주로 어디 에 설치 되 어 있 는 지, /etc/nginx/nginx.conf Nginx 에 대응 하 는 메 인 프로필 을 봅 니 다.3. 상용 조작 명령
nginx -s reload  #         ,        ,   
nginx -s reopen     #    Nginx
nginx -s stop    #     
nginx -s quit    #              
nginx -T         #      Nginx      
systemctl enable nginx  #           Nginx    4. 상용 설정
4.1 우선 메 인 프로필
/etc/nginx/nginx.conf 의 기본 구 조 를 살 펴 본다.main        #     ,     
├── events  # Nginx         
|   ├── worker_connections 1024;#          
├── http    #     ,  ,                    
│   ├── upstream #            ,      ,           
│   ├── server   #            ,   http         server  
│   ├── server
│   │   ├── location  #   server      location ,location       uri
│   │   ├── location
│   │   └── ...
│   └── ...
└── ...
4.2 상대 적 으로 완전한 설정 demo
#   For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
    worker_connections 1024;
}
http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;   #          
    server {
        listen 80; #     
        server_name www.example.com #     ;
        rewrite ^(.*)$  https://$host$1 # $host$1           ,   http        https   ;  
    }
    
# Settings for a TLS enabled server.
    server {
        listen       443 ssl http2 default_server;
        listen       [::]:443 ssl http2 default_server;
        server_name  _;
        root         /usr/share/nginx/html;
        #ssl    
        ssl_certificate /etc/nginx/Nginx/ssl.crt; #     
        ssl_certificate_key /etc/nginx/Nginx/ssl.key; #     
           ssl_session_timeout 10m;
        ssl_session_cache shared:SSL:1m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        location / {
            root /home/dist #       ;
            index index.html;
            try_files  $uri $uri/ /index.html @rewrites; #    history        
        }
        #       、      
        location /public {
          alias           /home/public;  #       
          autoindex             on;   #          
          autoindex_exact_size  off;  # on(  )         ,   byte;off        ,  KB、MB、GB
          autoindex_localtime   off;   # off(  )         GMT  ;on             
       }
        location ~ /api/ {
          proxy_pass http://www.example.com:8080; #        uri
       }
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}4.3 기타 설정
/etc/nginx/conf.d 디 렉 터 리 에 추가 Gzip 설정gzip on; #   off,    gzip
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_static on; #   off,      .gz       
gzip_proxied any; #   off,               
gzip_vary on; #        `Vary: Accept-Encoding`
gzip_comp_level 6; # gzip   ,     1-9,1      ,9  ,         ,      ,  4-6
gzip_buffers 16 8k; #               ,16 8k     8k*16     
gzip_min_length 1k; #              
gzip_http_version 1.1; #   1.1,  Gzip     HTTP  레 퍼 런 스
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Control Version de una base de datos OraclePodemos는 Flyway y Liquibase의 새로운 기반 버전을 제어할 수 있는 프로젝트를 제안합니다. Dada la integración de SQLcl y Liquibase, este ejemplo nos...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.