☁️ The Most Secure and Easy Selfhosted Home Server. Take control of your data and privacy without sacrificing security and stability (Authentication, anti-DDOS, anti-bot)
Ideally, the space should be allocated before the write to prevent that, but supposing it does happen, having documentation to recover from backup like:
cat << 'EOF' | tee restore-cosmos.sh
#!/bin/bash
cosmosdir="/var/lib/cosmos"
tempdir="/tmp/cosmos"
unzip -o "$cosmosdir/cosmos-backup.zip" -d "$tempdir"
cmp -s "$tempdir/cosmos.config.json" "$cosmosdir/cosmos.config.json" && echo "The backup and current config files are identical." && exit 0
echo "<----------------------- Backup Config ---------------------- | ---------------------- Current Config ----------------------->"
diff -y --suppress-common-lines "$tempdir/cosmos.config.json" "$cosmosdir/cosmos.config.json"
echo "<----------------------- Backup Config ---------------------- | ---------------------- Current Config ----------------------->"
read -p "Do you want to replace the current config with the backup? (y/N): " answer
case "${answer}" in
[yY]|[yY][eE][sS]) cp "$tempdir/cosmos.config.json" "$cosmosdir/cosmos.config.json"; echo "Configuration restored from backup." ;;
*) echo "No changes made." ;;
esac
EOF
chmod +x restore-cosmos.sh
./restore-cosmos.sh
or a way for the container to either start (with the webpage complaining about storage), or exit with information about how to resolve the issue.
Feature Description
There are cases, whether accidental (user error) or malicious (compromised upload server) that can result in running of of storage space.
If the
/var/lib/cosmos/cosmos.config.json
was modified afterwards, the file can become truncated:In such a case, the container will have an error and then restart, endlessly.
Ideally, the space should be allocated before the write to prevent that, but supposing it does happen, having documentation to recover from backup like:
or a way for the container to either start (with the webpage complaining about storage), or exit with information about how to resolve the issue.