Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions elabctl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# where do we store the MySQL database and the uploaded files?
#declare DATA_DIR='/var/elabftw'

# optional, set a different path for uploaded files
# default is DATA_DIR/web
#declare UPLOAD_DIR=/path/to/uploaded_files

# name of the web container (default: elabftw)
#declare ELAB_WEB_CONTAINER_NAME='elabftw'

Expand Down Expand Up @@ -46,3 +50,4 @@ declare BORG_KEEP_MONTHLY=6

# optional, only set if required (rsync.net)
#declare BORG_REMOTE_PATH=borg1

16 changes: 10 additions & 6 deletions elabctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ declare DUMP_DELETE_DAYS=+0
declare CONF_FILE='/etc/elabftw.yml'
# default data directory
declare DATA_DIR='/var/elabftw'
# allow override default web subfolder in data dir
declare UPLOAD_DIR="${DATA_DIR}/web"

# default conf file is no conf file
declare ELABCTL_CONF_FILE="using default values (no config file found)"
Expand Down Expand Up @@ -58,7 +60,7 @@ function borg-backup
export BORG_REMOTE_PATH="${BORG_REMOTE_PATH}"
fi
# we add to the borg the uploaded files (web directory) and also the backup dir containing dumps of MySQL
"${BORG_PATH}" create "::$(hostname)-$(date +%F_%H-%M)" "${DATA_DIR}/web" "${BACKUP_DIR}"
"${BORG_PATH}" create "::$(hostname)-$(date +%F_%H-%M)" "${UPLOAD_DIR}" "${BACKUP_DIR}"
"${BORG_PATH}" prune --keep-daily="${BORG_KEEP_DAILY:-14}" --keep-monthly="${BORG_KEEP_MONTHLY:-6}"
}

Expand Down Expand Up @@ -179,6 +181,7 @@ function info
{
echo "Backup directory: ${BACKUP_DIR}"
echo "Data directory: ${DATA_DIR}"
echo "Upload directory: ${UPLOAD_DIR}"
echo "Web container name: ${ELAB_WEB_CONTAINER_NAME}"
echo "MySQL container name: ${ELAB_MYSQL_CONTAINER_NAME}"
echo ""
Expand Down Expand Up @@ -228,7 +231,8 @@ function install

dialog --colors --backtitle "$backtitle" --title "$title" --yes-label "Looks good to me" --no-label "Download example conf and quit" --yesno "\nHere is what will happen:\n
The main configuration file will be created at: \Z4${CONF_FILE}\Zn\n
A directory holding elabftw data (mysql + uploaded files) will be created at: \Z4${DATA_DIR}\Zn\n
A directory holding elabftw MySQL data will be created at: \Z4${DATA_DIR}/mysql\Zn\n
A directory holding elabftw uploaded files will be created at: \Z4${UPLOAD_DIR}\Zn\n
The backups will be created at: \Z4${BACKUP_DIR}\Zn\n\n
If you wish to change these settings, quit now and edit the file \Z4elabctl.conf\Zn" 0 0
if [ $? -eq 1 ]; then
Expand Down Expand Up @@ -302,12 +306,12 @@ function install
set -e

echo 40 | dialog --backtitle "$backtitle" --title "$title" --gauge "Creating folder structure. You will be asked for your password (bottom left of the screen)." 20 80
sudo mkdir -pv ${DATA_DIR}/{web,mysql}
sudo chmod -Rv 700 ${DATA_DIR}
sudo mkdir -pv ${DATA_DIR}/mysql ${UPLOAD_DIR}
sudo chmod -Rv 700 ${DATA_DIR} ${UPLOAD_DIR}
echo "Executing: sudo chown -v 999:999 ${DATA_DIR}/mysql"
sudo chown -v 999:999 ${DATA_DIR}/mysql
echo "Executing: sudo chown -v 101:101 ${DATA_DIR}/web"
sudo chown -v 101:101 ${DATA_DIR}/web
echo "Executing: sudo chown -v 101:101 ${UPLOAD_DIR}"
sudo chown -v 101:101 ${UPLOAD_DIR}
sleep 2

echo 50 | dialog --backtitle "$backtitle" --title "$title" --gauge "Grabbing the docker-compose configuration file" 20 80
Expand Down