GitLab

AWS EC2 Setup

sudo yum update -y
sudo yum install docker -y
sudo usermod -a -G docker ec2-user
sudo systemctl start docker

sudo curl -L <https://github.com/docker/compose/releases/latest/download/docker-compose-$>(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose // 최신 docker compose를 해당 링크에서 받을 수 있음
sudo chmod +x /usr/local/bin/docker-compose // 권한 부여
docker-compose version // 설치 확인

docker-compose.yml

# docker-compose.yml
services:
  gitlab:
    image: "gitlab/gitlab-ce:latest"
    restart: always
    hostname: "localhost"
    container_name: gitlab
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url '<http://localhost>'
        gitlab_rails['time_zone'] = 'Asia/Seoul'
    ports:
      - "80:80"
      - "38022:22"
    volumes:
      - "./config:/etc/gitlab"
      - "./logs:/var/log/gitlab"
      - "./data:/var/opt/gitlab"
      - "./backup:/var/opt/gitlab/backups" # 백업 폴더 추가
    shm_size: "256m"

초기 비밀번호

cat /etc/gitlab/initial_root_password  | grep Password:

변경

Remote Migration

git branch -r | grep -v '\\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done #
git fetch --all
git fetch --tags --prune --prune-tags
git pull --all

git remote rename origin old_origin // git remote remove origin
git remote add origin ${새로운 깃 주소}
git push --set-upstream origin --tags
git push --set-upstream origin --all

Script

#!/usr/bin/env fish 
# x.x.x -> vx.x.x

# Iterate over all tags
for tag in (git tag)
    # Check if the tag does not start with 'v'
    if not string match -qr '^v' $tag
        # Define the new tag name with 'v' prefix
        set new_tag "v$tag"
        
        # Create the new tag pointing to the same commit as the old tag
        git tag $new_tag (git rev-list -n 1 $tag)
        
        # Delete the old tag locally
        git tag -d $tag
        
        # Push the new tag to the remote repository
        git push origin $new_tag
        
        # Delete the old tag from the remote repository
        git push origin --delete $tag
    end
end