mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 12:32:40 +00:00
helm tmp
This commit is contained in:
parent
6d76e9c2fb
commit
b0b30cc4e9
3 changed files with 43 additions and 29 deletions
|
@ -10,6 +10,8 @@ data:
|
|||
{{ tpl (.Values.config | toYaml) . | indent 4 }}
|
||||
replace_secrets.sh: |
|
||||
#!/bin/sh
|
||||
ls
|
||||
exit 0
|
||||
set -e
|
||||
config_file="/tmp/config/config.yml"
|
||||
output_file="/config/config.yml"
|
||||
|
|
|
@ -32,20 +32,6 @@ spec:
|
|||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
initContainers:
|
||||
- name: init-config
|
||||
image: busybox
|
||||
command: [ "/bin/sh", "/scripts/replace_secrets.sh" ]
|
||||
volumeMounts:
|
||||
- name: config-template
|
||||
mountPath: /tmp/config
|
||||
- name: secret-config
|
||||
mountPath: /tmp/secrets
|
||||
readOnly: true
|
||||
- name: scripts
|
||||
mountPath: /scripts
|
||||
- name: config
|
||||
mountPath: /config
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
|
@ -89,7 +75,7 @@ spec:
|
|||
volumeMounts:
|
||||
- name: opengist-data
|
||||
mountPath: /opengist
|
||||
- name: config
|
||||
- name: config-cm
|
||||
mountPath: /config.yml
|
||||
subPath: config.yml
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
|
@ -103,21 +89,9 @@ spec:
|
|||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: config
|
||||
emptyDir: {}
|
||||
- name: config-template
|
||||
- name: config-cm
|
||||
configMap:
|
||||
name: {{ include "opengist.fullname" . }}
|
||||
- name: secret-config
|
||||
secret:
|
||||
secretName: {{ include "opengist.fullname" . }}-secret
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: {{ include "opengist.fullname" . }}
|
||||
items:
|
||||
- key: replace_secrets.sh
|
||||
path: replace_secrets.sh
|
||||
mode: 0755
|
||||
{{- if .Values.volumes }}
|
||||
{{- toYaml .Values.volumes | nindent 8 }}
|
||||
{{- end }}
|
||||
|
|
|
@ -12,8 +12,10 @@ import (
|
|||
"github.com/thomiceli/opengist/internal/web"
|
||||
"github.com/urfave/cli/v2"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var CmdVersion = cli.Command{
|
||||
|
@ -29,10 +31,30 @@ var CmdStart = cli.Command{
|
|||
Name: "start",
|
||||
Usage: "Start Opengist server",
|
||||
Action: func(ctx *cli.Context) error {
|
||||
stopCtx, stop := signal.NotifyContext(ctx.Context, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
Initialize(ctx)
|
||||
|
||||
fmt.Println("OG_DEV:", os.Getenv("OG_DEV"))
|
||||
homeDir := config.GetHomeDir()
|
||||
fmt.Println("Home Directory:", homeDir)
|
||||
sessionPath := path.Join(config.GetHomeDir(), "sessions")
|
||||
fmt.Println("Session Path:", sessionPath)
|
||||
fmt.Println("About to start server")
|
||||
|
||||
go web.NewServer(os.Getenv("OG_DEV") == "1", path.Join(config.GetHomeDir(), "sessions")).Start()
|
||||
fmt.Println("http server started")
|
||||
go ssh.Start()
|
||||
select {}
|
||||
fmt.Println("ssh server started")
|
||||
|
||||
fmt.Println("stop")
|
||||
<-stopCtx.Done()
|
||||
fmt.Println("sig")
|
||||
shutdown()
|
||||
fmt.Println("done")
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -116,6 +138,22 @@ func Initialize(ctx *cli.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func shutdown() {
|
||||
log.Info().Msg("Shutting down database...")
|
||||
if err := db.Close(); err != nil {
|
||||
log.Error().Err(err).Msg("Failed to close database")
|
||||
}
|
||||
|
||||
log.Info().Msg("Shutting down index...")
|
||||
if config.C.IndexEnabled {
|
||||
if err := index.Close(); err != nil {
|
||||
log.Error().Err(err).Msg("Failed to close index")
|
||||
}
|
||||
}
|
||||
|
||||
log.Info().Msg("Shutdown complete")
|
||||
}
|
||||
|
||||
func createSymlink(homePath string, configPath string) error {
|
||||
if err := os.MkdirAll(filepath.Join(homePath, "symlinks"), 0755); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue