Content
NextcloudHub setup
How to setup an development setup with NC hub (docker based)
Goal
-
have a local setup, where once can change the branches for the NC apps
-
oidc
-
user_oidc
-
integration_openproject
-
-
this allows to have a setup, where one can test or develop against current WIP branches of each of those apps
Context
-
we use a docker based setup to reduce any build and run dependencies and simulate the TLS behaviour of a production environment
-
this setup is build upon the setup of the Integration OpenProject app
- we only use the compose files from this repository, so the following steps can easily be amended with an own compose file
Steps
- Pick any location on your system, called
$NC_PATH
in this guide
# Change to directory and create custom apps subdirectory
cd $NC_PATH
mkdir -p development/custom_apps
# Clone all needed apps
git clone git@github.com:nextcloud/integration_openproject.git
git clone git@github.com:nextcloud/user_oidc.git
git clone git@github.com:H2CK/oidc.git
-
go to any repository and switch to the branch you want to run
- you can switch the branch anytime in future, then the build step needs to be repeated, alongside with setting the correct ownership
-
build
integration_openproject
app
# Change into app directory
cd $NC_PATH/development/custom_apps/integration_openproject
# Run build in node container
docker run -it --rm -v "$(pwd):$(pwd)" -w "$(pwd)" node:22-alpine npm ci
docker run -it --rm -v "$(pwd):$(pwd)" -w "$(pwd)" node:22-alpine npm ci
-
for the other two apps
php
andcomposer
are needed besidesnode
and a couple of other dependencies -
build a simple image with all dependencies
-
create a
Dockerfile
with the following code at$BUILD_NC_APPS
(again, you need to choose any location on your file system)
FROM composer:2
LABEL authors="openproject"
COPY --from=node:22-alpine /usr/local/bin /usr/local/bin
COPY --from=node:22-alpine /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/npm
RUN npm install -g webpack@5.98.0
RUN npm install -g webpack-cli@6.0.1
RUN apk add rsync
-
now build the image with a useful tag - e.g.
nextcloud_app_builder
:- run
docker build $BUILD_NC_APPS -t nextcloud_app_builder
- run
-
build
oidc
app
# Change into app directory
cd $NC_PATH/development/custom_apps/oidc
# Ensure you have built the builder image
# Run build in nextcloud_app_builder
docker run -it --rm -v "$(pwd):$(pwd)" -w "$(pwd)" nextcloud_app_builder make composer
docker run -it --rm -v "$(pwd):$(pwd)" -w "$(pwd)" nextcloud_app_builder make build
- build
user_oidc
app
# Change into app directory
cd $NC_PATH/development/custom_apps/user_oidc
# Ensure you have built the builder image
# Run build in nextcloud_app_builder
docker run -it --rm -v "$(pwd):$(pwd)" -w "$(pwd)" nextcloud_app_builder composer install --no-dev -o
docker run -it --rm -v "$(pwd):$(pwd)" -w "$(pwd)" nextcloud_app_builder npm ci
docker run -it --rm -v "$(pwd):$(pwd)" -w "$(pwd)" nextcloud_app_builder npm run build
- after build created a lot of new files, we need to change the ownership of all those files to the
www-data
user group
# Change into custom apps directory
cd $NC_PATH/development/custom_apps
# Run build in nextcloud_app_builder
sudo chgrp www-data . -R
sudo chmod g+w . -R
-
now, with all the building done, we need to install and configure our nextcloud instance
-
most of this is done from the compose file within the
integration_openproject
app repo-
be sure to configure correctly your compose file with the override files
-
this is not part of this guide
-
# Change into integration app directory
cd $NC_PATH/development/custom_apps/integration_openproject
# Up the stack
docker compose up -d
# Initialize the instance, which can be done usually by
# opening the instance in the browser
# Configure the instance with occ
docker compose exec --user www-data nextcloud php occ config:system:set allow_local_remote_servers --value 1
docker compose exec --user www-data nextcloud php occ security:certificates:import /etc/ssl/certs/ca-certificates.crt
# Enable all apps
docker compose exec --user www-data nextcloud php occ a:e integration_openproject
docker compose exec --user www-data nextcloud php occ a:e user_oidc
docker compose exec --user www-data nextcloud php occ a:e oidc