Code Monkey home page Code Monkey logo

ddev-cron's Introduction

DDEV logo with light and dark mode variants

CircleCI project is maintained Gitpod Ready-to-Code Open in GitHub Codespaces

DDEV is an open-source tool for running local web development environments for PHP, Python and Node.js, ready in minutes. Its powerful, flexible per-project environment configurations can be extended, version controlled, and shared. DDEV allows development teams to adopt a consistent Docker workflow without the complexities of bespoke configuration.

Documentation

To check out live examples, docs, contributor live training, guides and more visit ddev.com and ddev.readthedocs.io

Questions

If you need help, our friendly community provides great support.

Wonderful Sponsors

DDEV is an Apache License 2.0 open-source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider sponsoring DDEV development.

DDEV Sponsor logos with light and dark mode variants

Contributing

See “How can I contribute to DDEV?” in the FAQ, and the Contributing page.

Overview of GitHub contributions

Get Started

  1. Check System Requirements: macOS (Intel and Apple Silicon), Windows 10/11, WSL2, Linux, Gitpod, and GitHub Codespaces.
  2. Install a Docker provider and DDEV.
  3. Try a CMS Quick Start Guide.

Additionally, https://ddev.com/get-started/ provides an up-to-date getting-started guide.

Highlighted Features

  • Quickly create local web development environments based on code repositories, with minimal configuration.
  • Import a database to any of your local environments.
  • Import upload files to match the project (e.g. Drupal sites/default/files or WordPress wp-content/uploads).
  • Customizable integration with hosting platforms like Platform.sh, Pantheon, Acquia and others.
  • Run commands within the Docker environment using ddev exec.
  • View logs from the web and database containers.
  • Use ddev ssh to explore the Linux environment inside the container.
  • List running projects with ddev list.
  • Snapshot databases with ddev snapshot.
  • Temporarily share your development website with others using ddev share.
  • Create custom commands as simple shell scripts.
  • Enjoy effortless, trusted HTTPS support.
  • Extend and customize environments as much (or as little!) as you need to.

Run ddev to see all the commands.

ddev-cron's People

Contributors

drifteaur avatar echavaillaz avatar natanael-aguiar avatar rfay avatar sreichel avatar stasadev avatar tyler36 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ddev-cron's Issues

cron time task shows earlier time than expected

I've renamed time.cron.example as time.cron to enable the regular task to log time in a file, using this guide https://github.com/ddev/ddev-cron?tab=readme-ov-file#logging-current-time.

If I restart the web container and execute afterwards tail -f time.log, entries are shown every minute:

Mon Jan  8 11:27:01 UTC 2024
Mon Jan  8 11:28:01 UTC 2024

However, the time is wrong: it's 1 hour earlier than I've set it up in my timezone.

I've setup ddev config --timezone=Europe/Berlin.

Command ddev exec date shows the right time from Berlin now.

However, log entries from time.log are 1 hour earlier.

I got a running TYPO3 system over my DDEV instance.
My DDEV version is latest: 1.22.6

Other users confirmed this behaviour with a dummy project. It seems setting the timezone in the config is not enough.

They started to see the correct timezone in time.log only after running ddev exec "sudo dpkg-reconfigure tzdata", but this is not a solution.

Error when installing cron

I am getting the following error when restarting:

failed to solve: process "/bin/sh -c apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests cron" did not complete successfully: exit code: 100
Failed to restart workproject: docker-compose build failed: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-sharefile docker-compose -f /Users/Edwina/Desktop/Work/workproject/.ddev/.ddev-docker-compose-full.yaml --progress=quiet build', action='[--progress=quiet build]', err='exit status 17', stdout='', stderr='failed to solve: process "/bin/sh -c apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests cron" did not complete successfully: exit code: 100', output='', stderr='failed to solve: process "/bin/sh -c apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests cron" did not complete successfully: exit code: 100'

Cannot start project when cron files are defined

I constantly get:

stderr='failed to solve: executor failed running [/bin/sh -c { cat /etc/cron.d/*.cron; } | crontab -u ${username} -]: exit code: 1'

When I delete my cron files, the project runs.

I copied the examples from the README.

Head tests failing: `ERROR: "/cron.conf" not found` during build

Before the move to ddev domain, the scheduled tests were failing.

...
# failed to solve: failed to compute cache key: "/cron.conf" not found: not found
# Failed to restart ddev-cron: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-ddev-cron docker-compose -f /home/runner/tmp/ddev-cron/.ddev/.ddev-docker-compose-full.yaml up --build -d', action='[up --build -d]', err='exit status 17', stdout='#1 [drud/ddev-dbserver-mariadb-10.4:v1.21.4-ddev-cron-built internal] load build definition from Dockerfile
...

a4f86f1 was an attempt to fix it, however, tests still fail.

Unable to replicate issue locally; all tests pass

Test

bats ./tests/test.bats     
test.bats
 ✓ install from directory
   ddev started at Wed Feb  8 08:49:56 JST 2023
   ddev get /home/user13/code/pr/ddev-cron/tests/.. with project ddev-cron in /home/user13/tmp/ddev-cron (/home/user13/tmp/ddev-cron)
 ✓ install from release
   ddev started at Wed Feb  8 08:51:40 JST 2023
   ddev get drud/ddev-cron with project ddev-cron in /home/user13/tmp/ddev-cron (/home/user13/tmp/ddev-cron)

2 tests, 0 failures

Drush doesn't seem to work

I just installed ddev-cron

The example with time.cron works perfectly and I get the time.log file with the logs.

But when I try the Drupal example, it doesn't work.

However, when I connect with ddev ssh and test the command, everything works correctly.

I'm on macOS:
DDEV version: v1.22.3
Docker: 24.0.5, build ced0996

Do you have an idea of ​​the problem ?

Rename plugin to "cron"

In the "2023-10-31 Amplitude Analytics" training session, @rfay showed a chart of addon installations.
The display showed:

  • phpmyadmin
  • redis
  • adminer
  • ddev-cron

Ideally, the name should be "cron" which appears to be set in install.yaml.

It would probably affect the statistic present, right?

Changing the name locally, creates a new "cron" directory in ./ddev/addon-metadata which results in 2 addons laying claim to the same project files. Would we need to add ddev get --remove ddev-cron &> null to the installation process to remove the "old" version?

Would it be beneficial to change?

Injecting web environment variables in crontab config at startup

Hi Tyler,

Thank you very much for the great work on this ddev addon, it works very well!

Just a quick comment to let you know I was able to inject all the web environment variables in the crontab config, based on the work, comments and advice in the following post:
ddev/ddev#1715 (comment)

With the following one-liner and it seems to work fine so far:
Add the following code to the .ddev/config.yaml file:

hooks:
  post-start:
  # Prepend web environment variables to crontab configuration to be exposed for
  # drush commands. Replace empty variables with empty string ('') with sed.
  - exec: (env | sed -z "s/=\n/=''\n/g;s/,$/\n/" ; crontab -l)| crontab -

Basically, this allows running commands with cron with all the web environment already defined, so without the need to specify certain variables values for certain commands, for example:

*/10 * * * * IS_DDEV_PROJECT=true DDEV_PHP_VERSION=8.1 /var/www/html/vendor/bin/drush cron | tee -a /var/www/html/cron-log.txt

With the environment variables, it becomes:

*/10 * * * * drush cron | tee -a /var/www/html/cron-log.txt

I just wanted this to be documented here and potentially let others know.
Perhaps a small paragraph could be added to the documentation/project's front page?

I would greatly appreciate your feedback and reviews on this approach and if you have any comments, suggestions or advice on perhaps a more suitable approach or method.

Feel free to let me know if you have any questions or concerns on any aspects of this ticket, I would surely be glad to help.
Thanks in advance!

WordPress cron example

It would be interesting to have an example of how to configure WordPress cron with DDEV-CRON :)

Any easy way to stop / start cron?

During development it would be very nice to be able to enable and disable cron without removing the whole plugin or removing a config file and restarting DDEV.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.