I am having difficulties with file volume/mount/bind points and I simply cannot figure it out. I am using JipHop's great invention to run a docker compose jail with portainer. I have done this to run a full install of BAREOS for backing up active web server(s).
I didn't have this problem using the True-Chart docker-compose method, but they did something to break it, so here I am.
I am trying to get the BAREOS jail to write to my root datasets for config, data, pgsql and finally the actual storage. These datsets are laid out under my tank01 dataset.
I have added the --bind settings to those datasets and my path to them in the BAREOS yml file point to those datasets.
Here is where the trouble is. Despite everything I can think to do or change, the docker compose jail wants to refer to its own root as the root of the dataset, so it writes everything inside of the jail (creating the folders and such..) I can't for the life of me figure out how to point its targets to the root /mnt point on my ROOT/ up one level in the tank01 dataset.
Code:
## docker-compose Bareos Director/Storage/Client/webUI and PostgreSQL Database based on Ubuntu
version: '3'
services:
bareos-dir:
image: barcus/bareos-director:21-ubuntu-pgsql
volumes:
- /mnt/tank01/bareos/config/director:/etc/bareos
- /mnt/tank01/bareos/data/director:/var/lib/bareos # required for MyCatalog backup
environment:
- DB_INIT=true #should be 'true' if bareos db does not exist
- DB_UPDATE=false
- DB_HOST=bareos-db
- DB_PORT=5432
- DB_NAME=bareos
- DB_USER=bareos
- DB_PASSWORD=${DB_PASSWORD} # defined in .env file
- DB_ADMIN_USER=${DB_ADMIN_USER} # defined in .env file
- DB_ADMIN_PASSWORD=${DB_ADMIN_PASSWORD} # defined in .env file
- BAREOS_SD_HOST=bareos-sd
- BAREOS_SD_PASSWORD=${BAREOS_SD_PASSWORD} # defined in .env file
- BAREOS_FD_HOST=bareos-fd
- BAREOS_FD_PASSWORD=${BAREOS_FD_PASSWORD} # defined in .env file
- BAREOS_WEBUI_PASSWORD=${BAREOS_WEBUI_PASSWORD} # defined in .env file
- SMTP_HOST=smtpd:8025 # Local smtp container
#- SENDER_MAIL=your-sender@mail.address #optional
- ADMIN_MAIL=your@mail.address # Change me!
# Optional you can gets backup notification via Slack or Telegram
- WEBHOOK_NOTIFICATION=false # true or false if set to true email notification gets disabled
- WEBHOOK_TYPE=slack # choose slack or telegram
- WEBHOOK_URL= # set the slack or telegram URL
- WEBHOOK_CHAT_ID= # for telegram only set the <chat_id>
depends_on:
- bareos-db
bareos-sd:
image: barcus/bareos-storage:21-ubuntu
ports:
- 9103:9103
volumes:
- /mnt/tank01/bareos/config/storage:/etc/bareos
- /mnt/tank01/bareos/data/storage:/var/lib/bareos/storage
environment:
- BAREOS_SD_PASSWORD=${BAREOS_SD_PASSWORD} # defined in .env file
bareos-fd:
image: barcus/bareos-client:21-ubuntu
volumes:
- /mnt/tank01/bareos/config/client:/etc/bareos
- /mnt/tank01/bareos/data/director:/var/lib/bareos-director # required for MyCatalog backup
environment:
- BAREOS_FD_PASSWORD=${BAREOS_FD_PASSWORD} # defined in .env file
- FORCE_ROOT=false
#- PUID=1500 # force bareos user ID
#- PGID=1500 # force bareos group ID
bareos-webui:
image: barcus/bareos-webui:21-ubuntu
ports:
- 8080:80
environment:
- BAREOS_DIR_HOST=bareos-dir
- SERVER_STATS=yes
volumes:
- /mnt/tank01/bareos/config/webui:/etc/bareos-webui
bareos-db:
image: postgres:12
volumes:
- /mnt/tank01/bareos/pgsql/data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${DB_ADMIN_USER} # defined in .env file
- POSTGRES_PASSWORD=${DB_ADMIN_PASSWORD} # defined in .env file
- POSTGRES_INITDB_ARGS=--encoding=SQL_ASCII
smtpd:
image: devture/exim-relay
# Optional tools
# Bareos API
bareos-api:
image: barcus/bareos-api:21
ports:
- 8000:8000
environment:
- BAREOS_DIR_HOST=bareos-dir
# Bareos metrics exporter for Prometheus
bareos-exporter:
image: vierbergenlars/bareos_exporter:v0.6.0
ports:
- 9625:9625
environment:
- DB_HOST=bareos-db
- DB_USER=bareos
- DB_PASSWORD=${DB_PASSWORD}
- WAIT_FOR_DB=15
depends_on:
- bareos-db
#EOF
And for the conf file in the jail I have:
Code:
docker_compatible=1
gpu_passthrough_intel=0
gpu_passthrough_nvidia=0
systemd_nspawn_user_args=--bind='/mnt/tank01/bareos/config/' --bind='/mnt/tank01/bareos/data/' --bind='/mnt/tank01/bareos/pgsql/' --bind='/mnt/tank01/bareos/storage/' --bind='/mnt/tank01/srv/gitlab/config/' --bind='/mnt/tank01/srv/gitlab/data/' --bind='/mnt/tank01/srv/gitlab/logs/'
# You generally will not need to change the options below
systemd_run_default_args=--property=KillMode=mixed --property=Type=notify --property=RestartForceExitStatus=133 --property=SuccessExitStatus=133 --property=Delegate=yes --property=TasksMax=infinity --collect --setenv=SYSTEMD_NSPAWN_LOCK=0
systemd_nspawn_default_args=--keep-unit --quiet --boot
There could be some syntax errors in that stuff as I have changed it so many times, but the gist of it is there. I have a feeling someone is going to point out something obvious to me that I just hadn't considered. Any help would be greatly appreciated!