Browse Source

updated gogs to use correct ports, enable ssh, etc

Breandan Dezendorf 2 năm trước cách đây
mục cha
commit
0a53718264
1 tập tin đã thay đổi với 127 bổ sung0 xóa
  1. 127 0
      homelab/k3s/gogs/gogs.yaml

+ 127 - 0
homelab/k3s/gogs/gogs.yaml

@@ -23,16 +23,32 @@ spec:
           value: "1000"
         - name: PGID
           value: "1000"
+        - name: SOCAT_LINK
+          value: "false"
         ports:
         - name: web
           containerPort: 3000
+        - name: ssh
+          containerPort: 2222
         volumeMounts:
         - name: gogs-data-volume
           mountPath: "/data"
+        - name: "gogs-sshd-config"
+          mountPath: "/app/gogs/docker/sshd_config"
+          subPath: "sshd_config"
+        - name: "gogs-appini-config"
+          mountPath: "/data/gogs/conf/app.ini"
+          subPath: "app.ini"
       volumes:
       - name: gogs-data-volume
         persistentVolumeClaim:
           claimName: gogs-data-pvc
+      - name: "gogs-sshd-config"
+        configMap:
+          name: "gogs-sshd-config"
+      - name: "gogs-appini-config"
+        configMap:
+          name: "gogs-appini-config"
 ---
 apiVersion: v1
 kind: Service
@@ -46,6 +62,18 @@ spec:
   selector:
     app: gogs
 ---
+apiVersion: v1
+kind: Service
+metadata:
+  name: gogs-ssh
+spec:
+  type: ClusterIP
+  ports:
+    - name: ssh-tcp-svc
+      port: 2222
+  selector:
+    app: gogs
+---
 apiVersion: traefik.containo.us/v1alpha1
 kind: IngressRoute
 metadata:
@@ -80,6 +108,20 @@ spec:
   tls:
     certResolver: myresolver
 ---
+apiVersion: traefik.containo.us/v1alpha1
+kind: IngressRouteTCP
+metadata:
+  name: gogs-ssh-route
+spec:
+  entryPoints:
+    - ssh-tcp
+  routes:
+  - match: HostSNI(`*`)
+    priority: 10
+    services:
+    - name: gogs-ssh
+      port: 2222
+---
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
@@ -91,3 +133,88 @@ spec:
   resources:
     requests:
       storage: 500M
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: gogs-sshd-config
+  namespace: default
+data:
+  sshd_config: |
+    Port 2222
+    AddressFamily any
+    ListenAddress 0.0.0.0
+    ListenAddress ::
+    Protocol 2
+    LogLevel INFO
+    HostKey /data/ssh/ssh_host_rsa_key
+    HostKey /data/ssh/ssh_host_dsa_key
+    HostKey /data/ssh/ssh_host_ecdsa_key
+    HostKey /data/ssh/ssh_host_ed25519_key
+    PermitRootLogin no
+    AuthorizedKeysFile ca.ssh/authorized_keys
+    PasswordAuthentication no
+    PermitUserEnvironment yes
+    AllowUsers git
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: gogs-appini-config
+  namespace: default
+data:
+  app.ini: |
+    BRAND_NAME = Gogs
+    RUN_USER   = git
+    RUN_MODE   = prod
+    
+    [database]
+    TYPE     = sqlite3
+    HOST     = 127.0.0.1:5432
+    NAME     = gogs
+    SCHEMA   = public
+    USER     = gogs
+    PASSWORD = 
+    SSL_MODE = disable
+    PATH     = data/gogs.db
+    
+    [repository]
+    ROOT = /data/git/gogs-repositories
+    
+    [server]
+    DOMAIN           = gogs.dezendorf.net
+    HTTP_PORT        = 3000
+    EXTERNAL_URL     = https://gogs.dezendorf.net/
+    DISABLE_SSH      = false
+    SSH_PORT         = 2222
+    SSH_LISTEN_PORT  = 2222
+    START_SSH_SERVER = false
+    OFFLINE_MODE     = false
+    
+    [mailer]
+    ENABLED = false
+    
+    [auth]
+    REQUIRE_EMAIL_CONFIRMATION  = false
+    DISABLE_REGISTRATION        = false
+    ENABLE_REGISTRATION_CAPTCHA = true
+    REQUIRE_SIGNIN_VIEW         = false
+    
+    [user]
+    ENABLE_EMAIL_NOTIFICATION = false
+    
+    [picture]
+    DISABLE_GRAVATAR        = false
+    ENABLE_FEDERATED_AVATAR = false
+    
+    [session]
+    PROVIDER = file
+    
+    [log]
+    MODE      = file
+    LEVEL     = Info
+    ROOT_PATH = /app/gogs/log
+    
+    [security]
+    INSTALL_LOCK = true
+    SECRET_KEY   = WityxCyHAcBVyLm