Skip to content

Commit

Permalink
fixup! feat(devsetup): Add step by step guide for a development setup
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Sep 15, 2024
1 parent 25fd94c commit 01f80fd
Showing 1 changed file with 55 additions and 2 deletions.
57 changes: 55 additions & 2 deletions docs/developer-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Nextcloud Talk delivers private audio/video conferencing and text chat through b
There are many ways of running Nextcloud for development purposes. In the following guide we are using a docker based installation of Nextcloud. The following components are required:

* A working docker installation (see https://docs.docker.com/engine/install/)
* Node.js >= 20 and NPM >= 10
* Node.js >= 20 and NPM >= 10 (optionally, see _Prepare Nextcoud Talk for development_ below for an alternative)
* PHP Composer (optionally, see _Prepare Nextcoud Talk for development_ below for an alternative)
* Git

## Install the development environment
Expand Down Expand Up @@ -96,7 +97,11 @@ Enter the Nextcloud Talk directory and install the required components for devel
```
cd workspace/server/apps-extra/spreed
make dev-setup
make build-js
```

If you do not have NPM, Node or Composer you can run all of them from inside the container instead (note that they will be run as root, so the file owner of the created files will be also root):
```
docker compose exec nextcloud bash --login -c "cd /var/www/html/apps-extra/spreed && make dev-setup"
```

## Start Nextcloud
Expand Down Expand Up @@ -179,3 +184,51 @@ The provided `docker-compose.yml` file from `nextcloud-docker-dev` supports spin
```

6. Enable federation in the admin settings of Nextcloud Talk.

### Rebuild / update Talk after code changes

#### JavaScript

If you modify any JavaScript file, either directly or by switching to a different branch, you will need to rebuild them. You can do that with:

```
cd workspace/server/apps-extra/spreed
make build-js
```

For JavaScript development rather than manually rebuilding the files whenever you modify them you can instead run a watcher that will automatically rebuild them when they are changed:
```
cd workspace/server/apps-extra/spreed
make watch-js
```

Note, however, that in some cases the watcher may stop running (for example, if it gets killed by the system after some time due to its RAM consumption), so you might want to check it from time to time.

No matter if you manually rebuilt the JavaScript files or if you use the watcher note that you will need to force refresh Talk in the browser, as otherwise the previous version of the build JavaScript files could be cached and used instead of the latest one.

Besides manually force refreshing the page you can disable the cache in the _Network_ tab of the developer tools of the browser, but keep in mind that it will only have effect if the developer tools are open (and the _Network_ tab might need to be open once after the developer tools were open, even if the cache was already disabled).

In the case of Firefox you can disable the cache in all cases by opening `about:config` and setting `browser.cache.disk.enable` and `browser.cache.memory.enable` to `false`.

If you do not have NPM or Node you can rebuild the JavaScript files from inside the container instead (like before, note that the file owner of the created files will be also root):
```
docker compose exec nextcloud bash --login -c "cd /var/www/html/apps-extra/spreed && make build-js"
```

Or, in the case of the watcher, with:
```
docker compose exec nextcloud bash --login -c "cd /var/www/html/apps-extra/spreed && make watch-js"
```

#### PHP dependencies

PHP files themselves do not need to be rebuilt, although if the PHP dependencies change they need to be updated. Note that this does not happen frequently, so in most cases you can switch to another branch without needing to update the PHP dependencies. Nevertheless, if the PHP dependencies changed (that is, if the `composer.lock` file changed) you can update them with:
```
cd workspace/server/apps-extra/spreed
make composer-install-dev
```

If you do not have Composer you can update the PHP dependencies from inside the container instead (like before, note that the file owner of the created files will be also root):
```
docker compose exec nextcloud bash --login -c "cd /var/www/html/apps-extra/spreed && make composer-install-dev"
```

0 comments on commit 01f80fd

Please sign in to comment.