Fix markdown lint issues and incorrect image name

This commit is contained in:
Robert Dailey 2019-05-25 12:23:35 -05:00
parent 26bf5c5f82
commit 0bfd68a109
2 changed files with 26 additions and 10 deletions

9
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,9 @@
{
"markdownlint.config": {
"no-inline-html": {
"allowed_elements": [
"br"
]
}
}
}

View file

@ -1,4 +1,6 @@
# Summary # Nextcloud Cron Job Docker Container
## Summary
This container is designed to run along side your Nextcloud container to execute its This container is designed to run along side your Nextcloud container to execute its
`/var/www/html/cron.php` at a regular interval. There is an "official" way of doing this, however it `/var/www/html/cron.php` at a regular interval. There is an "official" way of doing this, however it
@ -6,7 +8,7 @@ doesn't work when you run your Nextcloud container using a non-root user. I also
that this solution is easier to manage, since it doesn't require the same environment as Nextcloud that this solution is easier to manage, since it doesn't require the same environment as Nextcloud
itself (i.e. no network requirements, no database requirements, etc). itself (i.e. no network requirements, no database requirements, etc).
# Setup Instructions ## Setup Instructions
Since Nextcloud's entire setup can get rather complex with Docker, I highly recommend you set up Since Nextcloud's entire setup can get rather complex with Docker, I highly recommend you set up
everything using [Docker Compose](https://docs.docker.com/compose/). everything using [Docker Compose](https://docs.docker.com/compose/).
@ -23,7 +25,7 @@ services:
image: nextcloud:apache image: nextcloud:apache
cron: cron:
image: voidpointer/nextcloud-cronjob image: rcdailey/nextcloud-cronjob
restart: always restart: always
network_mode: none network_mode: none
depends_on: depends_on:
@ -44,11 +46,12 @@ help identify the right container to execute the command in.
Note that if you don't use Docker Compose, you can leave `NEXTCLOUD_PROJECT_NAME` blank or omitted Note that if you don't use Docker Compose, you can leave `NEXTCLOUD_PROJECT_NAME` blank or omitted
entirely. entirely.
# Environment Variables ## Environment Variables
* `NEXTCLOUD_CONTAINER_NAME`<br> * `NEXTCLOUD_CONTAINER_NAME`<br>
Required. This is the name of the running Nextcloud container (or Required. This is the name of the running Nextcloud container (or
the service, if `NEXTCLOUD_PROJECT_NAME` is specified). the service, if `NEXTCLOUD_PROJECT_NAME` is specified).
* `NEXTCLOUD_PROJECT_NAME`<br> * `NEXTCLOUD_PROJECT_NAME`<br>
The name of the project if you're using Docker Compose. The name of The name of the project if you're using Docker Compose. The name of
the project, by default, is the name of the context directory you ran your `docker-compose.yml` the project, by default, is the name of the context directory you ran your `docker-compose.yml`
@ -56,9 +59,11 @@ entirely.
built as: built as:
${NEXTCLOUD_PROJECT_NAME}_${NEXTCLOUD_CONTAINER_NAME} ${NEXTCLOUD_PROJECT_NAME}_${NEXTCLOUD_CONTAINER_NAME}
* `NEXTCLOUD_CRON_MINUTE_INTERVAL`<br> * `NEXTCLOUD_CRON_MINUTE_INTERVAL`<br>
The interval, in minutes, of how often the cron task The interval, in minutes, of how often the cron task
executes. The default is 15 minutes. executes. The default is 15 minutes.
* `NEXTCLOUD_EXEC_USER`<br> * `NEXTCLOUD_EXEC_USER`<br>
The user that should be used to run the cron tasks inside the Nextcloud container. This parameter The user that should be used to run the cron tasks inside the Nextcloud container. This parameter
is specified to the `docker exec` command from this container. By default, the user used is is specified to the `docker exec` command from this container. By default, the user used is
@ -67,7 +72,7 @@ entirely.
in the tasks being executed using the Nextcloud container's running user. Specifically, the in the tasks being executed using the Nextcloud container's running user. Specifically, the
`--user` option will *not* be provided to the `docker exec` command. `--user` option will *not* be provided to the `docker exec` command.
# Container Health ## Container Health
If you do `docker-compose ps`, you will see the active health of the container. The following logic If you do `docker-compose ps`, you will see the active health of the container. The following logic
is checked every interval of the health check. If any of these checks fail, it is likely the is checked every interval of the health check. If any of these checks fail, it is likely the
@ -79,7 +84,7 @@ container's health status will become *unhealthy*. In this case, you should rest
container's ID. If for whatever reason the Nextcloud container changes in such a way that the ID container's ID. If for whatever reason the Nextcloud container changes in such a way that the ID
is no longer valid, the health check would fail. is no longer valid, the health check would fail.
# Customizing Cron Tasks ## Customizing Cron Tasks
This container provides the ability for you to run additional tasks inside the Nextcloud container This container provides the ability for you to run additional tasks inside the Nextcloud container
in addition to the default `cron.php` task. To add your custom tasks, follow these steps: in addition to the default `cron.php` task. To add your custom tasks, follow these steps:
@ -93,33 +98,35 @@ in addition to the default `cron.php` task. To add your custom tasks, follow the
#!/usr/bin/env bash #!/usr/bin/env bash
php -f /var/www/html/cron.php php -f /var/www/html/cron.php
``` ```
1. Mount this shell script inside the `/cron-scripts` directory. Here's an example if you're using 1. Mount this shell script inside the `/cron-scripts` directory. Here's an example if you're using
`docker-compose.yml`: `docker-compose.yml`:
```yml ```yml
services: services:
cron: cron:
image: voidpointer/nextcloud-cronjob image: rcdailey/nextcloud-cronjob
volumes: volumes:
- ./my-scripts/do-something.sh:/cron-scripts/do-something.sh:ro - ./my-scripts/do-something.sh:/cron-scripts/do-something.sh:ro
``` ```
1. Recreate the container. Your script will now execute in the Nextcloud container at a regular 1. Recreate the container. Your script will now execute in the Nextcloud container at a regular
interval. interval.
## Notes ### Notes
* All cron task shell scripts run at the same interval defined by `NEXTCLOUD_CRON_MINUTE_INTERVAL`. * All cron task shell scripts run at the same interval defined by `NEXTCLOUD_CRON_MINUTE_INTERVAL`.
* Modification of your own shell scripts on the host do not require that you restart/recreate the * Modification of your own shell scripts on the host do not require that you restart/recreate the
container. container.
# Debugging ## Debugging
All logs from `crond` are configured to print to stdout, so you can monitor container logs (via All logs from `crond` are configured to print to stdout, so you can monitor container logs (via
`docker-compose logs -f`). This should allow you to make sure your cron job is working. You can also `docker-compose logs -f`). This should allow you to make sure your cron job is working. You can also
use the "Overview" page in Nextcloud Settings to see if the cron job is being run regularly. Here is use the "Overview" page in Nextcloud Settings to see if the cron job is being run regularly. Here is
an example of the logs you will see: an example of the logs you will see:
``` ```txt
Started crond Started crond
------------------------------------------------------------- -------------------------------------------------------------
Executing Cron Tasks: Thu Dec 6 17:28:00 CST 2018 Executing Cron Tasks: Thu Dec 6 17:28:00 CST 2018