'ITWeb/개발일반'에 해당되는 글 489건

  1. 2022.03.14 [Shell] Bash String Replacement.
  2. 2022.03.14 [Python] pip upgrade.
  3. 2022.01.24 [Python] pyenv install from local tar.xz 설치 하기.
  4. 2022.01.24 [Gradle] configurations 를 이용한 log4j dependency 반영
  5. 2022.01.06 [GIT] branch/tag 운영 전략.
  6. 2021.12.30 [Bash] jq -r raw output (no quote)
  7. 2021.12.07 [Nginx] 설치 하기.
  8. 2021.11.30 [Spring] bean name conflict resolve.
  9. 2021.11.30 [Spring] @Autowired vs @RequiredArgsConstructor
  10. 2021.11.29 [MySQL] group_concat 사용 시 순서 지정.

[Shell] Bash String Replacement.

ITWeb/개발일반 2022. 3. 14. 12:14

docker-compose.yml 내 .env 를 이용한 활용이 안되는 경우 아래 처럼 그냥 string replacement 를 통해서 처리 할 수도 있습니다.

bash 에서  array, loop, replacement 에 대한 예제로 작성해 둡니다.

 

SERVICE_NAME='{{SERVICE_NAME}}=escs'
VERSION='{{VERSION}}=8.0.0'
CONTAINER_NAME='{{CONTAINER_NAME}}=escs-c'

DOCKER_VAR=( $SERVICE_NAME $VERSION $CONTAINER_NAME )

for var in "${DOCKER_VAR[@]}"; do
    kvs=($(echo $var | tr "=" "\n"))
    # linux
    sed -i "s/${kvs[0]}/${kvs[1]}/g" docker-compose.yml
    # osx
    sed -i '' "s/${kvs[0]}/${kvs[1]}/g" docker-compose.yml
done

 

:

[Python] pip upgrade.

ITWeb/개발일반 2022. 3. 14. 12:06

 

pip install 하다 보면 pip upgrade 를 하라는 메시지를 접할 때가 있습니다.

제공 하는 메시지는 'pip install --upgrade pip' 인데 이대로 실행 했을 경우 잘 안될 때는 아래와 같이 user 옵션을 주고 실행해 보시면 됩니다.

 

$ pip install --user --upgrade pip

 

:

[Python] pyenv install from local tar.xz 설치 하기.

ITWeb/개발일반 2022. 1. 24. 12:12

맥북 기준으로 작성 합니다.

 

$HOME/.pyenv/cache

위 경로에 설치 하고자 하는 python tar.xz 파일을 다운로드 받아서 넣어 두고 진행을 하면 됩니다.

 

$ wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz 

$ mv ~/Downloads/Python-3.9.9.tar.xz ~/.pyenv/cache/

$ pyenv install 3.9.9

 

이와 같이 하면 설치가 가능 합니다.

사내 보안 정책으로 설치가 안될 경우 활용 하면 됩니다.

 

:

[Gradle] configurations 를 이용한 log4j dependency 반영

ITWeb/개발일반 2022. 1. 24. 11:40

최근에 발생한 log4j 보안 이슈로 인해서 patch 작업이 필요 했었는데요.

build.gradle 에서 configurations 를 이용해서 쉽게 적용 할 수 있는 방법인데 기억하기 위해 이것도 기록해 봅니다.

 

관련 보안 내용은 아래 링크 참고 하시면 됩니다.

Log4j – Apache Log4j Security Vulnerabilities

 

Log4j – Apache Log4j Security Vulnerabilities

<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apa

logging.apache.org

build.gradle)

configuration {
  all {
  	resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    	if ( details.requested.group == 'org.apache.logging.log4j' ) {
        	details.useVersion '2.17.1'
        }
    }
  }
  
  compileOnly {
    extendsFrom annotationProccessor
  }
}

 

:

[GIT] branch/tag 운영 전략.

ITWeb/개발일반 2022. 1. 6. 12:12

브랜치로 운영 할 지 태그로 운영 할 지 결정해서 사용 하시면 됩니다.

태그의 경우는 수정이 안되기 때문에 배포 전략으로는 적합해 보입니다.

 

간단하게 branch/tag 운영 전략으로 Step 정리만 기록 합니다.

 

Step 1)

master 에서 dev 브랜치 생성

 

Step 2)

dev 브랜치로 dev, qa 환경까지 기능 테스트

 

Step 3)

qa 환경까지 검증이 완료 되었다면,

master 에서 merge 브랜치 생성

 

Step 4)

merge 브랜치에 dev 브랜치 머지

 

Step 5)

merge 브랜치를 qa에 배포

 

Step 6)

qa 배포 후 문제 없을 경우,

 

Step 7)

merge 브랜치를 master 로 머지

 

Step 8)

master 브랜치에서 release branch or tag 를 생성

 

Step 9)

release branch or tag 로 prod 배포

merge, dev 브랜치 삭제

 

브랜치 생성 및 삭제)

$ git checkout -b 브랜치명

$ git push origin 브랜치명

 

$ git branch -d 브랜치명

$ git push origin --delete 브랜치명

 

태그 생성 및 삭제)

$ git tag 태그명

$ git push origin 태그명

 

$ git tag -d 태그명

$ git push origin :태그명

 

 

:

[Bash] jq -r raw output (no quote)

ITWeb/개발일반 2021. 12. 30. 16:25

이런 것도 기억력 도움을 위해서 그냥 한 줄 남겨 봅니다.

 

$ jq .hits.total.relation 하면 

Output)

"eq"

이렇게 나오는데 저는 저 quotation 이 싫습니다.

 

그래서 아래 옵션 주고 하시면 됩니다.

 

$ jq -r .hits.total.relation

Output)

eq

 

:

[Nginx] 설치 하기.

ITWeb/개발일반 2021. 12. 7. 09:28

docker 를 이용해서 쉽게 구성이 가능 하지만 소스 내려 받아서 빌드 해서 설치 하는 것도 필요해서 정리해 봅니다.

필요한 모듈은 추가적으로 구성이 가능 하니까 필요에 따라 설치 하세요.

 

- 사전 준비 환경

$ wget https://nginx.org/download/nginx-1.20.2.tar.gz
$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ wget --no-check-certificate http://www.openssl.org/source/openssl-1.1.1l.tar.gz
$ wget --no-check-certificate http://www.openssl.org/source/openssl-3.0.0.tar.gz
$ wget https://github.com/openresty/headers-more-nginx-module/archive/refs/tags/v0.33.tar.gz
$ wget https://github.com/vozlt/nginx-module-vts/archive/refs/tags/v0.1.18.tar.gz


- 설치 인스턴스 전송

$ scp nginx-1.20.2.tar.gz $TARGET:/home/user/download/
$ scp zlib-1.2.11.tar.gz $TARGET:/home/user/download/
$ scp openssl-1.1.1l.tar.gz $TARGET:/home/user/download/
$ scp openssl-3.0.0.tar.gz $TARGET:/home/user/download/
$ scp v0.33.tar.gz $TARGET:/home/user/download/headers-more-nginx-module-0.33.tar.gz
$ scp v0.1.18.tar.gz $TARGET:/home/user/download/nginx-module-vts-0.1.18


- 설치 인스턴스에서 실행

$ yum install gcc gcc-c++
$ mkdir /home/user/apps/nginx
$ cd download
$ tar -xvzf nginx-1.20.2.tar.gz
$ tar -xvzf zlib-1.2.11.tar.gz
$ tar -xvzf openssl-1.1.1l.tar.gz
$ tar -xvzf openssl-3.0.0.tar.gz
$ tar -xvzf headers-more-nginx-module-0.33.tar.gz
$ tar -xvzf nginx-module-vts-0.1.18.tar.gz

$ cd nginx-1.20.2
$ ./configure --prefix=/home/user/apps/nginx --with-http_stub_status_module 
--with-http_ssl_module --with-http_v2_module --with-http_secure_link_module 
--with-http_realip_module --with-stream --with-mail --with-mail_ssl_module 
--with-openssl-opt=enable-tlsext --with-openssl=/home/user/download/openssl-1.1.1l 
--add-module=/home/user/download/headers-more-nginx-module-0.33 
--add-module=/home/user/download/nginx-module-vts-0.1.18
$ make
에러발생
***** Unsupported options: enable-tlsext
이 에러는 삭제된 옵션 이기 때문에 발생 합니다. (openssl 0.9.8j 이후 부터는 기본 활성화 되어 있습니다.)

$ ./configure --prefix=/home/user/apps/nginx --with-http_stub_status_module 
--with-http_ssl_module --with-http_v2_module --with-http_secure_link_module 
--with-http_realip_module --with-stream --with-mail --with-mail_ssl_module 
--with-openssl=/home/user/download/openssl-1.1.1l 
--add-module=/home/user/download/headers-more-nginx-module-0.33 
--add-module=/home/user/download/nginx-module-vts-0.1.18
$ make
$ make install

 

:

[Spring] bean name conflict resolve.

ITWeb/개발일반 2021. 11. 30. 12:17

간단하게는 명시적으로 선언을 해주시면 됩니다.

 

서로 다른 패키지에 같은 이름의 class 가 존재 할 경우 발생 할 수 있습니다.

이런 경우 아래와 같이 선언해 주시면 됩니다.

 

@RestController("cat.RestHealthController")

@Service("cat.service.HealthService")

 

@RestController("cluster.RestHealthController")

@Service("cluster.service.HealthService")

 

:

[Spring] @Autowired vs @RequiredArgsConstructor

ITWeb/개발일반 2021. 11. 30. 10:36

Spring DI 선언에 사용 합니다.

 

[Spring Autowired Annotation]

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html

 

[Lombok RequiredArgsConstructor Annotation]

https://projectlombok.org/api/lombok/RequiredArgsConstructor.html

 

:

[MySQL] group_concat 사용 시 순서 지정.

ITWeb/개발일반 2021. 11. 29. 18:28

참고문서)

https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat

 

group by 를 이용해서 특정 컬럼의 value 를 concat 할 경우 해당 테이블의 특정 컬럼으로 순서를 맞춰 줘야 할 경우가 있습니다.

group_concat 함수 내부에 order by 를 이용해서 적용 하시면 됩니다.

 

이렇게 하지 않았을 경우 순서에 대해 보장이 된다고 간혹 착각 할 수 있느데 주의 해서 사용하시기 바랍니다.

 

: