From 51e64e4a26f468fdb6b29cf8c3c4f9b2d00ccf87 Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Tue, 13 Aug 2024 12:11:35 +0800 Subject: [PATCH 1/2] fix(overlord): pebble hangs with a read-only file system when starting the daemon (#481) Fix an issue where the Pebble daemon fails to start with a read-only file system. --- internals/overlord/overlord.go | 5 ++++- internals/overlord/state/state.go | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internals/overlord/overlord.go b/internals/overlord/overlord.go index fc257e99..a0982f3f 100644 --- a/internals/overlord/overlord.go +++ b/internals/overlord/overlord.go @@ -124,6 +124,10 @@ func New(opts *Options) (*Overlord, error) { if !osutil.IsDir(o.pebbleDir) { return nil, fmt.Errorf("directory %q does not exist", o.pebbleDir) } + if !osutil.IsWritable(o.pebbleDir) { + return nil, fmt.Errorf("directory %q not writable", o.pebbleDir) + } + statePath := filepath.Join(o.pebbleDir, cmd.StateFile) backend := &overlordStateBackend{ @@ -256,7 +260,6 @@ func loadState(statePath string, restartHandler restart.Handler, backend state.B patch.Init(s) return s, restartMgr, nil } - r, err := os.Open(statePath) if err != nil { return nil, nil, fmt.Errorf("cannot read the state file: %s", err) diff --git a/internals/overlord/state/state.go b/internals/overlord/state/state.go index c8f5b456..a44cbdfa 100644 --- a/internals/overlord/state/state.go +++ b/internals/overlord/state/state.go @@ -280,7 +280,6 @@ func (s *State) Unlocker() (unlock func() (relock func())) { // After too many unsuccessful checkpoint attempts, it panics. func (s *State) Unlock() { defer s.unlock() - if !s.modified || s.backend == nil { return } @@ -293,6 +292,9 @@ func (s *State) Unlock() { s.modified = false return } + + logger.Noticef("Cannot write state file, retrying: %v", err) + time.Sleep(unlockCheckpointRetryInterval) } logger.Panicf("cannot checkpoint even after %v of retries every %v: %v", unlockCheckpointRetryMaxTime, unlockCheckpointRetryInterval, err) From 45629c61e2c9a8141dfb4d4d605126cc1fd95f42 Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Tue, 13 Aug 2024 12:12:11 +0800 Subject: [PATCH 2/2] docs: enrich the landing page with basic concepts (#472) Improve the definition of Pebble and add fundamentals. Co-authored-by: Ben Hoyt --- docs/index.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index b5828e0f..7573f919 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,8 +1,12 @@ # Pebble -_Take control of your internal daemons!_ +**Pebble** is a lightweight Linux service manager. -**Pebble** helps you to orchestrate a set of local service processes as an organised set. It resembles well known tools such as _supervisord_, _runit_, or _s6_, in that it can easily manage non-system processes independently from the system services, but it was designed with unique features that help with more specific use cases. +It helps you orchestrate a set of local processes as an organised set. It resembles well-known tools such as _supervisord_, _runit_, or _s6_, in that it can easily manage non-system processes independently from the system services. However, it was designed with unique features such as layered configuration and an HTTP API that help with more specific use cases. + +If you need a way to manage one or more services in a container, or as a non-root user on a machine, Pebble might be for you. It handles service logs, service dependencies, and allows you to set up ongoing health checks. Plus, it has an "HTTP over unix socket" API for all operations, with simple UID-based access control. + +Pebble is useful for developers who are building [Juju charms on Kubernetes](https://juju.is/docs/sdk/from-zero-to-hero-write-your-first-kubernetes-charm), creating [Rocks](https://documentation.ubuntu.com/rockcraft/en/latest/explanation/rocks/) or Docker images, or orchestrating services in the virtual machine. ## In this documentation