Add cron to official Docker image
Review Request #11669 — Created June 21, 2021 and submitted
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 ondocker-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 |
---|---|
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, … |
chipx86 |
-
-
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).
- Change Summary:
-
Use environment var to specify crontab, making this feature optional and configurable.
- Testing Done:
-
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 ondocker-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/'
- Commits:
-
Summary ID 2881eeab30b1e3c8ab4fc5ff435941cf1aa8c107 b5975a346114ffaa0e3cda72a4aa5a3fc306b18e