"Es un asunto peligroso, Frodo, traspasar el umbral: vale la pena poner un pie en la carretera y, si das rienda suelta a tus pies, no sabrás adónde te llevarán".
(c) El señor de los anillos: la comunidad del anillo
Cómo empezó todo
Quería conseguirme un servidor Git doméstico para practicar el desarrollo y la implementación de proyectos favoritos. Además, es más tranquilo cuando tu trabajo no es solo en 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.
:
, .. ;
Golang - ;
;
.
. :
- 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
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-githost:~# gogs -v
Gogs version 0.11.91.0811
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.
Decidí verificar nuevamente: cloné un contenedor con Alpine y ya configuré ssh. Y luego todo resultó ser muy simple:
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 ]
Esto es realmente suficiente para poner en funcionamiento su servidor Git (si está satisfecho con la base de datos SQLite). Ahora puede ir a la interfaz web, para mí fue http://192.168.50.205:3000, y realizar la configuración básica.
Conclusión
Con este artículo, quiero resaltar la importancia de la documentación y las habilidades de Linux. Lo más probable es que los usuarios experimentados de Linux comprendieran de inmediato cuál era el problema y se rieron de buena gana de mi afición. Bueno, ahora es gracioso para mí lo tortuoso que fue mi camino =).
Pero la verdad también es que no encontré una ayuda simple para expandir el paquete de gogs en el Alpine. Espero que mi artículo sea de utilidad para quienes piensen en algo como esto.