AlpineLinuxにGogsホームGitサーバーをインストールした方法

「フロド、しきい値を超えるのは危険なビジネスです。道路に足を踏み入れる価値があり、足を自由に操ると、どこに連れて行かれるのかわかりません。」 





(c)ロードオブザリング:リングの交わり





すべてが始まった経緯

ペットプロジェクトの開発と展開を練習するためのホームGitサーバーを自分で取得したかったのです。さらに、作業がgithubだけではない場合は、より落ち着きます。





Alpine linux, . . , , .





Proxmox 6.1-3, Alpine  (template) - Alpine Linux 3.12 Kernel 5.3.10-1-pve on an x86_64.





Git- . , . git-, . Gogs.io.





:





  1. , .. ;





  2. Golang - ;





  3. ;





  4. .





. :





  • - 4 x AMD Ryzen 3 1200 Quad-Core





  • - 8





  • - SSD ZFS





1-2 . . , 1-2 git- , 512 8 .





Alpine

Alpine Proxmox . . , . , .





, . Alpine :





alpine:~# apk search zabbix
      
      



:





alpine:~# hostname gogs-githost
      
      



openssh nano , ssh:





gogs-githost:~# apk add openssh nano
      
      



:





gogs-githost:~# rc-update add sshd
      
      



/etc/ssh/sshd_config :





...
Port 22
PermitRootLogin yes
...
      
      



, :





gogs-githost:~# /etc/init.d/sshd start
      
      



Gogs

Alpine Gitea. , . git- :





gogs-githost:~# apk add gogs
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/8) Installing ca-certificates (20191127-r4)
(2/8) Installing nghttp2-libs (1.41.0-r0)
(3/8) Installing libcurl (7.69.1-r3)
(4/8) Installing expat (2.2.9-r1)
(5/8) Installing pcre2 (10.35-r0)
(6/8) Installing git (2.26.3-r0)
(7/8) Installing gogs (0.11.91-r1)
Executing gogs-0.11.91-r1.pre-install
(8/8) Installing gogs-openrc (0.11.91-r1)
Executing busybox-1.31.1-r19.trigger
Executing ca-certificates-20191127-r4.trigger
OK: 89 MiB in 38 packages
      
      



, gogs , git. :





gogs-githost:~# gogs web
2021/03/18 20:13:42 [ WARN] Custom config '/usr/bin/custom/conf/app.ini' not found, ignore this if you're running first time
2021/03/18 20:13:42 [TRACE] Custom path: /usr/bin/custom
2021/03/18 20:13:42 [TRACE] Log path: /usr/bin/log
2021/03/18 20:13:42 [TRACE] Log Mode: Console (Trace)
2021/03/18 20:13:42 [ INFO] Gogs 0.11.91.0811
2021/03/18 20:13:42 [ INFO] Cache Service Enabled
2021/03/18 20:13:42 [ INFO] Session Service Enabled
2021/03/18 20:13:42 [ INFO] SQLite3 Supported
2021/03/18 20:13:42 [ INFO] Run Mode: Development
2021/03/18 20:13:42 [FATAL] [...gogs/gogs/cmd/web.go:66 checkVersion()] Fail to read 'templates/.VERSION': open /usr/bin/templates/.VERSION: no such file or directory
      
      



, . /usr/bin, gogs.





. .





- Gogs Linux. Gogs, , Alpine:





gogs-githost:~# gogs -v
Gogs version 0.11.91.0811
      
      



. /opt Alpine:





gogs-githost:/opt# wget https://dl.gogs.io/0.11.91/gogs_0.11.91_linux_amd64.tar.gz
      
      



:





gogs-githost:/opt# tar -xvf gogs_0.11.91_linux_amd64.tar.gz
      
      



, , . gogs:





gogs-githost:/opt# chown -R root:root gogs
      
      



(: , - Alpine mysl, ):





gogs-githost:/opt/gogs# ./gogs web
-ash: ./gogs: not found
      
      



gogs Alpine :





gogs-githost:/opt/gogs# cp /usr/bin/gogs gogs
      
      



! -. …





, “ !” . , Alpine, . , , .





- Alpine () . gogs Alpine.





- , . - . , gogs- :





gogs-githost:~# gogs web -c /etc/gogs/conf/app.ini
2021/03/20 19:22:47 [TRACE] Custom path: /usr/bin/custom
2021/03/20 19:22:47 [TRACE] Log path: /var/log/gogs
2021/03/20 19:22:47 [TRACE] Log Mode: File (Info)
2021/03/20 19:22:47 [ INFO] Gogs 0.11.91.0811
      
      



-, -.





, . GUI, , bash. 





, . , - /etc/init.d/gogs, :





#!/sbin/openrc-run
name=gogs
conffile="$GOGS_CUSTOM/conf/app.ini"
command="/usr/bin/gogs"
command_args="web -c $conffile"
start_stop_daemon_args="${GOGS_USER:+--user} $GOGS_USER --env GOGS_CUSTOM=$GOGS_CUSTOM"
pidfile="/var/run/gogs.pid"
command_background="yes"

depend() {
        use logger dns
        need net
        after firewall
}
      
      



:





#!/sbin/openrc-run

name=gogs
conffile="/etc/gogs/conf/app.ini"
command="/usr/bin/gogs"
command_args="web -c $conffile"
start_stop_daemon_args="${GOGS_USER:+--user} root --env GOGS_CUSTOM=/etc/gogs"
pidfile="/var/run/gogs.pid"
command_background="yes"

depend() {
        use logger dns
        need net
        after firewall
}
      
      



, - (, -). Alpine?





, ! , . , openssh.





もう一度確認することにしました。Alpineを使用してコンテナーのクローンを作成し、sshを既に構成しました。そして、すべてが非常に単純であることが判明しました。





alpine:~# apk add gogs
alpine:~# rc-update add gogs
 * service gogs added to runlevel default
alpine:~# /etc/init.d/gogs start
 * Starting gogs ...                                                                     [ ok ]
alpine:~# rc-status
Runlevel: default
 networking                                                                    [  started  ]
 sshd                                                                             [  started  ]
 crond                                                                            [  started  ]
 gogs                                                                             [  started  ]
      
      



これは、Gitサーバーを稼働させるのに本当に十分です(SQLiteデータベースに満足している場合)。これで、Webインターフェイスに移動できます。私にとってはhttp://192.168.50.205:3000で、基本設定を行うことができます。





結論

この記事では、Linuxのドキュメントとスキルの重要性を強調したいと思います。おそらく、経験豊富なLinuxユーザーは、問題が何であるかをすぐに理解し、私のアマチュアリズムを心から笑いました。さて、今、私の道がどのように曲がっていたかは私自身にとって面白いです=)。





しかし、真実はまた、私がアルパインでゴグパッケージを拡張することについての簡単な助けを見つけられなかったということです。私の記事がこのようなことを考えている人たちに役立つことを願っています。








All Articles