Is a set of productivity Software that can run on a NAS
Setup using Docker¶
- occ commands:
sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ your-command
- Activate overcommit for Redis (see discussion):
echo "vm.overcommit_memory = 1" | sudo tee /etc/sysctl.d/nextcloud-aio-memory-overcommit.conf
Setup using Snap¶
Reference page for the Snap
1. sudo snap install nextcloud
1. Allow 80 and 443 in firewall
1. Edit trusted domain sudo nextcloud.occ config:system:set trusted_domains 1 --value=domain.example.com
1. sudo nextcloud.enable-https lets-encrypt
1. Add NAT translation on the home router
1. Add domain A record in my DNS zone
1. Setup Sendgrid for SMTP server
Other stuff¶
- Host
X.X.X.X
was not connected to because it violates local access rules. → Fix here - Change trash bin configuration: see this article
- If you have
sudo: nextcloud.occ: command not found
, then maybe your system doesn't add/snap/bin
to the PATH → Usesudo /snap/bin/nextcloud.occ
Cloudflare Tunnel¶
Integrations with other devices¶
Outlook calendar¶
Use Outlook CalDav Synchronizer - but untestes
Maintenance¶
Data¶
sudo nextcloud.export -abc
to export everything except user datasudo nextcloud.occ files:scan --all
to force scan all files, useful to fix checksum issuessudo nextcloud.occ files:scan-app-data
to force scan all app data- User data are in
/var/snap/nextcloud/common/
Remove a file that is only on the database and not in the file system¶
- Find the
fileid
of the affected file - this can be done from the web interface - Check that the file is deleted on the filesystem
- Open the SQL client, like
nextcloud.mysql-client
for the snap version - Delete the affected file
delete from nextcloud.oc_filecache where fileid in (FILEID);
- Rescan the files
nextcloud.occ files:scan --all
Browse the database¶
oc_filecache
contains all files in the instancepath
contains path per user, likefiles/RootDir/SubDir
Backup¶
Based on How To Backup Nextcloud
1. Create ncbackup
user
1. Edit /usr/sbin/ncbackup.sh
with
#!/bin/bash
# Output to a logfile
exec &> /home/ncbackup/Backups/Logs/"$(date '+%Y-%m-%d').txt"
echo "Starting Nextcloud export..."
# Run a Nextcloud backup without data (will be saved later with Duplicati)
nextcloud.export -abc
echo "Export complete"
# Clean the Backup/Data folder
rm -r /home/ncbackup/Backups/Data/*
# Move backup from yyyymm... directory to our directory. 2* is used to filter out folder starting with 2, like 2020
mv /var/snap/nextcloud/common/backups/2*/* /var/snap/nextcloud/common/backups/2*/.* /home/ncbackup/Backups/Data/
# Remove backup folder
rm -r /var/snap/nextcloud/common/backups/2*/
echo "Nextcloud backup successfully moved to /home/ncbackup/Backups/Data/"
# Remove logs older than 14 days
find /home/ncbackup/Backups/Logs -mtime +14 -type f -delete
echo "Removed old logs"
echo "Nextcloud backup completed successfully."
- Make the file executable
sudo chmod +x /usr/sbin/ncbackup.sh
- Allow the file to be executed without sudo interaction
sudo visudo
ncbackup ALL=(ALL) NOPASSWD: /usr/sbin/ncbackup.sh
- Remove shell access from
ncbackup
usersudo usermod -s /sbin/nologin ncbackup
- To add it back
sudo usermod -s /bin/bash ncbackup
- To add it back
-
Schedule the backup
- Open crontab
sudo crontab -u ncbackup -e
- Make the script run at 0200 every day
0 2 * * * sudo /usr/sbin/ncbackup.sh
- Open crontab
-
Sources:
- Reference page for the Snap
- How To Setup A Nextcloud Server In Ubuntu
- OCC Command line tool
- Most notably the config command instead of changing
config.php
- Get example:
sudo nextcloud.occ config:system:get version
- Set example:
sudo nextcloud.occ config:system:set logtimezone --value="Europe/Berlin"
- Most notably the config command instead of changing
Good apps¶
ClamAV for antivirus¶
- Documentation
- Disable background task with
occ config:app:set files_antivirus av_background_scan --value="off"
Preview Generator for thumbnails¶
- Suggested: change the preview generation behavior - great post here, I just changed quality to 70
occ config:app:set previewgenerator squareSizes --value="32 256"
occ config:app:set previewgenerator widthSizes --value="256 384"
occ config:app:set previewgenerator heightSizes --value="256"
occ config:app:set preview jpeg_quality --value="60"
- Install from app store
sudo nextcloud.occ preview:generate-all
-
Make a script for that and schedule it
-
Edit
/usr/sbin/ncpreviewgenerator.sh
with```bash
!/bin/bash¶
Output to a logfile¶
exec &> /home/ncbackup/PreviewGenerator/"$(date '+%Y-%m-%d %T').txt"
echo "Starting Nextcloud Preview Generator (with logs)..." nextcloud.occ preview:pre-generate -vvv echo "Done."
Remove logs older than 14 days¶
find /home/ncbackup/PreviewGenerator -mtime +14 -type f -delete echo "Removed old logs"
echo "Nextcloud Preview Generator completed successfully." ```
-
sudo chmod +x /usr/sbin/ncpreviewgenerator.sh
sudo visudo
ncbackup ALL=(ALL) NOPASSWD: /usr/sbin/ncpreviewgenerator.sh
- Remove shell access from
ncbackup
usersudo usermod -s /sbin/nologin ncbackup
- Schedule the backup
- Open crontab
sudo crontab -u ncbackup -e
- Make the script run every 30 min
30 * * * * sudo /usr/sbin/ncpreviewgenerator.sh
- Open crontab
-
Notes:
* Use -vvv
argument to output each opened file
* Command for AIO Docker here
RainLoop Webmail¶
- Original project docs
- Rainloop-nextcloud project
- Install plugin
- Login to admin panel in
root/index.php/apps/rainloop/app/
- Change admin password
- Add domain
- Login with standard link using user mail and mail password
- Enable automatic login in Settings > Additional Settings
Music¶
OVH Dynamic IP¶
OK, it's not an app, just a script that I run every 6 hours.
You need to setup first a DynHost username - see this documentation and calculate the Basic Authentication in the header.
#!/bin/bash
# Output to a logfile
exec &> /home/ncbackup/DDNS/"$(date '+%Y-%m-%d %T').txt"
echo "Starting DDNS update ..."
curl -i -H "Authorization: Basic COPY_YOUR_KEY_HERE=" ""https://www.ovh.com/nic/update?system=dyndns'&'hostname=DOMAIN.EXAMPLE.ORG""
# Remove logs older than 14 days
find /home/ncbackup/DDNS -mtime +14 -type f -delete
echo "Removed old logs"