GCP ubuntu 에 SFTP(File zilla) 접속하기

SFTP 접속을 하기 위해서는 먼저 SSH 접속이 가능 해야 한다. SSH 접속을 하는 방법은 Google Cloud 가이드 문서에도 자세히 나와 있지만 가장 간단한 방법으로 소개를 하겠다.

  1. SSH 키 생성하기

2. SSH 키

Spring Boot 프록시 환경 Maven 업데이트

STS (Spring Tool Suite)  에서 Spring Start Project 를 생성 하면 아래와 같은 오류가 발생한다.

Project build error: Non-resolvable parent POM for com.example:TEST:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.1.4.RELEASE from https://
repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not
transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.4.RELEASE from/to central (https://repo.maven.apache.org/maven2): connect timed out and ‘parent.relativePath’ points
at no local POM

문제는 회사의 proxy 서버에 의해 repository의 파일을 업데이트 하지 못해서 발생하는 문제이다.

이런 경우에는 Maven Home Directory 에 settings.xml 파일에 프록시 세팅을 변경해 주면 해결이 된다.

React UI 라이브러리

  • Material-UI : http://www.meterial-ui.com/
    구글의 디자인 가이드라인인 머티리얼 다지인을 기반으로 만들어진 UI 라이브러리
  • React-Bootstrap : http://react-bootstrap.github.io/
    부트스트랩을 리액트 전용 UI 라이브러리로 구현
  • React Desktop : http://reactdesktop.js.org/
    데스크톱 네이티브 애플리케이션 개발 할 때 사용할 것을 가정하고 만들어진 리액트 전용 UI 라이브러리
  • Onsen UI : https://onsen.io/ 네이티브 애플리케이션과 같은 모바일 웹 어플리케이션을 구축할 목적으로 만들어진 UI 라이브러리

Kubernetes 명령어 정리

  • 참조

  • tutorial

  • 버전 정보 조회
    $ kubectl version --short

  • 쿠버네티스에서 사용 가능한 오브젝트 리스트 조회
    $ kubectl api-resources

  • object / controller 리스트 조회
    $ kubectl get {objectType}

    $ kubectl get po 
    NAME                          READY   STATUS    RESTARTS   AGE
    hello-node-775ff78448-ssbk2   1/1     Running   0          21s
    
  • object 생성하기

    1. object 생성은 command 로 하는 방식
      $ kubectl create {objectType} {objectName}
    $ kubectl create deployment hello-node -- image=registry.k8s.io/echoserver:1.4deployment.apps/hello-node created
    
    1. yaml 파일을 이용한 방식
      $ kubectl apply -f {file name}
     $ kubectl apply -f hello-deploy.yaml 
     deployment.apps/hello-node created
    
  • object 삭제하기
    $ kubectl delete {objectType} {objectName}

    $ kubectl delete deploy hello-node
    deployment.apps "hello-node" deleted
    

Mark Down 사용법

  • Markdown Tutorial:

  • Table Gerator:

1. Character Formatting

Style Syntax
Strong Surround text with two asterisks (**) or two underscore characters (__)
Emphasis Surround text with single asterisks (*)or underscore characters (_)
Strikethrough Surround text with two tildes (~~)
Code Surround text with single backquotes ( `` )
Combinations Surround text with single underscore characters or two tildes inside two asterisks. Surround text with three asterisks to apply strong emphasis.

1. Header

  • Big Header / Small Header / Header by #
    Big Header
    =========
    Small Header
    ------------
    # Header H1 
    ## Header H2
    ### Header H3
    #### Header H4
    ##### Header H5
    ###### Header H6
    

Big Header

Small Header

Header H1

Header H2

Header H3

Header H4

Header H5
Header H6

2. Thematic Breaks

  • ___, ---, *** 를 사용하면 horizontal line이 그려진다.
This is first line
___
This is second line
--- 
This is third line
***
This is fourth line

3. Block Quotes

> This is first quote
>  >  This is second quote
>  >  > This is third quote

> This is first quote > > This is second quote > > > This is third quote

4. Code Blocks

  • 코드 block을 ``` 로 묶는다.
    “`
    @Service public class PolicyHandler{ public void created_mileage(@Payload ReservationCreated reservationCreated){ Mileage.accumulateMileage(event); }
    }
    “`
@Service
public class PolicyHandler{
    public void created_mileage(@Payload ReservationCreated reservationCreated){
        Mileage.accumulateMileage(event);
    }  
}  

5. Lists

  • 순서가 없는 List 에는 -, *, + 중 하나를 쓰면 된다.
List ordered / unodered:
1. Fix usability problem
2. Clean up the page
   * Make the headings bigger
2. Push my changes
3. Create code review
   * Describe my changes
   * Assign reviewers
     * Ask for feedback

List ordered / unodered:

  1. Fix usability problem
  2. Clean up the page
    • Make the headings bigger
  3. Push my changes
  4. Create code review
    • Describe my changes
    • Assign reviewers
      • Ask for feedback

6. Tables

  • :---, :---:, ---: 을 활용하여 value 값을 정렬 할 수 있다.
| Month    | Assignee | Backup |
| -------- | -------- | ------ |
| January  | Dave     | Steve  |
| February | Gregg    | Karen  |
| March    | Diane    | Jorge  |

Month | Assignee | Backup
---:|:---:| ---
**January** | Dave | _Steve_
**February** | Gregg | _Karen_
**March** | Diane | _Jorge_
Month Assignee Backup
January Dave Steve
February Gregg Karen
March Diane Jorge
Month Assignee Backup
January Dave Steve
February Gregg Karen
March Diane Jorge

7. Links

[inline link](https://www.jetbrains.com)
[inline link with tooltip](https://www.jetbrains.com "JetBrains: Development Tools for Professionals and Teams")
[reference link][1]

[1]: https://www.jetbrains.com

inline link
inline link with tooltip
reference link

8. Images

Inline:
![Markdown logo](https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/208px-Markdown-mark.svg.png "Markdown")

Reference style:
![Markdown logo][logo]

[logo]: https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/208px-Markdown-mark.svg.png "Markdown"

[![YouTrack — Maintain Order In A World of Chaos](https://img.youtube.com/vi/rhAunB7UQFQ/sddefault.jpg)](https://www.youtube.com/watch?v=rhAunB7UQFQ)

Inline: Markdown logo

Reference style: Markdown logo

YouTrack — Maintain Order In A World of Chaos

9. Backslash Escapes

Here are a few examples of backslash escapes:

\*not emphasis*
\`not an inline code span`
1\. not an ordered list
\* not an unordered list
\# not a heading

\This is not a backslash escape - the escaped character is not a markup character.

Here are a few examples of backslash escapes:

*not emphasis*
`not an inline code span`
1. not an ordered list
* not an unordered list
# not a heading

\This is not a backslash escape – the escaped character is not a markup character.

Express 프로젝트 생성하기

  • 먼저 프로젝트를 만들고자 하는 곳에 directory를 생성하고 해당 directory로 이동합니다. 여기서는 "test" 라는 directory를 만들어 보겠습니다.
    mkdir test
    cd test
    
  • express-generator 를 설치하여 프로젝트 생성 준비를 합니다.
    npm install express-generator -g
    
  • express-generator 가 설치 됐으면 express 프로젝트를 생성합니다. 이 때 프로젝트 명은 test, view engine 은 pug template 을 사용합니다.
    express --view=pug test
    
  • 프로젝트 생성이 완료 됐으면 해당 폴더로 이동하여 dependencies 설치 후 application을 실행합니다.
    cd test
    npm install
    SET DEBUG=test:* & npm start
    
  • 브라우저에 접속 하여 결과를 확인합니다.
    http://localhost:3000/
    

Docker Hub에 image push/pull 하기

Public Docker Hub 에 Docker Image 를 올리기 위해서는 먼저 Docker Hub 에 회원가입을 해야 합니다. Docker Hub 공식 사이트 링크

  • Ubuntu 환경에서 Docker Hub 의 자신의 repository에 접근하기 위해서는 먼저 로그인이 필요합니다.
    docker login -u [USER_ID]
    

password를 입력하여 성공적으로 로그인이 되면 Login Succeeded 문구가 보입니다.

Docker hub로 image 를 push 하기 위해서는 해당 image 에 반드시 tag 가 있어야 합니다.

  • docker image에 tag 추가하기

    docker tag [테그명] [User Name]/[image 명]
    
  • Docker Hub 에 push 하기

    docker push [User Name]/[image명]
    
  • docker hub image 검색하기

    docker search [image명]
    
  • docker hub 에서 pull 하기

    docker pull [image명] 
    

Vmmem 메모리 최대치 설정

WSL2 를 사용하여 Docker 설치를 하고 나니 유난히 fan소음이 크게 들립니다.
Windows 작업관리자를 통해 프로세스 상태를 확인해 보니 Vmmem 이라는 프로세스가 메모리를 6GB 나 차지하고 있었습니다.
.wslconfig 파일을 설정을 통해서 wsl 메모리 제한을 줄 수 있습니다.

  • Ubuntu 에서 메모리 확인하기

    free -h 
    
  • WSL에 메모리 할당 하기 C:\User\{유저네임}\.wslconfig

    [wsl2]
    memory=2GB
    swap=0
    localhostForwarding=true
    
  • .wslconfig 적용 후 메모리를 체크해 보면 total Memory가 12GB –> 2GB 로 준 것을 확인 할 수 있습니다.

[wslconfig 적용 전]

[wslconfig 적용 후]