osixia / docker-openldap-backup

A docker image to run OpenLDAP, and make periodic backups 🐳
MIT License
98 stars 43 forks source link

backup doesn't work #9

Open crcjwice123 opened 5 years ago

crcjwice123 commented 5 years ago

Since osixia/openldap-backup:1.2.3 is having some startup issue, I used 1.2.2 instead.

Here is my docker-compose.yaml. The two service works fine but ldap backup doesn't work. No matter what cron expression I used, the backup folder is always empty.

version: '2'

services: openldap: image: osixia/openldap-backup:1.2.2 command: --loglevel debug ports:

networks: test: external: true

MiGoller commented 5 years ago

That's exactly my issue, too.

BertrandGouny commented 5 years ago

Don't have this problem with my containers :s is this still an issue with v1.2.4 ?

vidarkongsli commented 5 years ago

I have the same problem with 1.2.5:

docker run --env LDAP_ORGANISATION="local.dev" `
    --env LDAP_DOMAIN="somecompany.com" `
    --env LDAP_ADMIN_PASSWORD="JonSn0w" `
    --env LDAP_BACKUP_CONFIG_CRON_EXP="0/5 * * * *" `
    --env LDAP_BACKUP_DATA_CRON_EXP="2/5 * * * *" `
    -p 389:389 `
    --volume $PSScriptRoot/database:/var/lib/ldap `
    --volume $PSScriptRoot/config:/etc/ldap/slapd.d `
    --volume $PSScriptRoot/backup:/data/backup `
    osixia/openldap-backup:1.2.5

No backup files are written.

mbasri commented 4 years ago

I have the same problem with 1.2.5:

docker run --env LDAP_ORGANISATION="local.dev" `
    --env LDAP_DOMAIN="somecompany.com" `
    --env LDAP_ADMIN_PASSWORD="JonSn0w" `
    --env LDAP_BACKUP_CONFIG_CRON_EXP="0/5 * * * *" `
    --env LDAP_BACKUP_DATA_CRON_EXP="2/5 * * * *" `
    -p 389:389 `
    --volume $PSScriptRoot/database:/var/lib/ldap `
    --volume $PSScriptRoot/config:/etc/ldap/slapd.d `
    --volume $PSScriptRoot/backup:/data/backup `
    osixia/openldap-backup:1.2.5

No backup files are written.

Hi, you have an issue with your cron expresion

--env LDAP_BACKUP_CONFIG_CRON_EXP="0/5 "
--env LDAP_BACKUP_DATA_CRON_EXP="2/5 "

you have to replace 0/5 & 2/5 with */5

--env LDAP_BACKUP_CONFIG_CRON_EXP="/5 " --env LDAP_BACKUP_DATA_CRON_EXP="/5 "

You can validate a cron expresion via https://crontab.guru/

micter59 commented 3 years ago

Hello, i'm using the 1.3.0 version, but the backup does not seem to be operating. I've put the env var like this : --env LDAP_BACKUP_CONFIG_CRON_EXP=" *"

It's just to see if it will run, but the backup directory stay empty. If i inspect the container, there's nothing in the crontab.

Does someone know which command is used to backup the openldap ? Maybe we can make a derivative image and put the command again inside ?

Michaël

kevdogg commented 3 years ago

Hi I'm using 1.40 and I cant get the backups to work either -- the will run manually if invoked from the shell.

I see the cronjobs listed within /container/run/service/slapd-backup/assets listed as such:

# Backup OpenLDAP config
"0 */4 * * *" root /sbin/slapd-backup-config 2>&1 | /usr/bin/logger -t cron_backup_config

# Backup OpenLDAP data
"0 */4 * * *" root /sbin/slapd-backup-data 2>&1 | /usr/bin/logger -t cron_backup_data
# empty line

I can run both commands manually -- /sbin/slapd-backup-data and /sbin/slapd-backup-config and see the .gz files being created. Other than running manually I do the jobs being run through cron. Nothing shows in the logs.

I see the symbolic link located within /etc/cron.d/slapd-backup -> /container/run/services/slapd-backup/assets/cronjobs.

Is my expression in correct?

/var/log/cron only shows the following:

Dec 19 17:17:01 openldap CRON[374]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 19 18:17:01 openldap CRON[379]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 19 19:17:01 openldap CRON[385]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 19 20:17:01 openldap CRON[390]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

I realized a problem with my syntax: I had this in my docker compose:

      - LDAP_BACKUP_CONFIG_CRON_EXP="0 */4 * * *"
      - LDAP_BACKUP_DATA_CRON_EXP="0 */4 * * *"

It should be this (no quotes):

      - LDAP_BACKUP_CONFIG_CRON_EXP=0 */4 * * *
      - LDAP_BACKUP_DATA_CRON_EXP=0 */4 * * *
esmaeelE commented 4 months ago

This issue is still persists in latest image