Add additional debug points to server start process

This commit is contained in:
Dane Everitt 2022-01-31 19:30:07 -05:00
parent cd67e5fdb9
commit 7051feee01
3 changed files with 10 additions and 3 deletions

View File

@ -11,9 +11,9 @@ import (
"github.com/apex/log" "github.com/apex/log"
"github.com/beevik/etree" "github.com/beevik/etree"
"github.com/buger/jsonparser" "github.com/buger/jsonparser"
"github.com/goccy/go-json"
"github.com/icza/dyno" "github.com/icza/dyno"
"github.com/magiconair/properties" "github.com/magiconair/properties"
"github.com/goccy/go-json"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"

View File

@ -6,12 +6,14 @@ import (
"github.com/gammazero/workerpool" "github.com/gammazero/workerpool"
) )
// Parent function that will update all of the defined configuration files for a server // UpdateConfigurationFiles updates all of the defined configuration files for
// automatically to ensure that they always use the specified values. // a server automatically to ensure that they always use the specified values.
func (s *Server) UpdateConfigurationFiles() { func (s *Server) UpdateConfigurationFiles() {
pool := workerpool.New(runtime.NumCPU()) pool := workerpool.New(runtime.NumCPU())
s.Log().Debug("acquiring process configuration files...")
files := s.ProcessConfiguration().ConfigurationFiles files := s.ProcessConfiguration().ConfigurationFiles
s.Log().Debug("acquired process configuration files")
for _, cf := range files { for _, cf := range files {
f := cf f := cf
@ -26,6 +28,8 @@ func (s *Server) UpdateConfigurationFiles() {
if err := f.Parse(p, false); err != nil { if err := f.Parse(p, false); err != nil {
s.Log().WithField("error", err).Error("failed to parse and update server configuration file") s.Log().WithField("error", err).Error("failed to parse and update server configuration file")
} }
s.Log().WithField("path", f.FileName).Debug("finished processing server configuration file")
}) })
} }

View File

@ -201,11 +201,14 @@ func (s *Server) onBeforeStart() error {
// we don't need to actively do anything about it at this point, worse comes to worst the // we don't need to actively do anything about it at this point, worse comes to worst the
// server starts in a weird state and the user can manually adjust. // server starts in a weird state and the user can manually adjust.
s.PublishConsoleOutputFromDaemon("Updating process configuration files...") s.PublishConsoleOutputFromDaemon("Updating process configuration files...")
s.Log().Debug("updating server configuration files...")
s.UpdateConfigurationFiles() s.UpdateConfigurationFiles()
s.Log().Debug("updated server configuration files")
if config.Get().System.CheckPermissionsOnBoot { if config.Get().System.CheckPermissionsOnBoot {
s.PublishConsoleOutputFromDaemon("Ensuring file permissions are set correctly, this could take a few seconds...") s.PublishConsoleOutputFromDaemon("Ensuring file permissions are set correctly, this could take a few seconds...")
// Ensure all the server file permissions are set correctly before booting the process. // Ensure all the server file permissions are set correctly before booting the process.
s.Log().Debug("chowning server root directory...")
if err := s.Filesystem().Chown("/"); err != nil { if err := s.Filesystem().Chown("/"); err != nil {
return errors.WithMessage(err, "failed to chown root server directory during pre-boot process") return errors.WithMessage(err, "failed to chown root server directory during pre-boot process")
} }