Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blackandred committed Nov 28, 2020
1 parent a1ccf7f commit 1337739
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .infrastructure/arm.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ RUN [ "cross-build-end" ]
ADD . /infracheck
ADD .git /infracheck/

ENV CHECK_INTERVAL="*/1 * * * *" \
WAIT_TIME=0\
LAZY=false
ENV REFRESH_TIME="120" \
WAIT_TIME="0" \
CHECK_TIMEOUT="10"

RUN [ "cross-build-start" ]
RUN cd /infracheck \
Expand Down
6 changes: 3 additions & 3 deletions .infrastructure/x86_64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ ADD . /infracheck
ADD .git /infracheck/
ADD .infrastructure /infracheck/

ENV CHECK_INTERVAL="*/1 * * * *" \
WAIT_TIME=0\
LAZY=false
ENV REFRESH_TIME="120" \
WAIT_TIME="0" \
CHECK_TIMEOUT="10"

RUN cd /infracheck \
# install as a package
Expand Down
32 changes: 11 additions & 21 deletions docs/source/cache.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
Cache and freshness
===================

It can be harmful to the server to run all checks on each HTTP endpoint call, so a cronjob in background is writing results, and HTTP endpoint is reading.
It can be harmful to the server to run all checks on each HTTP endpoint call, so the application is running them periodically every X seconds specified by **--refresh-time** switch or **REFRESH_TIME** environment variable (in docker)

How often really the checks are performing depends on your configuration, how often you execute **infracheck --force**
Refresh time
------------

--force
-------
If you use an official docker image, then you can set an environment variable.

The *--force* parameter means that the application will write checks results to a cache.
Example: check once a day (good for domains whois check).

When this flag is not specified, then application will read the data from the cache.
.. code:: bash
Docker
------
REFRESH_TIME=86400
If you use an official docker image, then you can set CHECK_INTERVAL to a crontab-like syntax interval eg. **CHECK_INTERVAL=00 23 * * *** to check once a day (good for domains whois check).
From CLI you can set **--refresh-time=86400**

Limits
------
Wait time
---------

Some checks could call external APIs, those can have limits. A good example is a *domain-expiration* check which is using whois.
It is recommended to run a separate infracheck instance with less frequent checking, eg. once a day - see CHECK_INTERVAL in docker, and crontab in standalone installation.

You can also use `--wait` switch to set waiting in seconds between single checks (in docker it is `WAIT_TIME` variable)

--lazy
------

When running a ex. HTTP endpoint without `--force`, then application is only reading results of previously executed checks that are usually executed in background using cron.
**Without lazy** the checks that were not executed yet will be showing "Not ready yet" and a **status equals to false**.
If you really need to avoid such case, **then you can allow running a check on-demand by enabling** `--lazy` **flag** (LAZY=true in docker).
Set **--wait=60** to for example wait 60 seconds before each check - where check is a single entry on the list of checks.
2 changes: 1 addition & 1 deletion infracheck/checks/domain-expiration
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Check if the domain is close to expiration date or if it is already expired.
**Notice: Multiple usage of this check can cause a "request limit exceeded" error to happen**
*Suggestion: If you check multiple domains, then separate domains checking from regular health checks and set CHECK_INTERVAL (docker) to once a day, and WAIT_TIME=300 for non-docker installations - in crontab set a check with --force once a day*
*Suggestion: If you check multiple domains, then separate domains checking from regular health checks and set REFRESH_TIME (docker) to once a day, and WAIT_TIME=300 for non-docker installations - in crontab set a check with --force once a day*
Parameters:
Expand Down

0 comments on commit 1337739

Please sign in to comment.