ddev: Stop cron so it doesn't change database while doing a database pull

In projects with large databases, where syncing a local development system against a remote system it could be nessecary to pause the web container to prevent inconsitences in the database.

In my case, a cron job running in the web container of my development system changes data in the database every minute. If the import of the database from a remote system during a live-dev-sync takes more than a minute, I get in troubles.

In the past, before I started to use ddev, I just paused the web container of my docker environment, did the sync (rsync + mysqldump + import) and unpaused the web container afterwards. This worked perfect.

Unfortunately there is currently no “ddev pause web” command to do this. I already tried to use the “native” docker commands docker pause ddev-project-web and docker unpause ddev-project-web to do this, which works in general, but after fireing the commands, ddev seems to loose the connection to the running containers and every following ddev command produces an error. ddev describe shows no running services.

docker compose -f .ddev/.ddev-docker-compose-full.yaml pause web ends with the same problem.

ddev service disable web is also not working, since this command can only handle “Additional Services”.

Describe your solution

Enhance ddev service disable command to disable/enable the web service as well.

Describe alternatives

Adding a command ddev pause web and ddev unpause web to pause/unpause containers managed by ddev.

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

After deleting my local db and doing a fresh sync the ddev sudo service cron stop way seems to work now.