Posted
Filed under 개발/Linux
* Github Repository
https://github.com/go-gitea/gitea


* git 설치
[code]
$sudo apt install git
[/code]

* gitea 디렉토리에 바이너리 다운로드
[code]
$mkdir ~/gitea
$cd ~/gitea
$wget -O gitea https://dl.gitea.io/gitea/master/gitea-master-linux-arm-6
[/code]

* MySQL 셋업
[code]
$sudo mysql -u root
CREATE DATABASE gitea;
CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost';
FLUSH PRIVILEGES
^C
[/code]

* 서버실행
[code]
$cd ~/gitea
$chmod 755 gitea
$./gitea web
[/code]

* 접속 후 환경설정
데이터베이스 유형 : MySQL
호스트: 127.0.0.1:3306
Username: gitea
비밀번호: password
데이터베이스 이름: gitea
Charset: utf8
저장소 최상위 경로 : /home/pi/gitea/gitea-repositories
LFS Root Path : /home/pi/gitea/data/LFS
데몬 사용자 계정 : pi
도메인 : localhost
SSH 포트 :
HTTP 포트 : 3000
애플리케이션 URL : http://라즈베리파이IP:3000/
로그 경로 : /home/pi/gitea/log


* 서비스에 등록
[code]
$sudo nano /etc/systemd/system/gitea.service

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target

[Service]
# Modify these two values ??and uncomment them if you have
# repos with lots of files and get to HTTP error 500 because of that
###
# LimitMEMLOCK=infinity
# LimitNOFILE=65535
RestartSec=2s
Type=simple
User=pi
Group=pi
WorkingDirectory=/home/pi/gitea
ExecStart=/home/pi/gitea/gitea web
Restart=always
Environment=USER=pi
HOME=/home/pi

[Install]
WantedBy=multi-user.target
[/code]

* 서비스 시작
[code]
sudo systemctl enable gitea.service
sudo systemctl start gitea.service
[/code]

* gitea nginx 설정
[code]
$sudo nano /etc/nginx/sites-available/git.qualitybits.net
server {
    listen 443 ssl;
    server_name 도메인;
    ssl_certificate     /etc/letsencrypt/live/도메인/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/도메인/privkey.pem;

    location / {
        client_max_body_size 364M;
        proxy_pass http://localhost:3000;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        send_timeout 600;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

server {
    listen 80;
    server_name 도메인;
    return 301 https://$server_name$request_uri;
}
[/code]

* 심볼릭링크 작성
[code]
$sudo ln -s /etc/nginx/sites-available/도메인 /etc/nginx/sites-enabled/도메인
[/code]

* SSL 인증서 취득
[code]
$sudo systemctl stop nginx
$sudo certbot certonly --standalone -d 도메인
$sudo systemctl start nginx
[/code]


* 업데이트
[code]
$sudo systemctl stop gitea.service
$mv -f /home/pi/gitea/gitea /home/pi/gitea/gitea.old
$wget -O /home/pi/gitea/gitea https://dl.gitea.io/gitea/master/gitea-master-linux-arm-6
$chmod +x /home/pi/gitea/gitea
$sudo systemctl start gitea.service
[/code]


* 인증서 갱신
[code]
$ sudo systemctl stop nginx
$ sudo certbot renew
$ sudo systemctl start nginx
[/code]


* 데이터 백업
[code]
# login as your database user, for me it is root
$ su -

# navigate to your gitea folder
$ cd /home/USER/gitea

# run the dump command
$ ./gitea dump -V -t /media/USER/USB/
[/code]


* 데이터 복구
[code]
apt-get install gitea
unzip gitea-dump-1482906742.zip
cd gitea-dump-1482906742
mv custom/conf/app.ini /etc/gitea/conf/app.ini # or mv app.ini /etc/gitea/conf/app.ini
unzip gitea-repo.zip
mv gitea-repo/* /home/pi/gitea/gitea-repositories/
chown -R gitea:gitea /etc/gitea/conf/app.ini /home/pi/gitea/gitea-repositories/
mysql -u$USER -p$PASS $DATABASE <gitea-db.sql
# or  sqlite3 $DATABASE_PATH <gitea-db.sql
service gitea restart
[/code]
2020/03/15 18:54 2020/03/15 18:54
Posted
Filed under 개발/Linux
* 이해하기 쉽게 풀어서 설명해 놓은 git 설명페이지
https://backlog.com/git-tutorial/kr/


* git repositories 관리 툴에는 여러가지가 있는데 github는 프라이빗 저장소에 제한이 있다. gitlab은 시놀로지에 설치는 되는데 Docker를 지원하는 고가의 기종에서만 가능하다.
https://ux.stories.pe.kr/82


* 시놀로지 gitlab 지원모델
https://www.synology.com/ko-kr/dsm/packages/Docker-GitLab

  • 19 시리즈 : RS1619xs+, RS1219+, DS1819+
  • 18 시리즈 : FS1018, RS3618xs, RS2818RP+, RS2418RP+, RS2418+, RS818RP+, RS818+, DS3018xs, DS1618+, DS918+, DS718+, DS218+
  • 17 시리즈 : FS3017, FS2017, RS18017xs+, RS4017xs+, RS3617xs+, RS3617RPxs, RS3617xs, DS3617xs, DS1817+, DS1517+
  • 16 시리즈 : RS18016xs+, RS2416RP+, RS2416+, DS916+, DS716+, DS716+II, DS216+, DS216+II
  • 15 시리즈 : RS815RP+, RS815+, RC18015xs+, DS3615xs, DS2415+, DS1815+, DS1515+, DS415+
  • 14 시리즈 : RS3614xs+, RS3614RPxs, RS3614xs, RS2414RP+, RS2414+, RS814RP+, RS814+
  • 13 시리즈 : RS10613xs+, RS3413xs+, DS2413+, DS1813+, DS1513+, DS713+
  • 12 시리즈 : RS3412RPxs, RS3412xs, RS2212RP+, RS2212+, RS812RP+, RS812+, DS3612xs, DS1812+, DS1512+, DS712+, DS412+
  • 11 시리즈 : RS3411RPxs, RS3411xs, RS2211RP+, RS2211+, DS3611xs, DS2411+, DS1511+, DS411+, DS411+II
  • *10 시리즈 : RS810RP+, RS810+, DS1010+, DS710+


* 어쨌든 프라이빗 소스를 서비스회사에 맡기고 싶진 않아 개인서버에 git을 설치하고 웹매니징을 할수 있게 해 주는 서비스를 찾아보니 gogs와, gogs에서 파생되어 나온 gitea가 있다. 그런데 gogs는 시놀로지 서버에 설치되므로 gogs로 낙점.
https://www.slant.co/versus/1395/19087/~gogs_vs_gitea


* 속도도 다른 서비스들에 비해 충분히 빠르다.
https://gitbucket.github.io/gitbucket-news/gitbucket/2017/03/29/benchmark-of-gitbucket.html


* gogs 사용을 위해 시놀로지에 git server 설치. 유저는 생성하지 않아도 좋다.
https://www.synology.com/ko-kr/knowledgebase/DSM/help/Git/git


* 시놀로지에 gogs 설치하기
https://kimcblog.com/2018/08/28/%EC%8B%9C%EB%86%80%EB%A1%9C%EC%A7%80synology-nas%EC%97%90-github%EC%B2%98%EB%9F%BC-%EC%9A%B4%EC%9A%A9%ED%95%98%EA%B8%B0-feat-gogs-1-2/

https://kimcblog.com/2018/08/28/%ec%8b%9c%eb%86%80%eb%a1%9c%ec%a7%80synology-nas%ec%97%90-github%ec%b2%98%eb%9f%bc-%ec%9a%b4%ec%9a%a9%ed%95%98%ea%b8%b0-feat-gogs-2-2/


* 패키지 다운로드
https://gogs.io/docs/installation/install_from_binary
- gogs_0.11.86_linux_armv5를 풀어서 1_create_package 안에다 넣는다.

- 인증서에 git.주소 추가후, 역방향프록시 설정.

- 시놀로지에서 데몬 사용자 계정은 무조건 root 이다.


* 파일업로드 제한 풀기
https://dymaxionkim.github.io/beautiful-jekyll/2017-02-06-GOGS/

시놀로지 경로는 /volumeX/@appstore/Gogs/gogs/custom/conf/app.ini


* Windows에서의 git 테스트를 위한 bash 설치
- 프로그램 및 기능 -> windows 기능 켜기/끄기 -> Linux용 Windows 하위 시스템 설치 -> window store에서 win10용 ubuntu 설치.

- 각 폴더에서 바로 실행하기 위해 https://github.com/mintty/wsltty/releases 설치.


* 설치하고나서 알게된 문제
- gogs는 시놀로지에서 root 계정으로밖에 설치할수 없다

- 시놀로지는 DSM 6.0이후로 root의 ssh접속을 금한다

- gogs의 ssh 주소는 루트를 기준으로 만들어지는데 시놀로지에서 유저계정을 만들어서 ssh에 접속해도 결국 루트에 액세스할수 없어 ssh를 사용할 수가 없다. 할수없이 https 주소를 써야한다.

- xcode에서는 gogs의 remote주소를 https://도메인:포트/git주소 로 설정한뒤 로그인하는 방식으로는 인증에 실패한다. https://계정:패스워드@도메인:포트/git주소 로 설정하면 인증을 통과할 수 있다. 이때 계정은 @마크를 쓰는 이메일이 아닌 평문으로 해야 한다.
2019/02/08 00:54 2019/02/08 00:54