# Nextcloud

# High-Performance Nextcloud & MariaDB Deployment (CasaOS)

**Status:** Verified Deployment  
**Environment:** Ubuntu (CasaOS) | Synology DS1522+ Backend  
**Core Architecture:** Dedicated Mini PC for compute; "GoonersNAS" for muscle storage.

---

### 1. Preparation: The Network Bridge

To allow Nextcloud and MariaDB to communicate securely without using public IP addresses, they must reside on the same Docker network.

- **Network Name:** `big-bear-nextcloud-ls`
- **Note:** Ensure both containers are assigned to this network in their respective CasaOS settings to enable internal DNS resolution.

---

### 2. Database Setup (MariaDB)

We use the LinuxServer image for consistency and PUID/PGID support, which is vital for permission management.

<table id="bkmrk-category-setting-%2F-v" style="width: 100%; border-collapse: collapse; border: 1px solid #ccc;"><thead><tr style="background-color: #f2f2f2;"><th style="padding: 8px; border: 1px solid #ccc; text-align: left;">Category</th><th style="padding: 8px; border: 1px solid #ccc; text-align: left;">Setting / Value</th></tr></thead><tbody><tr><td style="padding: 8px; border: 1px solid #ccc;">**Image**</td><td style="padding: 8px; border: 1px solid #ccc;">`linuxserver/mariadb`</td></tr><tr><td style="padding: 8px; border: 1px solid #ccc;">**Network**</td><td style="padding: 8px; border: 1px solid #ccc;">`big-bear-nextcloud-ls`</td></tr><tr><td style="padding: 8px; border: 1px solid #ccc;">**Port**</td><td style="padding: 8px; border: 1px solid #ccc;">Host 3306 -&gt; Container 3306</td></tr><tr><td style="padding: 8px; border: 1px solid #ccc;">**Volume**</td><td style="padding: 8px; border: 1px solid #ccc;">`/DATA/AppData/mariadb/config` -&gt; `/config`</td></tr></tbody></table>

**Environment Variables:**

```
MYSQL_ROOT_PASSWORD = [YourSecretRootPassword]
MYSQL_DATABASE = nextcloud
MYSQL_USER = nc_user
MYSQL_PASSWORD = [YourSecretUserPassword]
PUID = 1000
PGID = 1000
TZ = America/Chicago
```

---

### 3. Application Setup (Nextcloud LS)

The **Nextcloud LS** (LinuxServer.io) version is preferred for its robust handling of PUID/PGID variables when mapping to NAS-based storage.

<table id="bkmrk-category-setting-%2F-v-1" style="width: 100%; border-collapse: collapse; border: 1px solid #ccc;"><thead><tr style="background-color: #f2f2f2;"><th style="padding: 8px; border: 1px solid #ccc; text-align: left;">Category</th><th style="padding: 8px; border: 1px solid #ccc; text-align: left;">Setting / Value</th></tr></thead><tbody><tr><td style="padding: 8px; border: 1px solid #ccc;">**Image**</td><td style="padding: 8px; border: 1px solid #ccc;">`linuxserver/nextcloud`</td></tr><tr><td style="padding: 8px; border: 1px solid #ccc;">**Port**</td><td style="padding: 8px; border: 1px solid #ccc;">Host 10443 -&gt; Container 443</td></tr><tr><td style="padding: 8px; border: 1px solid #ccc;">**Web UI**</td><td style="padding: 8px; border: 1px solid #ccc;">HTTPS (Required for Authentik)</td></tr><tr><td style="padding: 8px; border: 1px solid #ccc;">**Volume 1**</td><td style="padding: 8px; border: 1px solid #ccc;">`/DATA/AppData/nextcloud/config` -&gt; `/config`</td></tr><tr><td style="padding: 8px; border: 1px solid #ccc;">**Volume 2 (NAS)**</td><td style="padding: 8px; border: 1px solid #ccc;">`/mnt/synology/nextcloud_data` -&gt; `/data`</td></tr></tbody></table>

---

### 4. Initial Configuration (The Setup Screen)

Navigate to `https://nc.goonersnas.com` to complete the wizard.

- **Admin Account:** Create a master local admin.
- **Storage &amp; Database:** Select **MySQL/MariaDB**.
- **Database User:** `nc_user`
- **Database Host:** `mariadb:3306`

---

### 5. Troubleshooting &amp; Critical Fixes

> **The "Access Denied" Loop:** If the installer rejects your credentials, MariaDB likely initialized with old variables.   
> **Fix:** Stop MariaDB, delete all contents of `/DATA/AppData/mariadb/config`, and restart. It will re-generate the database with the correct PUID/PGID and credentials.

> **The "App Unavailable" Error:** This is a protocol mismatch in CasaOS.   
> **Fix:** Manually use `https://` in the browser and update the App Settings to use the HTTPS dropdown.

---

### 6. Post-Install Checklist

- \[ \] Enable **External Storage Support** for Synology integration.
- \[ \] Install **Social Login** for Authentik OIDC.
- \[ \] Download **ONLYOFFICE Desktop Editors** for native local editing.

# Installing ONLYOFFICE on Nextcloud (CasaOS/Ubuntu)

### Overview

This guide covers deploying **ONLYOFFICE Document Server** as a backend engine via CasaOS and integrating it with **Nextcloud**. This setup provides a high-performance office suite capable of handling Microsoft Office formats (`.docx`, `.xlsx`, `.pptx`) directly within the browser.

---

### Prerequisites

- **Nextcloud** running on Ubuntu (via Docker/CasaOS).
- **Reverse Proxy** already configured for your main domain (`nc.goonersnas.com`).
- A dedicated subdomain (e.g., `office.goonersnas.com`) with an SSL certificate.

---

### Step 1: Deploy ONLYOFFICE Document Server (Backend)

We use a separate Docker container for the rendering engine to ensure stability and performance.

1. Open **CasaOS** and click the **+** icon to **install a customized app**.
2. Click **Import** in the top right and paste the following Docker Compose snippet:

```
name: onlyoffice
services:
  onlyoffice:
    image: onlyoffice/documentserver:latest
    container_name: onlyoffice-docs
    environment:
      - JWT_ENABLED=true
      - JWT_SECRET=SecretGoonersKey123
    ports:
      - "8888:80"
    restart: unless-stopped
```

3. **Submit** and **Install**.
4. *Optional:* Change the **Network** setting in CasaOS to match your Nextcloud bridge (e.g., `big-bear-nextcloud-ls`).

---

### Step 2: Reverse Proxy Configuration (Crucial)

To avoid the **Mixed Active Content** error, ONLYOFFICE must be served over HTTPS.

- Point your subdomain (e.g., `office.goonersnas.com`) to your server IP.
- In your Reverse Proxy manager, create a new host: 
    - **Domain:** `office.goonersnas.com`
    - **Forward IP:** `192.168.0.152`
    - **Forward Port:** `8888`
- Enable **SSL** and force SSL.

---

### Step 3: Integration in Nextcloud

1. **Install the App:** Go to **Apps** &gt; **Office &amp; text**. Find **ONLYOFFICE**,** click **Download,** and enable**.
2. **Configure Settings:**
    - Go to **Administration settings** &gt; **ONLYOFFICE**.
    - **Document Editing Service address:** `https://office.goonersnas.com/`
    - **Secret key:** `SecretGoonersKey123`
    - Click **Save**.

---

<div id="bkmrk-important%3A-if-you-se" style="background-color: #fff3cd; border-left: 5px solid #ffeeba; padding: 15px; margin: 20px 0; color: #856404; border-radius: 4px;">**IMPORTANT:** If you see a red error banner stating "Mixed Active Content is not allowed," it means your Nextcloud (`https`) is trying to talk to an insecure ONLYOFFICE address (`http`). **Always** use the secure public subdomain URL in the Nextcloud settings to resolve this.</div>---

### Verification

To verify the installation, navigate to your **Files** app and create a new **Document**. If the editor loads the Word-style interface, the integration is successful.