DE 

//Cloudogu EcoSystem Docs

Development

This article describes several items that are needed for development. The Baseline application consists of a backend as well as a frontend part and requires other services, such as Nexus.

Preparation - Access to external services

The backend relies on other services - such as Nexus - which have to be started and configured.

These services can be started with:

docker compose up -d

Nexus is now accessible under localhost and the port specified in the docker-compose file, e.g. under http://localhost:8081/.

The password for a first nexus admin login is saved in a file inside the docker container and can be read out with the following command:

docker compose exec nexus cat /nexus-data/admin.password

After the first login, set the admin password to the one in the localhost:8081 entry of the baseline.yaml.

In Nexus a raw repository with a file providing the project-list has to be created.

The baseline.yaml should contain the configuration of the repository and the admin credentials. For the local Nexus, set project_json_url, url and file_upload_url to http://localhost:8081/... instead of https://192.168.56.2/nexus/....

Various options for the development

There are several options for development of the baseline dogus, as described below.

Separate backend and frontend

To be more flexible during development, the frontend can be delivered independently of the backend.

Backend

Execute one of the following commands in the root directory of this repository to start the backend (the API)

Backend server (provides API):

go run .

or alternatively with version set:

go run -ldflags="-X 'main.Version=1.0.0'" .
Frontend

The UI is located in the subdirectory 'ui'.

Execute the following commands starting from the root directory of this repository to start the frontend (the UI):

cd ui
yarn install
yarn dev

The URL for accessing the frontend is displayed in the terminal after startup.

Close to production - Frontend delivered from the backend

For a close-to-production setup, the frontend should be built/packed and then be delivered from the backend:

Execute the following commands starting from the root directory of this repository to build/pack the frontend:

cd ui
yarn install
PUBLIC_URL=/baseline yarn build
PUBLIC_URL=/baseline yarn assets
rm -rf build && cp -r dist build

PUBLIC_URL sets the context path the UI uses for API calls. yarn assets adds the CES theme files to the build output. The backend serves the frontend from ui/build, while Vite writes to ui/dist, hence the copy.

After that, the backend delivers the frontend. To do this, run the following command in the root directory of this repository:

go run .

The frontend can now be accessed with http://localhost:8080/baseline .

Mocking API - UI only without a backend

Alternatively, the API can be mocked so that the backend does not have to be started. The data is read from a JSON file.

Execute the following commands starting from the root directory of this repository to start API-Mock (backend-mock):

cd ui/api-mock
npx json-server@0.17.4 --watch db.json --port 8080 --routes routes.json

json-server 0.17 is required, as newer versions no longer support --routes. The db.json contains the API data and can be extended on demand.

To start the frontend, see section Frontend