App development setup

Hello,

I want to start with app development and am currently trying to set up the development environment.

  • The official docs tell me that I should set up everything including nextcloud core and an apache server on my local machine. I don’t want to do that.
  • The workshop of sleepypioneer is quite old, but telling me to look at David-development’s docker-dev.
  • David-Development’s docker dev is basically exactly what I am looking for and even kind of recent, but it’s using nextcloud 14 and nodesource 8. If I change that to nextcloud 18 and nodesource 10 and try to run it for the ‘mail’ app, I get around 200 warnings and the following error:
app_1  | npm ERR! code 128
app_1  | npm ERR! Command failed: git clone --depth=1 -q -b 0.2.1 https://github.com/owncloud/davclient.js.git /root/.npm/_cacache/tmp/git-clone-929ff0cd
app_1  | npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-929ff0cd': Permission denied
app_1  | npm ERR! 
app_1  | 
app_1  | npm ERR! A complete log of this run can be found in:
app_1  | npm ERR!     /root/.npm/_logs/2020-02-27T03_08_37_329Z-debug.log
app_1  | make: *** [Makefile:36: install-npm-deps-dev] Error 1
  • This video series is pretty cool and it’s using docker, but it’s relying on editing code remotely via ftp limiting my freedom in choosing an IDE. It also manually installs software in an interactive docker session and needs to run a command after every container restart.

Summing up, there is one solution where I have to install everything locally, one solution which goes in the right direction, but has some serious limitations and one solution which sounds perfect but doesn’t work.

Why is it so hard? Why isn’t there an automated docker dev setup explained in the official docs to make getting started easy? Does anybody have advice for me regarding a working setup without the need to install a bunch of software on my machine?

Hello,

i assume it is hard because every developer has its own opinion how the perfect development environment should look like.

First of all let me give a few hints that maybe help you on short notice:

  • If you do not want to add a lot of software to you normal running system then a virtual machine or a second disk/partition with another system is maybe the right solution
  • Which IDE do you want to use? Remote FTP access is not such an unusual feature for an IDE.
  • I do not know how much you are into docker, but instead of accessing the code via ftp you could use a volume to access the data on the host system.

Second of all I also think, that there could be more help for new developers to setup a development environment and it would also help to discuss errors in the development process, if environments are not completely different.

Nevertheless I think it is hard to find a common solution, but maybe we can get closer by collecting, what is needed and what solutions people already use for this:

  • Operating Systems where it can be installed on:
    • Which Linuxes?
    • Windows 10?
    • MacOS?
  • IDE:
    • Standard features like Syntax highlight, code complition, refactor, …
    • Suported Language: php, javascript, …
    • Integration of Unit Test/Integration Test Runs
  • Testing
    • Running nextcloud instance
    • PHPunit
    • A javascript Unit Test Framework?
    • Several browsers on several OS to test the results?

What else is missing?
What solutions are working good for you out there? Did you use a virtual machine for that or docker or something else?

In case anybody finds this like me: The juliushaertl dev-Setup maybe okay, but it’s still pretty over the top. I think it’s what you might want when developing nextcloud itself. If you “just” want to mess around with an app, I figured out, things actually are pretty simple, just not documented.

What 95% of potential App developers probably want is the official Nextcloud container. It comes with an apache and a sqlight included. Just mount your app and you have everything you need for nextloud-app development.

So here’s your steps.

  1. install podman (or docker)
  2. setup podman for running rootless running (podman/rootless_tutorial.md at master · containers/podman · GitHub) (skip for docker)
  3. create your skeleton app (Generate app - App Store - Nextcloud)
  4. create an “apps” directory and put your app-skeleton inside it
  5. launch

Launch with podman (leaner than docker and allows you to run containers without being root):
podman run --name=nextcloud --replace=true -p 8080:80 -v /YOUR_FULL_PATH/apps:/var/www/html/custom_apps docker.io/nextcloud
Launch with docker (not tested):
sudo docker run --name=nextcloud --replace=true -p 8080:80 -v /YOUR_FULL_PATH/apps:/var/www/html/custom_apps nextcloud

Nextcloud should now run on localhost:8080. Continue with the tutorial (enable you skeleton in nextcloud …).