Programmer Application Note

2016년 6월 7일 화요일

docker gitlab 설치

오후 10:17 Posted by PAN.SPOT , , No comments
$sudo docker search gitlab
$sudo docker pull gitlab/gitlab-ce
$sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 443:443 --publish 80:80 --publish 222:22 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab
  • docker run 시 옵션은 상황에 맞게 조정하도록 함.

image backup

$sudo docker commit gitlab gitlab-backup //컨테이너 이미지로 저장
$sudo docker save gitlab-backup > ~/gitlab.tar // 이미지 파일로 백업
$sudo docker load < ~/gitlab.tar // 백업한 파일로 복구 

참고 : https://hub.docker.com/r/gitlab/gitlab-ce/

docker 자동완성

오후 5:48 Posted by PAN.SPOT , No comments


docker 자동완성

$cd ~
$curl -o .docker-completion.sh https://raw.githubusercontent.com/docker/docker/master/contrib/completion/bash/docker
$sudo vi .profile
"source .docker-completion.sh" 추가

2016년 4월 25일 월요일

opensource cloud owncloud 설치 방법 ubuntu용

오후 11:33 Posted by PAN.SPOT No comments
xUbuntu_14.04 owncloud-9.0.1-3.1
You can add the repository key to apt. Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information). Run the following shell commands as root to trust the repository:
wget -nv https://download.owncloud.org/download/repositories/stable/xUbuntu_14.04/Release.key -O Release.key
apt-key add - < Release.key
Run the following shell commands as root to add the repository and install from there.
sh -c "echo 'deb http://download.owncloud.org/download/repositories/stable/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
apt-get update
apt-get install owncloud

아파치 웹서버 포트 변경
vi /etc/apache2/ports.conf
Listen "포트 번호"

해당 포트로 접속 시 owncloud로 접속 가능

2016년 2월 15일 월요일

git ^M 문자 제거 및 diff ^M 문자 표시 제거

오후 6:35 Posted by PAN.SPOT , , No comments


linux 사용자일 경우 아래와 같이 설정 하면 된다.


$ git config --global core.autocrlf input

$ git config --global core.whitespace \ trailing-space,space-before-tab,cr-at-eol


보다 자세한 내용은 아래참조.

(출처 : https://git-scm.com/book/ko/v1/Git%EB%A7%9E%EC%B6%A4-Git-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0)


core.autocrlf

윈도에서 개발하는 동료와 함께 일하면 줄 바꿈(New Line) 문자에 문제가 생긴다. 윈도는 줄 바꿈 문자로 CR(Carriage-Return)과 LF(Line Feed) 문자를 둘 다 사용하지만, Mac과 Linux는 LF 문자만 사용한다. 아무것도 아닌 것 같지만, 크로스 플랫폼 프로젝트에서는 꽤 성가신 문제다.
Git은 커밋할 때 자동으로 CRLF를 LF로 변환해주고 반대로 Checkout할 때 LF를 CRLF로 변환해 주는 기능이 있다. core.autocrlf 설정으로 이 기능을 켤 수 있다. 윈도에서 이 값을 true로 설정하면 Checkout할 때 LF 문자가 CRLR 문자로 변환된다:
$ git config --global core.autocrlf true
줄 바꿈 문자로 LF를 사용하는 Linux와 Mac에서는 Checkout할 때 Git이 LF를 CRLF로 변환할 필요가 없다. 게다가 우연히 CRLF가 들어간 파일이 저장소에 들어 있어도 Git이 알아서 고쳐주면 좋을 것이다.core.autocrlf 값을 input으로 설정하면 커밋할 때만 CRLF를 LF로 변환한다:
$ git config --global core.autocrlf input
이 설정을 이용하면 윈도에서는 CRLF를 사용하고 Mac, Linux, 저장소에서는 LF를 사용할 수 있다.
윈도 플랫폼에서만 개발하면 이 기능이 필요 없다. 이 옵션을 false라고 설정하면 이 기능이 꺼지고 CR 문자도 저장소에도 저장된다:
$ git config --global core.autocrlf false

core.whitespace

Git에는 공백 문자를 다루는 방법으로 네 가지가 미리 정의돼 있다. 두 가지는 기본적으로 켜져 있지만 끌 수 있고 나머지 두 가지는 꺼져 있지만 켤 수 있다.
먼저 기본적으로 켜져 있는 것을 살펴보자. trailing-space는 각 줄 끝에 공백이 있는지 찾고 space-before-tab은 모든 줄 처음에 tab보다 공백이 먼저 나오는지 찾는다.
기본적으로 꺼져 있는 나머지 두 개는 indent-with-non-tab과 cr-at-eol이다. intent-with-non-tab은 tab이 아니라 공백 8자 이상으로 시작하는 줄이 있는지 찾고 cr-at-eol은 줄 끝에 CR 문자가 있어도 괜찮다고 Git에 알리는 것이다.
core.whitespace 옵션으로 이 네 가지 방법을 켜고 끌 수 있다. 설정에서 해당 옵션을 빼버리거나 이름이-로 시작하면 기능이 꺼진다. 예를 들어, 다른 건 다 켜고 cr-at-eol 옵션만 끄려면 아래와 같이 설정한다:
$ git config --global core.whitespace \
    trailing-space,space-before-tab,indent-with-non-tab

2016년 2월 14일 일요일

git 명령어 모음

오후 7:52 Posted by PAN.SPOT , , No comments

git 유용한 명령어 모음

  • 삭제된 파일만 되돌리기
    • git ls-files -d | xargs git checkout --
  • git remote 정보 보기
    • git remote show origin
  • branch 생성과 동시에 checkout 하기
    • git checkout -b <branch>
  • branch 생성과 동시에 checkout 하고 remote와 동기화 하기
    • git checkout -b <branch> origin/<branch>
  • 로컬 브랜치를 원격 브랜치로 push 하기
    • git push origin <branch>
  • 로컬 브랜치를 remote의 master브랜치에 push 하기
    • git push origin <branch>:master
  • 로컬 브랜치 삭제하기
    • git branch -D <branch>
  • 원격 브랜치 삭제하기
    • git push origin :<branch>
    • git push origin :heads/<branch>
  • 원격 브랜치와 로컬브랜치 tracking 정보 설정
    • git branch --set-upstream-to=origin/<branch> <branch>
  • git pull 할 때 3-way merge message 없이 깔끔하게 pull 하기
    • git pull --rebase
  • git pull --rebase 기본 옵션으로 사용하기
    • git config --global pull.rebase true
  • 임시저장 - commit 하지 않고 다른 git 명령어 사용하고 싶을때(pull,push등)
    • git stash //임시저장
    • git stash pop //임시저장 불러오기
  • 마지막 커밋 메세지 수정
    • git commit --amend
  • git tag 목록
    • git tag
  • git tag 생성
    • git tag v1.1 //Lightweight
    • git tag -a v1.1 -m "message"//Annotated
  • git tag push
    • git push origin --tags
  • git tag 삭제
    • git tag -d v1.1
  • 원격 tag 삭제하기
    • git push origin :<tag>
    • git push origin :tags/<tag>
  • merge 충돌 없이 하기
    • git merge -Xours <branch> (작업사본 우선)
    • git merge -Xtheirs <branch> (대상 우선)
  • log option
    • git log OPTION
OPTION
  • -p 각 커밋에 적용된 패치를 보여준다.
  • --stat 각 커밋에서 수정된 파일의 통계정보를 보여준다.
  • --shortstat --stat 명령의 결과 중에서 수정한 파일, 추가된 줄, 삭제된 줄만 보여준다.
  • --name-only 커밋 정보중에서 수정된 파일의 목록만 보여준다.
  • --name-status 수정된 파일의 목록을 보여줄 뿐만 아니라 파일을 추가한것인지, 수정한 것인지, 삭제한 것인지도 보여준다.
  • --abbrev-commit 40자 짜리 SHA-1 체크섬을 전부 보여주는 것이 아니라 처음 몇 자만 보여준다.
  • --relative-date 정확한 시간을 보여주는 것이 아니라 “2 weeks ago”처럼상대적인 형식으로 보여준다.
  • --graph 브랜치와 머지 히스토리 정보까지 아스키 그래프로 보여준다.
  • --pretty 지정한 형식으로 보여준다. 이 옵션에는 oneline, short,full, fuller, format이 있다. format은 원하는 형식으로 출력하고자 할 때 사용한다.
  • format option
    • git log --pretty=format:"OPTION"
FORMAT OPTION
  • %H 커밋 해시
  • %h 짧은 길이 커밋 해시
  • %T 트리 해시
  • %t 짧은 길이 트리 해시
  • %P 부모 해시
  • %p 짧은 길이 부모 해시
  • %an 저자 이름
  • %ae 저자 메일
  • %ad 저자 시각 (형식은 –date= 옵션 참고)
  • %ar 저자 상대적 시각
  • %cn 커미터 이름
  • %ce 커미터 메일
  • %cd 커미터 시각
  • %cr 커미터 상대적 시각
  • %s 요약

2016년 1월 5일 화요일