Add cron to official Docker image

Review Request #11669 — Created June 21, 2021 and submitted

Information

Review Board
master

Reviewers

Add cron to official Docker image

So long as the crontab is being generated, use it for a nice out-of-box experience with Docker and search.

Created fresh test instance docker-compose with equivalent changes to this review request.

With the modified docker-entrypoint.sh in the same dir:

Dockerfile

FROM beanbag/reviewboard:4.0.2
RUN apt-get update && apt-get install -y cron
ADD docker-entrypoint.sh /

docker-compose.yml based on docker-compose.mysql.yaml

...
  reviewboard:
    build: .
    environment:
      - REVIEWBOARD_CRONTAB=/site/conf/cron.conf
...

Start instance, and create search index with docker-compose exec reviewboard /bin/bash -c 'gosu reviewboard rb-site manage /site rebuild_index'
Wait until the next cron run, and check the modified times in the search index e.g. docker-compose exec reviewboard /bin/bash -c 'ls -al /site/data/search-index/'

Summary ID
Add cron to official Docker image
b5975a346114ffaa0e3cda72a4aa5a3fc306b18e
Description From Last Updated

Upon further reflection, I think this needs to be optional on launch. The reason is that, if you have, say, …

chipx86chipx86
chipx86
  1. Thanks! This looks good. I'll test it out and we'll get it into the next release.

  2. 
      
chipx86
  1. 
      
  2. Upon further reflection, I think this needs to be optional on launch.

    The reason is that, if you have, say, 5 Review Board Docker instances for a server running simultaneously, you're going to end up with 5 instances trying to clear sessions at the same time, 5 instances trying to update indexes at the same time, and that's going at best be a waste of effort and at worst lead to problems.

    Being able to control whether a particular instance is performing cron-related tasks would avoid these issues.

    The cron.conf we provide on site installation is also merely an example, which can be overridden. We probably should have a way for users to do this. That's not a blocker for getting the change in, but making cron functionality optional is.

    Let me know if you're up for doing that. Otherwise, we'll take it on (though I don't have an ETA right now).

  3. 
      
RY
chipx86
  1. Ship It!
  2. 
      
RY
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (84e8985)
Loading...