Skip to content

Instantly share code, notes, and snippets.

@SajidK25
Created October 28, 2025 12:41
Show Gist options
  • Select an option

  • Save SajidK25/905db6a234f7bef1162ef722799b0a70 to your computer and use it in GitHub Desktop.

Select an option

Save SajidK25/905db6a234f7bef1162ef722799b0a70 to your computer and use it in GitHub Desktop.

Integrating OnlyOffice with Nextcloud Slim Setup

Introduction

My name is Sajid Khan, a Top Rated Fiverr professional and Backend & DevOps Engineer with over 8 years of experience in building scalable, containerized applications. I specialize in C#, Java, Python, PHP, ASP.NET Core, Laravel, React, Docker, Kubernetes, virtualization, Ansible, Heroku, Railway, Render, Vercel, Netlify, AWS, GCP, Azure, and more. As a Certified Google Cloud, AWS, Azure, and Agile Professional, I excel at designing, developing, and deploying robust architectures that ensure seamless performance and reliability. I've successfully integrated document editing solutions like OnlyOffice into Nextcloud environments for multiple clients, optimizing for Docker Compose stacks and environment-driven configurations.

After reviewing your repository and the requirements outlined in Issue #9, I fully understand your goal: to enhance your local "slim" Nextcloud Murena Workspace with OnlyOffice integration. This will enable default document editing capabilities (DOCX, XLSX, PPTX) via a pre-installed app, env-var configuration, shared PostgreSQL DB patching, service addition, and sample files—all while maintaining your env-only config philosophy and ensuring HTTP/HTTPS compatibility. I'm excited to deliver a turnkey solution that passes all your specified tests, with clean commits to your slim branch for easy review and merge. Below, I'll outline the full scope, timeline, and pricing.

Project Understanding & Requirements

Your project requires extending the existing Docker-based Nextcloud setup (using slim.Dockerfile for multi-stage FPM/Nginx builds, docker-compose.local.yml for local services, and env-driven configs like pgsql_ssl.config.php) to include OnlyOffice Document Server. Key focuses:

Env-Only Management: All configurations via ONLYOFFICE_ prefixed environment variables (loaded dynamically, similar to your PostgreSQL SSL config).

Local Stack Integrity: No disruptions to existing services (DB, Redis, Syslog, Nextcloud, Nginx); reuse shared PostgreSQL for OnlyOffice DB.

Auto-Setup: App installs/enables by default on fresh builds; no manual admin intervention for users.

Testing: Comprehensive validation per your tests, including README compatibility and seamless edit/save flows.

Detailed Tasks

  1. Install Nextcloud OnlyOffice App by Default

    • Download and integrate the latest OnlyOffice app (v9.11.0 as of Oct 2025) into slim.Dockerfile using your existing curl/tar pattern (ARG for URL, place in /apps/onlyoffice for occ enablement).
    • Ensure it pre-installs during image build, auto-enables via hooks post-init.
  2. Configure OnlyOffice on Nextcloud with ONLYOFFICE_ Environment Variables

    • Add support for prefixed env vars (e.g., ONLYOFFICE_DOCUMENT_SERVER_URL, ONLYOFFICE_JWT_SECRET) in a new hook script (hooks.d/99-onlyoffice-setup.sh).
    • Use php occ config:app:set to apply settings dynamically (with defaults), mirroring getenv() style in config/nextcloud/pgsql_ssl.config.php.
    • Update .env.example with new vars; ensure overrides work without hardcoding.
  3. Patch PostgreSQL Container Init to Create OnlyOffice DB

    • Add an idempotent init script (config/postgres/init-onlyoffice.sql) mounted to /docker-entrypoint-initdb.d/ in docker-compose.local.yml.
    • Creates onlyoffice DB/user with env-password fallback (e.g., ${ONLYOFFICE_DB_PASSWORD}), following Postgres Docker Hub initialization scripts.
    • Reuses your existing db service (Postgres 16.10-alpine) for shared access.
  4. Add OnlyOffice Services to docker-compose.local.yml

    • Introduce documentserver service using onlyoffice/documentserver:latest image.
    • Configure with shared DB (internal db hostname), JWT from env, volumes for data/logs, and port 8081:80.
    • Integrate into worker-network; add healthcheck/depends_on for reliability.
    • Example alignment: Based on official OnlyOffice Docker Compose, but slimmed for your stack.
  5. Add 3 Default Relevant Samples (DOC, XLS, PPT)

    • Create samples/office-samples/ dir in repo with blank files: welcome.docx (simple text), sheet.xlsx (basic table), presentation.pptx (single slide).
    • Copy to skeleton in slim.Dockerfile (around L28 style: COPY ... /core/skeleton/files_samples/), chown to www-data.
    • Auto-appear in Nextcloud Files app post-install for immediate testing.

Comprehensive Tests

To ensure quality, I'll validate against your exact criteria:

  1. Local Instance via README: Run docker compose up -d --build per README; confirm full stack starts (http://localhost:8000 accessible, no errors).

  2. Load Documents Post-Fresh Install: Samples load in OnlyOffice viewer/editor without admin action in slim Murena Workspace.

  3. Edit & Save Documents: Full round-trip: Edit .docx/.xlsx/.pptx in OnlyOffice, save, and verify sync back to Nextcloud Files.

  4. Env Var Overrides: Set custom ONLYOFFICE_ in .env; restart confirms app uses env values (not defaults), validated via Settings > OnlyOffice.

  5. Main Docker Compose Minimalism: Only add new ONLYOFFICE_* envs to your production docker-compose.yml (no services/DB—assume external OnlyOffice).

  6. HTTP/HTTPS Reachability: Local: HTTP on port 8081; staging/prod: HTTPS via env URL (e.g., https://documentserver:443), with app validation.

Scope of Work

  • Phase 1: Planning & Setup (Day 1): Audit repo/files, update .env.example, implement Task 1 (app install) and Task 5 (samples) in slim.Dockerfile.
  • Phase 2: Core Integration (Days 2-3): Handle Tasks 2-4 (config script, DB patch, services); add volumes/networks to compose; implement hook for occ setup.
  • Phase 3: Testing & Refinement (Days 4-5): Run all 6 tests; fix any issues; update README.md with OnlyOffice section; push commits to a feature branch for your review/merge.
  • Deliverables:
    • Updated slim.Dockerfile, docker-compose.local.yml, new configs/scripts/samples.
    • Tested .env.example with OnlyOffice vars.
    • README updates and test verification logs/scripts.
    • 1 revision round included; source code handover via GitLab.
  • Exclusions: Production deployment (local/slim focus); custom themes beyond Murena; external OnlyOffice hosting setup.

Timeline

Duration: 5 working days.

Day 1: Initial commits (app/samples). Days 2-3: Full integration. Days 4-5: Testing, polish, handover.

Pricing

Total Cost: $365 (fixed price for full scope).

I'm confident this will exceed your expectations and supercharge your Nextcloud workspace with seamless OnlyOffice editing. Let's discuss any tweaks or questions—I'm available for a quick call to align. Looking forward to collaborating!

Best regards,

Sajid Khan

Top Rated Plus | Backend & DevOps Engineer

Certified: Google Cloud, AWS, Azure, Agile

[Fiverr Profile] | [Portfolio/GitHub]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment