pull/35/head
DoTheEvo 1 year ago
parent 446af7bf74
commit 22e9d8d2f4

@ -12,13 +12,13 @@ File share & sync.
* [Github](https://github.com/nextcloud/server) * [Github](https://github.com/nextcloud/server)
* [DockerHub](https://hub.docker.com/_/nextcloud/) * [DockerHub](https://hub.docker.com/_/nextcloud/)
Nextcloud is an open source suite of client-server software for creating Nextcloud is an open source software for sharing files, calendar,
and using file hosting services with wide cross platform support. and general office collaboration stuff. Most people know it and use it
as an alternative to onedrive/google drive.
The Nextcloud server is written in PHP and JavaScript. The Nextcloud server is written in PHP and JavaScript.
For remote access it employs sabre/dav, an open-source WebDAV server. For remote access it employs sabre/dav, an open-source WebDAV server.
It is designed to work with several database management systems, It is designed to work with most of the databases.
including SQLite, MariaDB, MySQL, PostgreSQL.
There are many ways to deploy Nextcloud, this setup is going with the most goodies.</br> There are many ways to deploy Nextcloud, this setup is going with the most goodies.</br>
Using [PHP-FPM](https://www.cloudways.com/blog/php-fpm-on-cloud/) Using [PHP-FPM](https://www.cloudways.com/blog/php-fpm-on-cloud/)
@ -34,16 +34,16 @@ and for [memory file caching](https://docs.nextcloud.com/server/latest/admin_man
└── ~/ └── ~/
└── docker/ └── docker/
└── nextcloud/ └── nextcloud/
├── 🗁 nextcloud-data/ ├── 🗁 nextcloud_data/
├── 🗁 nextcloud-db-data/ ├── 🗁 nextcloud_db_data/
├── 🗋 .env ├── 🗋 .env
├── 🗋 docker-compose.yml ├── 🗋 docker-compose.yml
├── 🗋 nginx.conf ├── 🗋 nginx.conf
└── 🗋 nextcloud-backup-script.sh └── 🗋 nextcloud-backup-script.sh
``` ```
* `nextcloud-data/` - users data and web app data * `nextcloud_data/` - users actual data and web app data
* `nextcloud-db-data/` - database data * `nextcloud_db_data/` - database data - users and files metadata, configuration
* `.env` - a file containing environment variables for docker compose * `.env` - a file containing environment variables for docker compose
* `docker-compose.yml` - a docker compose file, telling docker how to run the containers * `docker-compose.yml` - a docker compose file, telling docker how to run the containers
* `nginx.conf` - nginx web server configuration file * `nginx.conf` - nginx web server configuration file
@ -59,11 +59,11 @@ Official examples [here](https://github.com/nextcloud/docker/tree/master/.exampl
Five containers to spin up Five containers to spin up
* **nextcloud-app** - nextcloud backend app that stores the files and facilitate * **nextcloud-app** - nextcloud backend app that stores the files and facilitate
the sync and runs the apps the sync and runs the apps(calendar, notes, phonetrack,...)
* **nextcloud-db** - mariadb database where files-metadata and users-metadata are stored * **nextcloud-db** - mariadb database storing files-metadata and users-metadata
* **nextcloud-web** - nginx web server with fastCGI PHP-FPM support * **nextcloud-web** - nginx web server with fastCGI PHP-FPM support
* **nextcloud-redis** - in memory file caching * **nextcloud-redis** - in memory file caching and more reliable transactional
and more reliable transactional file locking file locking
* **nextcloud-cron** - for periodic maintenance in the background * **nextcloud-cron** - for periodic maintenance in the background
`docker-compose.yml` `docker-compose.yml`
@ -165,13 +165,11 @@ Not be pasted here, too long.
It is included in this github repo. It is included in this github repo.
``` ```
[nginx.conf](https://raw.githubusercontent.com/DoTheEvo/selfhosted-apps-docker/master/nextcloud/nginx.conf) [nginx.conf](https://raw.githubusercontent.com/DoTheEvo/selfhosted-apps-docker/master/nextcloud/nginx.conf)<br>
This is nginx web server configuration file, specifically setup This is nginx web server configuration file, specifically setup
to support fastCGI PHP-FPM. to support fastCGI PHP-FPM.<br>
From [this official nextcloud example
Taken from [this official nextcloud example setup](https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/insecure/mariadb/fpm/web)
setup](https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/insecure/mariadb-cron-redis/fpm/web)
and has one thing changed in it - the upstream hostname from `app` to `nextcloud-app` and has one thing changed in it - the upstream hostname from `app` to `nextcloud-app`
``` ```
@ -224,48 +222,26 @@ Editing `nextcloud_data/config/config.php` and adding the new domain will fix it
# Security & setup warnings # Security & setup warnings
Nextcloud has a status check in *Settings > Administration > Overview*</br> Nextcloud has a status check in *Settings > Administration > Overview*</br>
There are likely several warnings on a freshly spun containers. There could be some warnings there, but if following this guide, it should be
all good. As `Caddyfile` and `.env` file should take care of it.
##### The database is missing some indexes
On the docker host execute:</br>
`docker exec --user www-data --workdir /var/www/html nextcloud-app php occ db:add-missing-indices`
##### Some columns in the database are missing a conversion to big int
On the docker host execute:</br>
`docker exec --user www-data --workdir /var/www/html nextcloud-app php occ db:convert-filecache-bigint`
##### The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. [Here](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/a86c8498dc8ebc59546660701a54b839bf417516/nextcloud#security--setup-warnings)
is a link to an older commit that talks in more detail on possible stuff here.<br>
But fuck writing on that noise when nextcloud is now doing phone number area
code notification there.
Helps to know what is [HSTS](https://www.youtube.com/watch?v=kYhMnw4aJTw).</br> ![status-pic](https://i.imgur.com/0nltwrn.png)
This warning is already fixed in the reverse proxy section in the caddy config,</br>
the line: `header Strict-Transport-Security max-age=31536000;`
##### Your web server is not properly set up to resolve "/.well-known/caldav" and Your web server is not properly set up to resolve "/.well-known/carddav".
This warning is already fixed in the reverse proxy section in the caddy config,</br>
The lines:</br>
`redir /.well-known/carddav /remote.php/carddav 301`</br>
`redir /.well-known/caldav /remote.php/caldav 301`
![status-pic](https://i.imgur.com/wjjd5CJ.png)
# Troubleshooting # Troubleshooting
If there is a problem accesing nextcloud from a mobile app, * *old stuff that was here is not applicable anymore*
*"Please log in before granting access"*,
and being stuck after logging in with the circle animation:
Edit `nextcloud_data/config/config.php`</br>
adding as the last line: `'overwriteprotocol' => 'https',`
# Extra info # Extra info
#### check if redis container works #### check if redis container works
At `https://<nexcloud url>/ocs/v2.php/apps/serverinfo/api/v1/info`</br> At `https://<nexcloud url>/ocs/v2.php/apps/serverinfo/api/v1/info`</br>
ctrl+f for `redis`, should be in memcache.distributed and memcache.locking ctrl+f for `redis`, if it's present it means nexcloud is set to use it.
You can also exec in to redis container: You can also exec in to redis container:
- `docker exec -it nextcloud-redis /bin/sh` - `docker exec -it nextcloud-redis /bin/sh`
@ -282,9 +258,6 @@ You can also exec in to redis container:
# Update # Update
[Watchtower](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/watchtower)
updates the image automatically.
Manual image update: Manual image update:
- `docker-compose pull`</br> - `docker-compose pull`</br>
@ -295,30 +268,30 @@ Manual image update:
#### Backup #### Backup
Using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) Using [kopia](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/kopia_backup)
that makes daily snapshot of the entire directory. or [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup)
to make daily snapshot of the entire docker directory.
#### Restore #### Restore
* down the nextcloud containers `docker-compose down`</br> * down the containers `docker-compose down`</br>
* delete the entire nextcloud directory</br> * delete/move/rename the entire project directory</br>
* from the backup copy back the nextcloud directory</br> * from the backups copy back the entire project directory</br>
* start the containers `docker-compose up -d` * start the containers `docker-compose up -d`
# Backup of just user data # Backup of just user data
User data daily export using the User's data daily export going by the
[official procedure.](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html)</br> [official procedure.](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html)</br>
For nextcloud it means entering the maintenance mode, doing a database dump For nextcloud it means entering the maintenance mode, doing a database dump
and backing up several directories containing data, configs, themes.</br> and backing up several directories containing data, configs, themes.</br>
For the script it just means database dump as borg backup and its deduplication Daily kopia/borg backup run takes care of backing up the directories.
will deal with the directories, especially useful in the case of nextcloud where So only database dump is needed and done with the script.</br>
hundreds gigabytes can be stored.
#### Create a backup script #### Create a backup script
Placed inside `~/docker/nextcloud/` directory on the host. Placed inside `nextcloud` directory on the host.
`nextcloud-backup-script.sh` `nextcloud-backup-script.sh`
```bash ```bash
@ -352,6 +325,8 @@ Running on the host, so that the script will be periodically run.
# Restore the user data # Restore the user data
[The official docs.](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/restore.html)
Assuming clean start. Assuming clean start.
* start the containers: `docker-compose up -d`</br> * start the containers: `docker-compose up -d`</br>
@ -359,8 +334,8 @@ Assuming clean start.
* down the containers: `docker-compose down` * down the containers: `docker-compose down`
* delete the directories `config`, `data`, `themes` in the freshly created * delete the directories `config`, `data`, `themes` in the freshly created
`nextcloud/nextcloud_data/` `nextcloud/nextcloud_data/`
* from the backup of `/nextcloud/nextcloud-data/`, copy the directories * from the backup of `/nextcloud/nextcloud_data/`, copy the directories
`configs`, `data`, `themes` in to the new `/nextcloud/nextcloud-data/` `configs`, `data`, `themes` in to the new `/nextcloud/nextcloud_data/`
* from the backup of `/nextcloud/nextcloud_data_db/`, copy the backup database * from the backup of `/nextcloud/nextcloud_data_db/`, copy the backup database
named `BACKUP.nextcloud.database.sql` in to the new `/nextcloud/nextcloud_data_db/` named `BACKUP.nextcloud.database.sql` in to the new `/nextcloud/nextcloud_data_db/`
* start the containers: `docker-compose up -d` * start the containers: `docker-compose up -d`

Loading…
Cancel
Save