Coder Social home page Coder Social logo

Comments (6)

kumy avatar kumy commented on June 15, 2024 11

Here is how I do:

$ docker exec -it openldap bash
# sv stop /container/run/process/slapd
# rm -r /etc/ldap/slapd.d/*
# slapd-restore-config 20190502T082301-config
# sv stop /container/run/process/slapd
# rm /var/lib/ldap/* 
# slapd-restore-data 20190502T080901-data

from docker-openldap-backup.

Athoir avatar Athoir commented on June 15, 2024 3

After some research i found that there is a script called "slapd-restore-data" in the /sbin directory of the image. To restore your data you have to run this script with the file you want to restore as an argument.

Example:
> /sbin/slapd-restore-data 20171101T040001-data.gz
for a backup done the 11/01/17 at 4am

from docker-openldap-backup.

abdulwahid24 avatar abdulwahid24 commented on June 15, 2024 1

@Athoir Any idea to add the restore operation on container starting point?

from docker-openldap-backup.

Athoir avatar Athoir commented on June 15, 2024

I haven't worked on this one for a while but adding an CMD command similar to /sbin/slapd-restore-data /path/to/backup/RegexToLatest-data.gz should work.

You will have to test a few things:

  • does it interfere with the normal start of the container (potential conflict with the entrypoint)
  • What to do if there is no backup
  • How much does it delay the start of the container (important if you need availability)
  • probably more I have overlooked

Another option would be to take a look at the /container/tool/run script Osixia use to launch their stuff.

from docker-openldap-backup.

mdzddl avatar mdzddl commented on June 15, 2024

i am so careless
PAYING ATTENTION: osixia/openldap-backup is docker which can be openldap and openlap-backup function; osixia/openldap can only be openldap
below is my docker-compose,it work well

docker-compose

version: '2'
services:
    phpldapadmin:
      : osixia/phpldapadmin
      environment:
        PHPLDAPADMIN_LDAP_HOSTS: openldap
        PHPLDAPADMIN_HTTPS: "false"
      links:
        - openldap
      ports:
        - 8080:80
      restart: always
    openldap:
      : osixia/openldap-backup:1.3.0
      environment:
        LDAP_BACKUP_CONFIG_CRON_EXP: "*/5 * * * *"
        LDAP_BACKUP_DATA_CRON_EXP: "*/5 * * * *"
        LDAP_ORGANISATION: "socket"
        LDAP_DOMAIN: socket.com
        LDAP_ADMIN_PASSWORD: passwd
      volumes:
        - ./data/backup:/data/backup
        - ./data/slapd/database:/var/lib/ldap
        - ./data/slapd/config:/etc/ldap/slapd.d
      restart: always
      ports:
        - 389:389
        - 689:689

when you want to restore data,please do below, this method from @kumy

do in docker-openldap-backup docker

$ docker exec -it docker-openldap-backup bash
#sv stop /container/run/process/slapd
#rm -r /etc/ldap/slapd.d/*
#slapd-restore-config 20190502T082301-config
#sv stop /container/run/process/slapd
#rm /var/lib/ldap/*
#slapd-restore-data 20190502T080901-data

from docker-openldap-backup.

gustavomcarmo avatar gustavomcarmo commented on June 15, 2024

Thanks to @Athoir's comment I finally managed to restore a backup file on startup by extending the image like the following:

FROM osixia/openldap-backup:1.4.0

COPY custom-backup.sh /container/service/slapd-backup/assets/tool/slapd-backup
COPY custom-restore.sh .

CMD ["-c", "./custom-restore.sh", "process"]

from docker-openldap-backup.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.