Skip to content

Latest commit

 

History

History

nextcloud

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

xsrv.nextcloud

This role will install Nextcloud, a file hosting, sharing, and synchronization service.

Nextcloud is an alternative to services such as Dropbox, Google Drive/Agenda... See the comparison page.

Basic functionality includes uploading, viewing, editing, downloading and sharing files from a web interface. Nextcloud clients can be installed on any computer (Linux/OSX/Windows) or mobile device (Android/iOS) and allow automatically synchronizing your files with the server. It can be extended to a full personal cloud/collaborative suite/groupware solution by more than 200 applications.

Default installed applications include:

  • Calendar: Manage calendar events with search, alarms, invitation management, contacts integration, sharing and synchronization across devices (CalDAV/ICS)
  • Contacts:E dit, view, share address books and synchronize them across devices (CardDav)
  • Tasks: Task/todo-list management (supports due dates, reminders, priorities, comments, tasks sharing, sub-tasks), and synchronize them across devices (CalDAV)
  • Music: Play audio files directly from teh file list or in a library view (supports playlists, search, ampache and more)
  • Photos: Media gallery with previews for all media types
  • Notes: Note taking app with markdown support, notes are saved as files in your Nextcloud so you can view and edit them from anywhere.
  • Deck: Kanban style organization tool aimed at personal planning and project organization for teams.
  • Maps: Map and routing service using OpenStreetMap
  • Viewers and editors for common file types (PDF, text, video...)
  • Federation between Nextcloud instances (seamless access to other instances files/shares)
  • Remote file storage access (FTP, SFTP, Samba/CIFS, local directory/drive...).

It will also configure:

  • bruteforce prevention using fail2ban
  • (optional) agregation of nextcloud logs to syslog

Requirements/dependencies/example playbook

See meta/main.yml

- hosts: my.CHANGEME.org
  roles:
    - nodiscc.xsrv.common # hardening/firewall/bruteforce prevention
    - nodiscc.xsrv.monitoring # (optional) server monitoring and log agregation
    - nodiscc.xsrv.backup # (optional) automatic backups
    - nodiscc.xsrv.apache # webserver, PHP interpreter and SSL certificates
    - nodiscc.xsrv.postgresql # database engine
    - nodiscc.xsrv.nextcloud

# host_vars/my.example.org/my.example.org.vault.yml
nextcloud_fqdn: "cloud.CHANGEME.org"

# ansible-vault edit host_vars/my.example.org/my.example.org.vault.yml
nextcloud_user: "CHANGEME"
nextcloud_password: "CHANGEME"
nextcloud_db_password: "CHANGEME"

See defaults/main.yml for all configurable variables

Usage

Clients

Access Nextcloud from any Web browser or from one of the available clients:

File synchronization:

Calendar, contacts and tasks synchronization:

Other:

Useful commands

  • Clear nextcloud previews cache: ssh -t my.example.org sudo find /var/nextcloud/data/appdata_ocasr47zovdz/ -type d -name "previews" -exec rm -rv '{}' \;
  • Empty nextcloud trashes: ssh -y my.example.org sudo -u www-data /usr/bin/php /var/www/nextcloud/occ trashbin:cleanup --all-users
  • Clear nextcloud filecaches: ssh -y my.example.org sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files:cleanup

Backups

See the included rsnapshot configuration for the backup role.

To restore a backup:

# Remove the nextcloud database (nextcloud by default)
mysql -u root -p -e 'DROP database nextcloud;'
# Remove the nextcloud installation directory
rm -rv /var/www/my.example.org/nextcloud
# Remove the nextcloud data directory
rm -rv /var/nextcloud/data
# Reinstall nextcloud by running the playbook/nextcloud role, then
# Restore the database
mysql -u root -p nextcloud < /var/backups/rsnapshot/daily.0/localhost/var/backups/mysql/nextcloud/nextcloud.sql
# Restore the data directory
rsync -avP --delete /var/backups/rsnapshot/daily.0/localhost/var/nextcloud/data /var/nextcloud/
# Rescan files
sudo -u www-data /usr/bin/php /var/www/my.example.org/nextcloud/occ files:scan

Other

Changing database password is not supported by the role at this time. To change the database password, you must first set the new password manually in /var/www/$nextcloud_fqdn/config.php, then change the value of nexctloud_db_password in host variables, and run the playbook.

License

GNU GPLv3

References