Compare commits

...

23 Commits

Author SHA1 Message Date
Chris F Ravenscroft fbef6a70fa Merge branch 'master' into dev 2023-10-07 18:01:05 -07:00
Alessandro Cabbia 48537deabd graceful shutdown (#343)
* fix: start servers on separate goroutines

* fix: listen to signals for graceful shutdowns

* fix: exit with 0 in case of programmed termination
2023-10-07 17:59:32 -07:00
Chris F Ravenscroft ebab2a0910 chore: merge back from main 2023-10-07 19:49:05 +00:00
Chris F Ravenscroft 7cbb176686 Merge branch 'shipperizer-versioning/git' into dev 2023-10-07 19:37:55 +00:00
shipperizer f474f883d4 build: drop build tags 2023-10-03 22:28:17 +01:00
shipperizer 8c3fe078b2 fix: use newer function to fetch git info for version 2023-10-03 22:28:17 +01:00
shipperizer f65ee3d63b fix: use runtime/debug to fetch git build info 2023-10-03 22:28:17 +01:00
shipperizer 6b6a64ce6a fix: exploit release-please for tagging in code 2023-10-03 22:28:17 +01:00
shipperizer fad9d82e76 ci: switch to use master as default branch and plan to drop dev 2023-10-03 20:43:16 +01:00
shipperizer 6c2ecbfcd6 ci: change pr name pattern for release please 2023-10-03 20:37:41 +01:00
Chris F Ravenscroft c551cab56f Merge branch 'master' into dev 2023-10-01 22:52:57 -07:00
Chris F Ravenscroft aa0414f02e chore(dev): release 2.3.0 (#337) 2023-10-01 22:51:37 -07:00
Chris F Ravenscroft 349431c6ca feat: Update migration code to support table names (#339) 2023-10-01 22:04:41 -07:00
Chris F Ravenscroft 15ed058754 chore: update docker sqlite with ldapgroups (#338) 2023-10-01 21:37:16 -07:00
Billy Olsen 675b236328 Fix(plugins)!: Rename the groups table to ldapgroups (#326)
The groups table name is a reserved keyword in mysql and requires that
the table name be escaped with backticks in order to use the groups
name. Other databases such as postgres do not support the use of the
backticks in the query statements. This change renames the groups table
to ldapgroups in oder to avoid this problem altogether.

This does have a dependency on the backend sql plugins to alter the
schema to match the new name.

Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
Co-authored-by: Chris F Ravenscroft <chris@voilaweb.com>
2023-10-01 21:28:49 -07:00
Chris F Ravenscroft 75d02ee368 release-please 2023-10-02 00:16:50 +00:00
Chris F Ravenscroft 0c11325a24 chore: release 2.3.0
Release-As: 2.3.0
2023-10-02 00:02:01 +00:00
Chris F Ravenscroft 0c7a513852 Resolved minor conflict 2023-09-30 22:22:50 +00:00
Chris F Ravenscroft d8398285f1 Ensure same go version for main and plugins 2023-09-30 22:12:24 +00:00
shipperizer 27c9d4cb42 build: reuse build target for each platform specific compilation 2023-09-28 10:13:37 +01:00
shipperizer 3114106563 build: create mkbindir, build and sha256 targets 2023-09-28 10:13:37 +01:00
shipperizer 75abe08313 build: use . for BUILD_FILES var to allow buildvcs flag 2023-09-28 10:13:37 +01:00
shipperizer 4e62b7cd89 build: make build vars optional and passable via env 2023-09-28 10:13:37 +01:00
+32 -24
View File
@@ -3,6 +3,15 @@ package main
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"net/http"
"os"
"os/signal"
"path/filepath"
"reflect"
"strings"
"syscall"
"time"
"github.com/GeertJohan/yubigo" "github.com/GeertJohan/yubigo"
"github.com/arl/statsviz" "github.com/arl/statsviz"
docopt "github.com/docopt/docopt-go" docopt "github.com/docopt/docopt-go"
@@ -18,12 +27,6 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"gopkg.in/amz.v3/aws" "gopkg.in/amz.v3/aws"
"gopkg.in/amz.v3/s3" "gopkg.in/amz.v3/s3"
"net/http"
"os"
"path/filepath"
"reflect"
"strings"
"time"
) )
const programName = "glauth" const programName = "glauth"
@@ -112,40 +115,45 @@ func startService() {
server.Logger(log), server.Logger(log),
server.Config(activeConfig), server.Config(activeConfig),
) )
if err != nil { if err != nil {
log.Error().Err(err).Msg("could not create server") log.Error().Err(err).Msg("could not create server")
os.Exit(1) os.Exit(1)
} }
if activeConfig.LDAP.Enabled { if activeConfig.LDAP.Enabled {
// Don't block if also starting a LDAPS server afterwards go func() {
shouldBlock := !activeConfig.LDAPS.Enabled
if shouldBlock {
if err := s.ListenAndServe(); err != nil { if err := s.ListenAndServe(); err != nil {
log.Error().Err(err).Msg("could not start LDAP server") log.Error().Err(err).Msg("could not start LDAP server")
os.Exit(1) os.Exit(1)
} }
} else { }()
go func() {
if err := s.ListenAndServe(); err != nil {
log.Error().Err(err).Msg("could not start LDAP server")
os.Exit(1)
}
}()
}
} }
if activeConfig.LDAPS.Enabled { if activeConfig.LDAPS.Enabled {
// Always block here go func() {
if err := s.ListenAndServeTLS(); err != nil { if err := s.ListenAndServeTLS(); err != nil {
log.Error().Err(err).Msg("could not start LDAPS server") log.Error().Err(err).Msg("could not start LDAPS server")
os.Exit(1) os.Exit(1)
} }
}()
} }
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
// Block until we receive our signal.
<-c
// Doesn't block if no connections, but will otherwise wait
// until the timeout deadline.
s.Shutdown()
// Optionally, you could run srv.Shutdown in a goroutine and block on
// <-ctx.Done() if your application should wait for other services
// to finalize based on context cancellation.
log.Info().Msg("AP exit") log.Info().Msg("AP exit")
os.Exit(1) os.Exit(0)
} }
func startConfigWatcher() { func startConfigWatcher() {