Skip to content

Commit

Permalink
feat: get latest available backup at start
Browse files Browse the repository at this point in the history
  • Loading branch information
pifou25 committed Apr 1, 2024
1 parent 1af61ce commit e60d741
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
[![Docker Multiplatform Build ci](https://github.com/pifou25/docker-jeedom/actions/workflows/buildx-platform.yml/badge.svg)](https://github.com/pifou25/docker-jeedom/actions/workflows/buildx-platform.yml)
![Docker Pulls](https://img.shields.io/docker/pulls/pifou25/jeedom)
![GitHub forks](https://img.shields.io/github/forks/pifou25/docker-jeedom)

[![Try in PWD](https://img.shields.io/badge/PWD-Play%20With%20Docker-blue?logo=docker)](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/pifou25/docker-jeedom/master/docker-compose.yml) Try in "Play-With-Docker" require a Docker account.
[![Try in PWD](https://img.shields.io/badge/try-it_now!-blue?logo=docker&color=lemon)](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/pifou25/docker-jeedom/master/docker-compose.yml)

# Jeedom - *Innovative Home Automation*
<p align="center">
Expand Down Expand Up @@ -33,8 +32,9 @@ complete installation.

### Meaning of any keywords

* `Full`
* `Light`
* `Full` = standalone
* `Light` = without extra daemon
* bullseye, buster, or bookworm is the Debian base version. The current default is `bullseye`
* Jeedom Version `stable` (current = v4.3 = latest) or `beta` (future v4.4), see jeedom Git branches.
* `debug` when the image also contains XDebug packages for PHP debug

Expand All @@ -61,9 +61,15 @@ You can run the standalone `latest` container as-it :
```
docker run --name jeedom -d -v "$PWD/jeedom/":/var/www/html pifou25/jeedom
```

( --name = the container name, -d = detached mode, -v = mount the volume source:destination)

## run a new container with an existing backup

The init sequence may track and restore a previous Jeedom backup:
```
docker run --name jeedom -d -v "$PWD/backup":/var/www/html/backup pifou25/jeedom
```

## Docker Compose for Debug and specific services

The `docker-compose.yml` is an example to run several services (mariaDB, scheduler, ...) and the `light`
Expand Down
5 changes: 4 additions & 1 deletion build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ After cloning the git repository, one may build the desired Docker image using t
cd build
docker build --target full_xdebug --build-arg JEEDOM_VERSION=V4-stable --tag jeedom:debug .
```
* Available targets are: light_jeedom, light_xdebug, full_jeedom, full_xdebug
* Available targets are: light_jeedom, full_jeedom
* $DEBIAN is buster, bullseye or bookworm
* for bookworm: add $PHP with minimal version 8. $PHP=7.3 is the default value for previous Debian versions
* $XDEBUG = true / false
* $JEEDOM_VERSION is beta or V4-stable (default) (or master for the unsupported Jeedom v3)

## Github Workflow
Expand Down
9 changes: 5 additions & 4 deletions build/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ if [ ! -f "${WEBSERVER_HOME}/core/config/common.config.php" ]; then
exit 1
fi

if [ -d "/tmp/backup" ] && [ "$(ls -A /tmp/backup)" ]; then
log_info "found a backup, try to restore..."
cp /tmp/backup/* ${WEBSERVER_HOME}/backup
php ${WEBSERVER_HOME}/install/restore.php
# find latest backup and try to restore at the first container launch
if [ -d "${WEBSERVER_HOME}/backup" ] && [ "$(ls -A ${WEBSERVER_HOME}/backup)" ]; then
filename=$(ls -Art ${WEBSERVER_HOME}/backup)
log_info "found a backup, try to restore: ${filename}"
php ${WEBSERVER_HOME}/install/restore.php backup=${filename}
fi
log_info " ___ successfull new installation ! ___"
fi
Expand Down
9 changes: 5 additions & 4 deletions build/standalone/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ if [ ! -f "${WEBSERVER_HOME}/core/config/common.config.php" ]; then
log_warn "vérification de jeedom"
php ${WEBSERVER_HOME}/sick.php

if [ -d "/tmp/backup" ] && [ "$(ls -A /tmp/backup)" ]; then
log_info "found a backup, try to restore..."
cp /tmp/backup/* ${WEBSERVER_HOME}/backup
php ${WEBSERVER_HOME}/install/restore.php
# find latest backup and try to restore at the first container launch
if [ -d "${WEBSERVER_HOME}/backup" ] && [ "$(ls -A ${WEBSERVER_HOME}/backup)" ]; then
filename=$(ls -Art ${WEBSERVER_HOME}/backup)
log_info "found a backup, try to restore: ${filename}"
php ${WEBSERVER_HOME}/install/restore.php backup=${filename}
fi
log_info " ___ successfull new installation ! ___"

Expand Down

0 comments on commit e60d741

Please sign in to comment.