Comments (6)
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.
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.
@Athoir Any idea to add the restore operation on container starting point?
from docker-openldap-backup.
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.
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.
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)
- Image interest HOT 1
- Secure LDAP Replication
- Data backup file is empty
- How to retrieve the users data out of unzipped config file ? HOT 1
- docker container stucks in `restarting` HOT 1
- When using this image and importing ENV for TTL and CRON it puts and "=" at the end thus setting the ENV improperly
- only the two root nodes of the ldap database gets dumped HOT 2
- Can't make backup work HOT 2
- Error restoring config HOT 1
- outdated documentation? HOT 2
- Question about intended usage of this image.
- backup doesn't work HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-openldap-backup.