Skip to content

Local Development Setup

Juri edited this page Oct 21, 2024 · 4 revisions

This will walk you through the process of setting up a local, Nextcloud-integrated development setup for RDS-NG.

Some hints:

  • The Frontend hot reloads, the (python) backend doesn't. If you change Python code, you'll have to restart the make dev-run.

Directory structure

make directories

mkdir Nextcloud
mkdir Nextcloud/custom_apps
mkdir nextcloud

Clone the NC App:

git clone https://github.com/Sciebo-RDS/rds-ng-nextcloud.git

Clone RDS-ng next to it

git clone https://github.com/Sciebo-RDS/rds-ng.git

you should have the following structure:

/
/nextcloud.sh
/rds-ng (repo)
/rds-ng-nextcloud (repo)
/Nextcloud/custom_apps (empty)
/nextcloud (empty)

Deploy Nextcloud

Replace the curly brackets and run the following nextcloud.sh script:

#!/bin/bash
docker stop nextcloud
docker rm -f nextcloud
docker run -d -p 8080:80 \
--name nextcloud \
-e NEXTCLOUD_ADMIN_USER=admin \
-e NEXTCLOUD_ADMIN_PASSWORD=admin \
-v nextcloud:/var/www/html \
-v {PATH TO}/Nextcloud/custom_apps:/var/www/html/custom_apps \
-v {PATH TO}/rds-ng-nextcloud:/var/www/html/custom_apps/rdsng \
nextcloud:29

docker exec -w /var/www/html/custom_apps/rdsng nextcloud make build
docker exec -u 33 nextcloud /var/www/html/occ config:system:set trusted_domains 10 --value={YOURIP}
docker exec -u 33 nextcloud /var/www/html/occ config:system:set overwritehost --value={YOURIP}:8080

Fix apps folder permissions:

(inside NC Container)

chown -R www-data:www-data custom_apps/

Configure NC to use RDS-ng

  1. Go to localhost:8080, login with admin/admin or register new admin account

  2. In the NC Menu, go to Apps/Disabled Apps, enable RDS-ng

  3. Go to Settings/Security, add new OAUTH Client (don't lose the Client Secret!).

    • Redirect URL: http://localhost:8080/apps/rdsng/main
  4. Go to Administration Settings -> RDS NG, set RDS NG URL to http://localhost:8000

Deploy RDS-ng

  1. copy example env files, create rds-ng/.data directory (holds the sqlite database as long as you use sqlite instead of mysql for RDS-ng)
cp rds-ng/deployment/containers/env/examples/* rds-ng/deployment/containers/env
  1. Set ClientID and Secret that you got when registering the OAUTH Client to Nextcloud. (dev.server.env, dev.frontend.env etc)

    • RDS_AUTHORIZATION_OAUTH2_CLIENT_ID in dev.frontend.env
    • RDS_AUTHORIZATION_OAUTH2_SECRETS_HOST in dev.server.env
    • in dev.frontend.env: RDS_INTEGRATION_DEFAULT_ROOT_PATH should be commented out
    • -> (Repository secrets/client IDs are set in the corresponding dev.{repository}.env files. To use these, you will have to register accounts at test.osf.io and sandbox.zenodo.org and create OAUTH Apps with them)
  2. Enter deployment directory

cd rds-ng/deployment/containers
  1. run dev-environment
make dev-run
  1. Open the RDS App from NC.

Warning

You have to use localhost:8080, your local IP won't work! NC tends to redirect you to the IP. If that happens, you'll have to replace the IP with localhost.

Clone this wiki locally