Support a custom tmp directory location
This commit is contained in:
parent
225a89be72
commit
f85509a0c7
|
@ -132,6 +132,10 @@ type SystemConfiguration struct {
|
||||||
// Directory where local backups will be stored on the machine.
|
// Directory where local backups will be stored on the machine.
|
||||||
BackupDirectory string `default:"/var/lib/pterodactyl/backups" yaml:"backup_directory"`
|
BackupDirectory string `default:"/var/lib/pterodactyl/backups" yaml:"backup_directory"`
|
||||||
|
|
||||||
|
// TmpDirectory specifies where temporary files for Pterodactyl installation processes
|
||||||
|
// should be created. This supports environments running docker-in-docker.
|
||||||
|
TmpDirectory string `default:"/tmp/pterodactyl" yaml:"tmp_directory"`
|
||||||
|
|
||||||
// The user that should own all of the server files, and be used for containers.
|
// The user that should own all of the server files, and be used for containers.
|
||||||
Username string `default:"pterodactyl" yaml:"username"`
|
Username string `default:"pterodactyl" yaml:"username"`
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (s *Server) Install(sync bool) error {
|
||||||
if sync {
|
if sync {
|
||||||
s.Log().Info("syncing server state with remote source before executing installation process")
|
s.Log().Info("syncing server state with remote source before executing installation process")
|
||||||
if err := s.Sync(); err != nil {
|
if err := s.Sync(); err != nil {
|
||||||
return err
|
return errors.WrapIf(err, "install: failed to sync server state with Panel")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ func (s *Server) Install(sync bool) error {
|
||||||
// error to this log entry. Otherwise ignore it in this log since whatever is calling
|
// error to this log entry. Otherwise ignore it in this log since whatever is calling
|
||||||
// this function should handle the error and will end up logging the same one.
|
// this function should handle the error and will end up logging the same one.
|
||||||
if err == nil {
|
if err == nil {
|
||||||
l.WithField("error", serr)
|
l.WithField("error", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Warn("failed to notify panel of server install state")
|
l.Warn("failed to notify panel of server install state")
|
||||||
|
@ -72,7 +72,7 @@ func (s *Server) Install(sync bool) error {
|
||||||
// the install is completed.
|
// the install is completed.
|
||||||
s.Events().Publish(InstallCompletedEvent, "")
|
s.Events().Publish(InstallCompletedEvent, "")
|
||||||
|
|
||||||
return err
|
return errors.WithStackIf(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reinstalls a server's software by utilizing the install script for the server egg. This
|
// Reinstalls a server's software by utilizing the install script for the server egg. This
|
||||||
|
@ -81,7 +81,7 @@ func (s *Server) Reinstall() error {
|
||||||
if s.Environment.State() != environment.ProcessOfflineState {
|
if s.Environment.State() != environment.ProcessOfflineState {
|
||||||
s.Log().Debug("waiting for server instance to enter a stopped state")
|
s.Log().Debug("waiting for server instance to enter a stopped state")
|
||||||
if err := s.Environment.WaitForStop(s.Context(), time.Second*10, true); err != nil {
|
if err := s.Environment.WaitForStop(s.Context(), time.Second*10, true); err != nil {
|
||||||
return err
|
return errors.WrapIf(err, "install: failed to stop running environment")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ func (ip *InstallationProcess) Run() error {
|
||||||
|
|
||||||
// Returns the location of the temporary data for the installation process.
|
// Returns the location of the temporary data for the installation process.
|
||||||
func (ip *InstallationProcess) tempDir() string {
|
func (ip *InstallationProcess) tempDir() string {
|
||||||
return filepath.Join(os.TempDir(), "pterodactyl/", ip.Server.ID())
|
return filepath.Join(config.Get().System.TmpDirectory, ip.Server.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes the installation script to a temporary file on the host machine so that it
|
// Writes the installation script to a temporary file on the host machine so that it
|
||||||
|
|
Loading…
Reference in New Issue
Block a user