DE 

//Cloudogu EcoSystem Docs

Developer Guide

This article is suitable for all those who want to develop on the Cockpit Dogu. It describes all the necessary procedures from setting up the IDE to creating the dogu. Here we distinguish between changes to the Dogu and the Cockpit.

Requirements

  • It is necessary to install the following programs:

    • git - see link.
    • Node.js - see link - required version: 12.14.0
    • npm - see link - required version: ^6.13.4
    • Ruby - see link
    • SQLite - see link
    • docker-compose - see link
    • bower - npm install --global bower
    • yarn - npm install --global yarn
    • Gulp - npm install --global gulp --force / you may need to start a new shell afterwards

Setting up the development environment

  1. clone the repository:

    git clone https://github.com/cloudogu/cockpit.git

Development on the cockpit dogu

Prerequisites

  • A running Vagrant machine for the CES

Cockpit Dogu build

The build process of the Dogus is always executed in the Vagrant machine.

  1. change to the root directory of the portainer dogu (in vagrant)
  2. build the dogu

    cesapp build .

    Now the dogu should be built, updated, and started automatically.

Development on the cockpit webapp

Prerequisites

For local development, the dependencies of the webapp must be installed:

  1. cd app - change into the webapp directory
  2. yarn install - install the dependencies for the server
  3. bower install - installs the dependencies for the frontend
  4. docker-compose up - starts a PostgresSQL container

Start local development server

The gulp serve command will start a local development server. The command should automatically open the client in your browser when it completes.

Execute webapp tests

The unit tests are executed with the following commands (with help of karma). docker-compose etc are not necessary for these tests:

cd app
yarn install
yarn test

Some error tests generate an output on the error console. These can be ignored as long as the test is completed successfully.

Setup local cockpit with remote running EcoSystem CAS

Running in EcoSystem

First, the CAS development mode must be enabled by running the command etcdctl set /config/_global/stage development within the EcoSystem. After that, the CAS must be restarted.

Run locally

Set the necessary information in the file app/server/config/environment/development.js:

casEnabled: true,
fqdn: 'http://[HOST-IP]:[PORT]',
casUrl: 'https://[CAS-SERVICE-IP]/cas',
https: false

Set the environment in startup.sh to development:

NODE_ENV=development node server/

Troubleshooting (local setup):

  • If you have problems with the certificates, you can change the following entries in express.js.

    service_url: 'http://'+config.fqdn+'/cockpit',
    proxyCallback_url: 'http://'+config.fqdn+'/cockpit/api/v1/pgtCallback',

About welcome dashboards

Welcome dashboards only affect users who have never used the cockpit before (i.e. they have no dashboard copy in the database). Even after account deletion, the database retains the dashboard as well it's association to the account.

The welcome dashboard can be overwritten by values from the configuration key welcomeDashboard at container start.

The following empty dashboard is suitable for testing, since the Dogu image already includes a standard welcome dashboard in /resources/welcome.json.

{"title":"Admin-Info Box","structure":"4-8","rows":[{"columns":[{"styleClass":"col-md-4","widgets":[],"cid":"1638872597834-3"},{"styleClass":"col-md-8","widgets":[],"cid":"1638872597834-4"}]}],"dashboardId":1,"titleTemplateUrl":"app/dashboard/partials/custom-dashboard-title.html","modal":{},"pinned":false,"write Access":true,"writeAccess":true}

This dashboard can be imported using, for example, etcdctl set config/cockpit/welcomeDashboard '...'. However, the new welcome dashboard file will not be created/overwritten until the next container restart. This can be checked after the restart by viewing the file:

docker exec -it cockpit cat resources/welcome.json