-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Labels
Status: UntriagedAn issue that has yet to be triaged.An issue that has yet to be triaged.
Description
Chef Server Version
15.10.33 and previous
Platform Details
- CentOS 8
- 4 x vCPU / 8GB RAM
Configuration
Standalone
Scenario
As Chef Server admin I wish to take a backup via chef-server-ctl backup but the /tmp space is limited and cannot be extended, so I wish to use another directory.
The backup and restore logic has a number of issues related to the staging directory:
- For the DB dump is hardcoded to /tmp (or env TMPDIR)
- The --staging-dir/-d option appears as available in --help output but it is really not used in the backup logic, only in the restore.
- Even if the chef-server-ctl backup logic may pass the option backup_dir with the staging directory to chef_backup library, it is still ignored (hardcodes tmp_dir in many parts of the tar.rb backup strategy):
- https://github.com/chef/chef_backup/blob/main/lib/chef_backup/strategy/backup/tar.rb#L48-L65
- The DB dump dir should be inside the staging dir and not completely independent
- There are some privilege/permission denied issues
Steps to Reproduce
- Run chef-server-ctl backup and observer the directories in the output
- Run with --staging-dir flag and see no changes
Example
# chef-server-ctl backup --staging-dir .
Locating rsync..
/bin/rsync
Starting Chef Server backup
WARNING: Offline backup mode must stop your Chef server before continuing. You can skip this message by passing a "--yes" argument. Do you wish to proceed? (y/N): y
Bringing down the Chef Server
ok: down: bookshelf: 0s, normally up
ok: down: nginx: 0s, normally up
ok: down: oc_bifrost: 1s, normally up
ok: down: oc_id: 1s, normally up
ok: down: opensearch: 1s, normally up
ok: down: opscode-erchef: 1s, normally up
ok: down: redis_lb: 0s, normally up
Dumping Postgresql database to /tmp/chef_backup20250721-4112-qhl12s/chef_backup-2025-07-21-12-07-37.sql
could not change directory to "/tmp/d20250721-4112-q9bxx9": Permission denied
ok: down: postgresql: 0s, normally up
Writing backup manifest
Creating backup tarball
/opt/opscode/embedded/lib/ruby/gems/3.0.0/gems/mixlib-shellout-3.2.7/lib/mixlib/shellout/unix.rb:187: warning: conflicting chdir during another chdir block
tar: Eliminando la `/' inicial de los nombres
tar: Eliminando la `/' inicial de los objetivos de los enlaces
Bringing up the Chef Server
ok: run: bookshelf: (pid 4186) 0s
ok: run: nginx: (pid 4286) 0s
ok: run: oc_bifrost: (pid 4294) 0s
ok: run: oc_id: (pid 4394) 0s
ok: run: opensearch: (pid 4401) 0s
ok: run: opscode-erchef: (pid 4511) 1s
ok: run: postgresql: (pid 4624) 0s
ok: run: redis_lb: (pid 4679) 0s
Exporting tarball to /var/opt/chef-backup
Cleaning up /tmp/chef_backup20250721-4112-qhl12s
Backup Complete!
- Directory /tmp/d20250721-4112-q9bxx9 is attempted to be used by the backup logic and
- Directory /tmp/chef_backup20250721-4112-qhl12s is used for DB dump regardless of the --staging-dir value and the previous /tmp/d20250721-4112-q9bxx9 directory
Expected Result
The staging dir can be changed in the command line and the DB dump directory is nested into it.
Actual Restult
Flag --staging-dir is ignored and the staging area is in two different directories under /tmp.
tdvgit
Metadata
Metadata
Assignees
Labels
Status: UntriagedAn issue that has yet to be triaged.An issue that has yet to be triaged.