-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ce23972
Showing
3 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# My personal Nextcloud setup | ||
[Nextcloud](https://nextcloud.com/) setup using Docker with [Nginx Proxy Manager](https://nginxproxymanager.com/), [PostgreSQL](https://www.postgresql.org/) and [Redis](https://redis.io/). | ||
|
||
|
||
**1. Install Docker** | ||
|
||
This [Docker installation script](https://github.com/inwerk/docker-debian/) is based on the [installation instructions for Debian-based systems](https://docs.docker.com/engine/install/debian/) from the official Docker documentation. For other platforms, refer to the corresponding instructions from the [Docker documentation](https://docs.docker.com/engine/install/). | ||
```bash | ||
curl -sSL https://raw.githubusercontent.com/inwerk/docker-debian/master/install-docker.sh | sudo bash | ||
``` | ||
|
||
|
||
**2. Install Nextcloud with Nginx Proxy Manager, PostgreSQL and Redis** | ||
|
||
Script for installing/updating a Nextcloud Docker image with Nginx Proxy Manager, PostgreSQL and Redis. You can replace `/mnt/data` with your preferred file path. | ||
```bash | ||
curl -sSL https://raw.githubusercontent.com/inwerk/nextcloud-docker/master/install-nextcloud.sh | sudo bash -s -- /mnt/data | ||
``` | ||
|
||
|
||
**3. Configure Nginx Proxy Manager** | ||
|
||
Login with the default administrator user: | ||
``` | ||
Email: [email protected] | ||
Password: changeme | ||
``` | ||
|
||
|
||
Immediately after logging in with this default user you will be asked to modify your details and change your password. | ||
|
||
When configuring the Nextcloud proxy host, include this custom Nginx configuration under the `Advanced` tab: | ||
``` | ||
client_body_buffer_size 512k; | ||
proxy_read_timeout 86400s; | ||
client_max_body_size 0; | ||
proxy_request_buffering off; | ||
location /.well-known/carddav { | ||
return 301 $scheme://$host/remote.php/dav; | ||
} | ||
location /.well-known/caldav { | ||
return 301 $scheme://$host/remote.php/dav; | ||
} | ||
``` | ||
|
||
|
||
**4. Configure Nextcloud** | ||
|
||
Script to run after the initial Nextcloud setup (after creating the admin user). | ||
Handles the configuration of various settings, as well as setting up Cron for background jobs. | ||
```bash | ||
curl -sSL https://raw.githubusercontent.com/inwerk/nextcloud-docker/master/setup-nextcloud.sh | sudo bash | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Stop the containers and remove them from Docker. | ||
docker stop nginxproxymanager && docker rm nginxproxymanager | ||
docker stop postgres && docker rm postgres | ||
docker stop redis && docker rm redis | ||
docker stop nextcloud && docker rm nextcloud | ||
|
||
# Download the latest Docker images. | ||
docker pull jc21/nginx-proxy-manager:latest | ||
docker pull postgres:latest | ||
docker pull redis:latest | ||
docker pull nextcloud:latest | ||
|
||
# Read path for persistent storage from command line arguments. | ||
VOLUME_PATH=${1} | ||
|
||
# Create persistent storage directories for the container volumes. | ||
mkdir -p ${VOLUME_PATH}/nginx | ||
mkdir -p ${VOLUME_PATH}/nginx/data | ||
mkdir -p ${VOLUME_PATH}/nginx/letsencrypt | ||
mkdir -p ${VOLUME_PATH}/postgres | ||
mkdir -p ${VOLUME_PATH}/nextcloud | ||
|
||
# Generate passwords for PostgreSQL and Redis. | ||
POSTGRES_PASSWORD=$(openssl rand -base64 32 | tr -dc _A-Z-a-z-0-9) | ||
REDIS_HOST_PASSWORD=$(openssl rand -base64 32 | tr -dc _A-Z-a-z-0-9) | ||
|
||
# Create a new Docker bridge network for communication between containers. | ||
docker network inspect nginxproxymanager-nextcloud-postgres-redis >/dev/null 2>&1 || \ | ||
docker network create --driver bridge nginxproxymanager-nextcloud-postgres-redis | ||
|
||
# Run the Docker container for Nginx Proxy Manager. | ||
docker run -d \ | ||
--name nginxproxymanager \ | ||
--hostname nginxproxymanager \ | ||
--restart=unless-stopped \ | ||
--network nginxproxymanager-nextcloud-postgres-redis \ | ||
-p 80:80 \ | ||
-p 81:81 \ | ||
-p 443:443 \ | ||
-v "${VOLUME_PATH}/nginx/data:/data" \ | ||
-v "${VOLUME_PATH}/nginx/letsencrypt:/etc/letsencrypt" \ | ||
jc21/nginx-proxy-manager | ||
|
||
# Run the Docker container for PostgreSQL. | ||
docker run -d \ | ||
--name postgres \ | ||
--hostname postgres \ | ||
--restart=unless-stopped \ | ||
--network nginxproxymanager-nextcloud-postgres-redis \ | ||
-v "${VOLUME_PATH}/postgres:/var/lib/postgresql/data" \ | ||
-e POSTGRES_DB=nextcloud_db \ | ||
-e POSTGRES_USER=postgres \ | ||
-e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \ | ||
postgres | ||
|
||
# Run the Docker container for Redis. | ||
docker run -d \ | ||
--name redis \ | ||
--hostname redis \ | ||
--restart=unless-stopped \ | ||
--network nginxproxymanager-nextcloud-postgres-redis \ | ||
redis redis-server --requirepass ${REDIS_HOST_PASSWORD} | ||
|
||
# Run the Docker container for Nextcloud. | ||
docker run -d \ | ||
--name nextcloud \ | ||
--hostname nextcloud \ | ||
--restart=unless-stopped \ | ||
--network nginxproxymanager-nextcloud-postgres-redis \ | ||
-v "${VOLUME_PATH}/nextcloud:/var/www/html" \ | ||
-e POSTGRES_HOST=postgres \ | ||
-e POSTGRES_DB=nextcloud_db \ | ||
-e POSTGRES_USER=postgres \ | ||
-e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \ | ||
-e REDIS_HOST=redis \ | ||
-e REDIS_HOST_PASSWORD=${REDIS_HOST_PASSWORD} \ | ||
nextcloud:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Add missing indices to the database. | ||
docker exec --user www-data nextcloud /var/www/html/occ db:add-missing-indices | ||
|
||
# Perform mimetype migrations for Nextcloud. | ||
docker exec --user www-data nextcloud /var/www/html/occ maintenance:repair --include-expensive | ||
|
||
# Set mode for background jobs to 'cron'. | ||
docker exec --user www-data nextcloud /var/www/html/occ background:cron | ||
|
||
# Add crontab to run background jobs every five minutes. | ||
(crontab -l; echo "*/5 * * * * docker exec -u www-data nextcloud php /var/www/html/cron.php")|awk '!x[$0]++'|crontab - | ||
|
||
# Run background jobs between 01:00am UTC and 05:00am UTC. | ||
docker exec --user www-data nextcloud /var/www/html/occ config:system:set maintenance_window_start --type=integer --value=1 | ||
|
||
# Set default language to German. | ||
docker exec --user www-data nextcloud /var/www/html/occ config:system:set default_language --type=string --value='de' | ||
|
||
# Set default locale to Germany. | ||
docker exec --user www-data nextcloud /var/www/html/occ config:system:set default_locale --type=string --value='de_DE' | ||
|
||
# Set the default phone region to Germany. | ||
docker exec --user www-data nextcloud /var/www/html/occ config:system:set default_phone_region --type=string --value='DE' | ||
|
||
# Set the default time zone to Europe/Berlin. | ||
docker exec --user www-data nextcloud /var/www/html/occ config:system:set default_timezone --type=string --value='Europe/Berlin' | ||
|
||
# Create default directory structure for new users. | ||
docker exec --user www-data nextcloud mkdir -p /var/www/html/core/custom_skeleton | ||
docker exec --user www-data nextcloud mkdir -p /var/www/html/core/custom_skeleton/Desktop | ||
docker exec --user www-data nextcloud mkdir -p /var/www/html/core/custom_skeleton/Documents | ||
docker exec --user www-data nextcloud mkdir -p /var/www/html/core/custom_skeleton/Downloads | ||
docker exec --user www-data nextcloud mkdir -p /var/www/html/core/custom_skeleton/Music | ||
docker exec --user www-data nextcloud mkdir -p /var/www/html/core/custom_skeleton/Pictures | ||
docker exec --user www-data nextcloud mkdir -p /var/www/html/core/custom_skeleton/Videos | ||
|
||
# Set default directory structure for new users. | ||
docker exec --user www-data nextcloud /var/www/html/occ config:system:set skeletondirectory --type=string --value='/var/www/html/core/custom_skeleton' | ||
|
||
# Disable template directory for new users. | ||
docker exec --user www-data nextcloud /var/www/html/occ config:system:set templatedirectory --type=string --value='' | ||
|
||
# Update all Nextcloud apps. | ||
docker exec --user www-data nextcloud /var/www/html/occ app:update --all | ||
|
||
# Download and install Nextcloud apps. | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install calendar | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install circles | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install cloud_federation_api | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install contactsinteraction | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install dav | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install federatedfilesharing | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install federation | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install files | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install files_downloadlimit | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install files_pdfviewer | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install files_reminders | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install files_sharing | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install files_trashbin | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install files_versions | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install logreader | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install lookup_server_connector | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install oauth2 | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install password_policy | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install privacy | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install provisioning_api | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install related_resources | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install serverinfo | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install settings | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install sharebymail | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install systemtags | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install text | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install theming | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install twofactor_backupcodes | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install updatenotification | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install viewer | ||
docker exec --user www-data nextcloud /var/www/html/occ app:install workflowengine | ||
|
||
# Disable redundant Nextcloud apps. | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable activity | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable admin_audit | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable bruteforcesettings | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable comments | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable dashboard | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable encryption | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable files_external | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable firstrunwizard | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable nextcloud_announcements | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable notifications | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable photos | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable recommendations | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable support | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable survey_client | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable suspicious_login | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable twofactor_totp | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable user_ldap | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable user_status | ||
docker exec --user www-data nextcloud /var/www/html/occ app:disable weather_status |