Skip to content

Commit

Permalink
Cronjob image with configurable cron expression
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-athome committed Aug 27, 2023
1 parent 5490b49 commit b17d2fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Configuration is provided via environment variables (`.env` file is supported).
| IMMICH_CARDDAV_CARDDAV_PASSWORD | Password of CardDAV server |
| IMMICH_CARDDAV_IMMICH_API_URL | Immich instance API URL (including "/api") |
| IMMICH_CARDDAV_IMMICH_API_KEY | Immich API key |
| IMMICH_CARDDAV_CRON_EXPRESSION | Cron expression (only for daemon image) |

Environment variable LOG_LEVEL will configure the logging level (standard Python logging levels: DEBUG, INFO, WARNING,
ERROR, CRITICAL).
Expand Down Expand Up @@ -48,9 +49,30 @@ docker run --rm --name immich-carddav-sync --env-file=immich-carddav-sync.env gh
The `immich-carddav-sync.env` file should contain all the necessary environment variables (see above). If you prefer you
can add those variables to the Immich `.env` file itself and reference that one.

## Integrate in Immich (docker compose)

Configure the variables described above in your `.env` file and add a service to your `docker-compose.yml` file using
the daemon image:

```yaml
services:
[...]

carddav-sync:
container_name: immich_carddav_sync
image: ghcr.io/daniele-athome/immich-carddav-sync-daemon:latest
env_file:
- .env
restart: always
depends_on:
- immich-server

[...]
```

## Roadmap

* docker-compose.yml tutorial based on the one provided by the Immich project (Docker image with cronjob inside)
* use s6-overlay instead of simple Debian cron (mainly because of vixie-cron not reacting to signals)
* support for duplicate contacts (ask interactively or assume a predefined behavior)
* match names with a custom (or multiple) vCard field(s)
* dry run mode
1 change: 1 addition & 0 deletions cronjob/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

env >> /etc/environment

export CRON_EXPRESSION=${IMMICH_CARDDAV_CRON_EXPRESSION}
envsubst < /app/crontab.tmpl >/etc/cron.d/immich-carddav-sync

exec cron -f

0 comments on commit b17d2fa

Please sign in to comment.