Tutorial: How to set up a Nextcloud development environment on Mac or Ubuntu?

Hello hello!

We have been working on a tutorial on how to set up a Nextcloud development environment using the docker of juliusheartl. As the steps differ quite a bit depending on the operating system, we made a tutorial for Ubuntu and Mac users.

You can find the tutorial here:
https://cloud.nextcloud.com/s/iyNGp8ryWxc7Efa

How difficult is it?
Well, it depends on your environment. If you have a fresh install, the tutorials should be reliable and straightforward. We also tested the tutorials with some people who already had other environments running on their computer, but those conflicted.

Tutorials for other operating systems
We are hoping for contributions of tutorials of a similar structure for other operating systems!
Edit: A windows tutorial is available too. See here for more information.

Edit2:
A video tutorial for Mac is available! See here:
https://youtu.be/9RE2tR1y8DQ

We really hope this will be helpful for some of you :pray:

9 Likes

Great job! This is certainly a much better experience than I had bootstrapping my first app back then. Very approachable :+1:

2 Likes

Thank you so much. This is really very helpful for me. I am looking forward to further tutorials.

The ports 80 an 443 are exposed to the world. It would be better to restrict them to localhost. How can I do this?

1 Like

You can simply change these lines of the docker-compose.yaml nextcloud-docker-dev/docker-compose.yml at 2cec861c04154536f4f6402a455f345de80271e8 · juliushaertl/nextcloud-docker-dev · GitHub to

- "127.0.0.1:80:80"
- "127.0.0.1:443:443"
3 Likes

The main blog post on https://nextcloud.com/blog/nextcloud-app-development-tutorials/ does not mention windows. That might be fixed with an update comment, eventually.

Hey! Thanks for the tutorials. I downloaded the skeleton-app from here but there is no simple example app - the skeleton-app is the note-example-app from the docs. I think this is not correct and the skeleton-app should be a simple vue-example-NC-App and not a complete writen app. Pls fix it…thx! And btw: It is so hard to dive into app-dev for NC! Old docs and the new tutorials are not well developed. Pls update to make it easier to follow. A simple app-video-course with Vue.js and the new designpatterns of NC would be very helpful.

I asked something similar here: Is there a "cleaner" app generator?

I must say that I did the tutorials and they were extremely easy to follow. You literally just have to do what they instruct you to do, and each step is explained fairly well and so on. Perhaps you need to give them a fair chance. There are also videos in them, but I haven’t looked at those.

Once you did those tutorials and thereby got a feel for how you build the basics of an app, you can make use of the NC API documentation at https://nextcloud-server.netlify.app/ (in there, you should be looking specifically at the interfaces listed in Nextcloud PHP API (master) - since NC uses dependency injection, these interfaces are what you can use at the end of the day). Also, the search box at the top right is highly recommended!

At the same time you will reference the developer documentation at Nextcloud developer documentation — Nextcloud latest Developer Manual latest documentation to learn more about a lot of different features and how to do stuff, e.g. background jobs, database migrations if you need to create your own tables, authentication and routing, etc, etc. Make sure to really noodle around in here, and don’t miss the “Digging deeper” section, as all of this documentation might seem daunting and somewhat unorganized at first, but once you noodled around a bit it is not that bad.

Of course another thing to do is to look at how other apps does their job, there’s plenty of code examples there.

Regardless, you probably just need to give it a bit more time and systematic approach.

2 Likes

He! Thx for the reply. The tutorials does not explain the code-content. Its just something like “do this and do that”. But the detailed why? isn’t explained. To read the docs should never be the first point to start with a complete new content, because you do not know what to look for. I’am teaching programming for twelve years and if i would start my lessons with: Look at the django-Docs, you find everything there! - which student would and could follow me?

There should be a tutorial like “Let’s create a basic Navigation in NC with Vue.js and switch between three sides” or something like that. A next step: “how we can store data to the database”. Yes, it could be learned with the Note-Example on a very hard way (also missing code-explanations!) but there are a lot of ways to make the start much easier. I love the work of the NC-Team so pls do not missunterstand my critics, but after tons of hours try and error there is no success either. With the “New Tutorials”-move nothing is better than before, maybe a little bit but the starting point is very, very hard…

Which tutorials did you try? Could you outline in detail which parts you felt were under explained?

I have been an educator before Nextcloud and please note that the learning goals are in the first two tutorials are only about having a general overview of the app skeleton structure. Not to explain the code in detail. That would be a potential info dump. To still provide some content, in some pieces we did include inline code comments for more details where we felt this was useful if people want to reuse the code for something else in the future.

Also please note that these tutorials are not finished yet, there will be more tutorials in the future, explaining each concept people need 1 by 1. So I am aware we did not touch upon all concepts yet. For example, the database part certainly still needs a tutorial on its own, but I don’t want to include that in the very first tutorial. The knowledge needs to be built up in a more digestible way.

I would be interested in a rewrite of you containing more explanations if you feel that would be valuable. We could include your explanations or find a place for it.

Edit: are you doing the tutorial of the notes app in the docs.nextcloud.com developer documentation or the new tutorials that are linked on Develop for Nextcloud? Because I only worked on the last ones, which will replace the notes tutorial. We might be talking across each other and not talking about the same tutorials?

1 Like

Hi Daphne! Thx for the reply. I understand that the first tutorials only give the basics, but the content of the tutorial ist only copy-paste. There is no part of explanation, why for example the skeleton-app need to paste in this dir or something like that. I did the tutorials of “Develop for Nextcloud” and the tutorial in the docs. Booth of them are ok, but after doing them it is hard to find a way.

1 Like

I honestly think you are exaggerating this. The tutorials, developer documentation and API documentation complement each other. If you are a programmer, you should have no problem learning Nextcloud app development from these resources. There is indeed parts which are not explained by these resources and where you have to go and read the Nextcloud source code, but those parts are not in the context of what you need to get started, at all.

2 Likes

Hi,
I first apologize, because my isuue is only marginally related.

I have difficulties to setup a Nextloud development environment on Ubuntu for compiling the Nextcloud desktop.
Specifically, I find no documentation how to patch Qt 5.15.2 from Download Qt: Get Qt Online Installer.
I assume my compilation fails because of a missing patch.

How do I set up such an environment?

Thank you,
Markus

This is completely unrelated. This topic is about a fake server environment for running the NC server core on developer machines.

Please open a new topic with our question.

OK, I continued this topic here:

2 Likes

I am trying to set up the development environment on ubuntu again. Opening http://nextcloud.local/ I get the following error message:

Es sieht so aus, als ob du Nextcloud erneut installieren möchtest. Es fehlt jedoch die Datei CAN_INSTALL in deinem Konfigurationsordner. Bitte erstelle die Datei CAN_INSTALL im Konfigurationsordner um fortzufahren.

I am requested to generate CAN_INSTALL, but it already exists in $HOME/nextcloud-docker-dev/workspace/server/config/ What can I do?

interesting question, the CAN_INSTALL error was gone for a while. Let me check if Julius has some clues.

It would definitiely be interesting to see the logs of your containers using docker compose logs but to keep this thread clean, maybe you could open an issue about that in GitHub - juliushaertl/nextcloud-docker-dev: Nextcloud development environment using docker-compose.

In general this file should be present in the container directly until the setup is completed. Afterwards this error may occur if the container volumes may be pruned for some reason.

You can always try to run docker compose down and start the containers from scratch using docker compose up nextcloud to start from scratch. This will prune all container data and start fresh.

1 Like