Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f091cc8c0b | |||
| 2872d70653 | |||
| 1a333d161b | |||
| 827b2d10dd | |||
| 20bdb7dcd6 | |||
| c2186ce2ea | |||
| f4395d8dda |
@@ -30,5 +30,8 @@ js/*.log
|
|||||||
.env
|
.env
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
|
# Internal deploy notes (hostnames, paths) - never publish these
|
||||||
|
notes/
|
||||||
|
|
||||||
# Misc logs
|
# Misc logs
|
||||||
*.log
|
*.log
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
# Installing/updating occweb on Nextcloud AIO (Docker)
|
||||||
|
|
||||||
|
Nextcloud's official All-in-One (AIO) distribution runs core in its own container
|
||||||
|
(`nextcloud-aio-nextcloud` by convention), so the generic [install instructions](README.md)
|
||||||
|
(`git clone` straight into the server) don't apply as-is. This covers the differences.
|
||||||
|
|
||||||
|
## Where the app belongs
|
||||||
|
|
||||||
|
`/var/www/html/custom_apps/` inside the core container — **not** `/var/www/html/apps/`.
|
||||||
|
AIO's `config.php` sets `apps_paths` with `apps/` as `writable: false` (managed by
|
||||||
|
Nextcloud's own core/appstore sync, which can overwrite custom code placed there) and
|
||||||
|
`custom_apps/` as `writable: true` — the intended location for third-party apps like
|
||||||
|
this one.
|
||||||
|
|
||||||
|
## Deploy/update procedure
|
||||||
|
|
||||||
|
The AIO container has no working git access to GitHub, so deploy a tarball instead of
|
||||||
|
`git clone`/`git pull` inside it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. On your machine: clean checkout of the branch/tag you want, dev files stripped
|
||||||
|
STAGE=$(mktemp -d)
|
||||||
|
git archive main | tar -x -C "$STAGE"
|
||||||
|
rm -rf "$STAGE"/{tests,.travis.yml,phpunit.xml,phpunit.integration.xml,composer.json,composer.lock,Makefile}
|
||||||
|
tar -C "$STAGE" -cf /tmp/occweb-deploy.tar .
|
||||||
|
|
||||||
|
# 2. Copy it onto the Docker host, then into the container
|
||||||
|
scp /tmp/occweb-deploy.tar <docker-host>:/tmp/occweb-deploy.tar
|
||||||
|
ssh <docker-host> "docker cp /tmp/occweb-deploy.tar nextcloud-aio-nextcloud:/tmp/occweb-deploy.tar && \
|
||||||
|
docker exec nextcloud-aio-nextcloud sh -c 'mkdir -p /var/www/html/custom_apps/occweb && \
|
||||||
|
tar -xf /tmp/occweb-deploy.tar -C /var/www/html/custom_apps/occweb && rm /tmp/occweb-deploy.tar'"
|
||||||
|
|
||||||
|
# 3. Fix ownership - tar preserves the source uid/gid, not www-data
|
||||||
|
ssh <docker-host> "docker exec nextcloud-aio-nextcloud chown -R www-data:www-data /var/www/html/custom_apps/occweb"
|
||||||
|
|
||||||
|
# 4. Fresh install only (skip when updating an already-enabled app):
|
||||||
|
ssh <docker-host> "docker exec -u www-data nextcloud-aio-nextcloud php occ app:enable occweb"
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Gotcha**: never copy a file into a container with `ssh host "docker exec container bash -c 'cat > file'"`
|
||||||
|
> piped from local stdin — that produces an empty file. Always `scp` to the host, then
|
||||||
|
> `docker cp` into the container, as above.
|
||||||
|
|
||||||
|
## ⚠️ Critical after bumping `<version>` in `appinfo/info.xml`
|
||||||
|
|
||||||
|
This step is **not optional** — skipping it doesn't just block occ commands, it can
|
||||||
|
block **logging into the web UI entirely** (Nextcloud shows an upgrade screen to every
|
||||||
|
user instead of the login page).
|
||||||
|
|
||||||
|
Nextcloud tracks each app's installed version in the database (`installed_version` in
|
||||||
|
`oc_appconfig`), separately from `<version>` in `info.xml`. If you replace files in place
|
||||||
|
(instead of going through the app store or `occ upgrade`), those two fall out of sync,
|
||||||
|
and Nextcloud puts the whole instance into a "needs upgrade" state until you sync it
|
||||||
|
manually:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh <docker-host> "docker exec -u www-data nextcloud-aio-nextcloud php occ config:app:set occweb installed_version --value='X.Y.Z'"
|
||||||
|
```
|
||||||
|
|
||||||
|
(use the same `X.Y.Z` as the new `<version>`). Verify with `occ status` that
|
||||||
|
`needsDbUpgrade: false` again.
|
||||||
|
|
||||||
|
## Restart PHP-FPM after every deploy
|
||||||
|
|
||||||
|
`occ app:disable`/`app:enable` does not clear PHP's opcache — an update can silently
|
||||||
|
fail to take effect without a restart (routes 404ing is the typical symptom). Prefer a
|
||||||
|
graceful reload over a hard restart (keeps in-flight requests alive):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh <docker-host> "docker exec nextcloud-aio-nextcloud ps aux | grep 'php-fpm: master'" # find the PID
|
||||||
|
ssh <docker-host> "docker exec nextcloud-aio-nextcloud kill -USR2 <master-pid>"
|
||||||
|
```
|
||||||
|
|
||||||
|
`supervisorctl` won't work directly inside this container (its socket isn't at the
|
||||||
|
default path) — hence the manual PID lookup.
|
||||||
|
|
||||||
|
## Removing the app
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh <docker-host> "docker exec -u www-data nextcloud-aio-nextcloud php occ app:disable occweb && \
|
||||||
|
docker exec nextcloud-aio-nextcloud rm -rf /var/www/html/custom_apps/occweb"
|
||||||
|
```
|
||||||
|
|
||||||
|
## `max-version` policy
|
||||||
|
|
||||||
|
See the comment next to `<dependencies>` in `appinfo/info.xml`: it must always equal the
|
||||||
|
highest Nextcloud core version this fork has actually been verified against — never a
|
||||||
|
value inherited from upstream, and never a guess ahead of what's been tested. Test
|
||||||
|
against the next major's beta ahead of time and bump it before that major goes final,
|
||||||
|
rather than reacting after the fact.
|
||||||
|
|
||||||
|
## SQL query mode
|
||||||
|
|
||||||
|
Type `sql` in the OCCWeb terminal to run raw SQL directly against the Nextcloud
|
||||||
|
database. Separate statements with `;`, use Shift+Enter for a new line and Enter to run.
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
### A web terminal for admins to launch Nextcloud's occ commands
|
### A web terminal for admins to launch Nextcloud's occ commands
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## About this fork
|
## About this fork
|
||||||
|
|
||||||
@@ -33,12 +33,15 @@ has background on why Nextcloud has no native async support for occ tasks.
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
Running Nextcloud AIO (Docker)? See [INSTALL-AIO.md](INSTALL-AIO.md) instead — the app
|
||||||
|
path and deploy steps differ from the generic instructions below.
|
||||||
|
|
||||||
No build step required (plain PHP + vanilla JS). Clone straight into the
|
No build step required (plain PHP + vanilla JS). Clone straight into the
|
||||||
target server's `apps/` directory and run the install script:
|
target server's `apps/` directory and run the install script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /var/www/nextcloud/apps
|
cd /var/www/nextcloud/apps
|
||||||
git clone https://github.com/fanategorius/occweb.git
|
git clone https://github.com/dillardblom/occweb.git
|
||||||
bash occweb/install.sh
|
bash occweb/install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -128,5 +131,21 @@ sudo -u www-data php /var/www/nextcloud/occ config:app:set occweb installed_vers
|
|||||||
This does not apply on a fresh `occ app:enable` install — that command sets
|
This does not apply on a fresh `occ app:enable` install — that command sets
|
||||||
`installed_version` correctly on its own.
|
`installed_version` correctly on its own.
|
||||||
|
|
||||||
|
## Compatibility matrix
|
||||||
|
|
||||||
|
`max-version` in `appinfo/info.xml` only ever reflects the highest version we've actually
|
||||||
|
tested (see the policy comment right above it) - this table is the actual history of what
|
||||||
|
was verified, so a rollback target is obvious if a newer major causes problems.
|
||||||
|
|
||||||
|
| occweb version | Tag | NC version tested | Result |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 0.3.4 | `v0.3.4` | 33.0.8 | ✅ Verified (nc01, 2026-09-25) |
|
||||||
|
| 0.3.4 | `v0.3.4` | 34.0.4 | ❌ Blank terminal - global jQuery gone on NC34 (`jQuery is not defined`), then a 412 "CSRF check failed" on every ajax call once jQuery was vendored. Fixed in 0.3.5. |
|
||||||
|
| 0.3.5 | `v0.3.5-nc34` | 34.0.4 | ✅ Verified (nc01, 2026-09-26) - vendors its own jQuery + sends the CSRF `requesttoken` header explicitly on every ajax call |
|
||||||
|
| 0.3.5 | `v0.3.5-nc34` | 33.0.8 | ⚠️ Believed compatible (the 0.3.5 change is additive-only, nothing removed that NC30-33 depended on) but not re-verified - nc01 no longer runs NC33 to test against |
|
||||||
|
|
||||||
|
If a future major breaks something, `git checkout v0.3.4` is the last version confirmed
|
||||||
|
working on NC33 and older.
|
||||||
|
|
||||||
## TODOs:
|
## TODOs:
|
||||||
See [open issues](https://github.com/dillardblom/occweb/issues)
|
See [open issues](https://github.com/dillardblom/occweb/issues)
|
||||||
|
|||||||
+7
-2
@@ -5,7 +5,7 @@
|
|||||||
<name>Extended OCC Web</name>
|
<name>Extended OCC Web</name>
|
||||||
<summary>OCC Commands in a web terminal</summary>
|
<summary>OCC Commands in a web terminal</summary>
|
||||||
<description><![CDATA[Run OCC Commands in a web terminal]]></description>
|
<description><![CDATA[Run OCC Commands in a web terminal]]></description>
|
||||||
<version>0.3.4</version>
|
<version>0.3.5</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="dillard.blom@ensembia.com" >Dillard Blom</author>
|
<author mail="dillard.blom@ensembia.com" >Dillard Blom</author>
|
||||||
<namespace>OCCWeb</namespace>
|
<namespace>OCCWeb</namespace>
|
||||||
@@ -15,7 +15,12 @@
|
|||||||
<repository>https://github.com/dillardblom/occweb</repository>
|
<repository>https://github.com/dillardblom/occweb</repository>
|
||||||
<screenshot>https://github.com/dillardblom/occweb/raw/main/appinfo/screenshot.png</screenshot>
|
<screenshot>https://github.com/dillardblom/occweb/raw/main/appinfo/screenshot.png</screenshot>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="30" max-version="33"/>
|
<!-- max-version must equal the highest NC core version this fork has
|
||||||
|
actually been verified on - never a value inherited from upstream
|
||||||
|
or guessed ahead. Test against the next major's beta and bump
|
||||||
|
this BEFORE it goes final, so occ:upgrade never has to fall back
|
||||||
|
to auto-disabling the app. -->
|
||||||
|
<nextcloud min-version="30" max-version="34"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<navigations>
|
<navigations>
|
||||||
<navigation role="admin">
|
<navigation role="admin">
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Adphi"
|
"name": "Adphi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Dillard Blom",
|
||||||
|
"email": "dillard.blom@ensembia.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {},
|
"require": {},
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
# Post-clone install script for occweb.
|
# Post-clone install script for occweb.
|
||||||
#
|
#
|
||||||
# Usage (from nextcloud/apps/):
|
# Usage (from nextcloud/apps/):
|
||||||
# git clone https://github.com/fanategorius/occweb.git
|
# git clone https://github.com/dillardblom/occweb.git
|
||||||
# bash occweb/install.sh [nextcloud-root] [web-user]
|
# bash occweb/install.sh [nextcloud-root] [web-user]
|
||||||
#
|
#
|
||||||
# Defaults: nextcloud-root=/var/www/nextcloud, web-user=www-data
|
# Defaults: nextcloud-root=/var/www/nextcloud, web-user=www-data
|
||||||
|
|||||||
+10
-1
@@ -1,6 +1,13 @@
|
|||||||
(function (OC, window, $, undefined) {
|
(function (OC, window, $, undefined) {
|
||||||
'use strict';
|
'use strict';
|
||||||
$(function() {
|
$(function() {
|
||||||
|
// Nextcloud core only auto-attaches the CSRF requesttoken header to ajax
|
||||||
|
// calls made through its own globally-loaded jQuery. Since NC34 that
|
||||||
|
// global jQuery is no longer guaranteed to be the one still active by
|
||||||
|
// the time our own calls fire (other apps loading their own jQuery can
|
||||||
|
// replace window.jQuery afterwards - see js/jquery.js), ajaxSetup() here
|
||||||
|
// isn't reliable; every $.ajax() call below sets the header explicitly.
|
||||||
|
|
||||||
function scrollToBottom(){
|
function scrollToBottom(){
|
||||||
var html = $('html');
|
var html = $('html');
|
||||||
html.scrollTop(html.prop('scrollHeight'));
|
html.scrollTop(html.prop('scrollHeight'));
|
||||||
@@ -287,6 +294,7 @@
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
timeout: SQL_REQUEST_TIMEOUT_MS,
|
timeout: SQL_REQUEST_TIMEOUT_MS,
|
||||||
|
headers: { requesttoken: OC.requestToken },
|
||||||
data: JSON.stringify({ sql: sql, confirm: !!confirmed })
|
data: JSON.stringify({ sql: sql, confirm: !!confirmed })
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
if (response && response.requiresConfirmation) {
|
if (response && response.requiresConfirmation) {
|
||||||
@@ -319,7 +327,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$.get(baseUrl + '/cmd', function(response){
|
$.ajax({ url: baseUrl + '/cmd', headers: { requesttoken: OC.requestToken } }).done(function(response){
|
||||||
$('#app-content').terminal(function(command, term) {
|
$('#app-content').terminal(function(command, term) {
|
||||||
if (mode === 'sql') {
|
if (mode === 'sql') {
|
||||||
var trimmed = command.trim();
|
var trimmed = command.trim();
|
||||||
@@ -375,6 +383,7 @@
|
|||||||
url: baseUrl + '/cmd',
|
url: baseUrl + '/cmd',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
|
headers: { requesttoken: OC.requestToken },
|
||||||
data: JSON.stringify(occCommand)
|
data: JSON.stringify(occCommand)
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
term.echo('\n' + response).resume();
|
term.echo('\n' + response).resume();
|
||||||
|
|||||||
Vendored
+2
File diff suppressed because one or more lines are too long
@@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Nextcloud's global jQuery has been deprecated since NC19 and is no longer
|
||||||
|
// reliably present on NC34+ (see e.g. serverinfo needing to bundle its own) -
|
||||||
|
// term.js (jquery.terminal) and index.js both require jQuery to be loaded
|
||||||
|
// first, so ship and load our own copy rather than relying on core.
|
||||||
|
script('occweb', 'jquery');
|
||||||
script('occweb', 'index');
|
script('occweb', 'index');
|
||||||
script('occweb', 'term');
|
script('occweb', 'term');
|
||||||
script('occweb', 'unix_formatting');
|
script('occweb', 'unix_formatting');
|
||||||
|
|||||||
Reference in New Issue
Block a user