DE 

//Cloudogu EcoSystem Docs

Setup environment

Frontend

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

Create npmrc file

Some used libraries need authentication. The credentials will be provided via a .npmrc file. Run the make target

make generate-local-npmrc

Run ui project

To run the frontend project you need to install all dependencies and start serving the app afterwards.

cd ui
yarn install
yarn run start

Use your GitHub credentials for the upcoming username- and password-prompt.

If yarn install fail check node version. Try nvm use 12.22.5.

Using the UI with a mocked API

Execute the following commands to install the package json-server globally and run the server using your defined mock data.

cd ui
yarn backend

The file routes.json contains hard coded routes on which the mock server should listen. The corresponding data can be defined in the file _db.json.

Example:

routes.json

{
  "/admin/api/v1/dogus": "/my-dogus"
}

_db.json

{
  "my-dogus": [
    {
      "name": "dogu1",
      "displayName": "Dogu 1",
      "version": "1.2.3-4",
      "description": "Dogu 1 is really cool."
    }
  ]
}

Backend

To execute the backend you just need to run the following command

go run .

Prerequisites

Certificates

To run the backend locally you need to save the ca.pem file to your develop environment under /etc/ssl/certs/. The file can be obtained from your EcoSystems' configuration registry (etcd).

inside the CES:

etcdctl get /config/_global/certificate/cesappd/ca.pem > /vagrant/ca.pem

outside the CES:

sudo cp <ecosystem repository path>/ca.pem /etc/ssl/certs/ca.pem

The backend will load this file on startup. The certificate will be generated during the installation of cesappd. So, each time you reinstall the CES you need to update the certificate locally.

cesappd service

The service has to be up and running. More details can be obtained from the developers' documentation from the cesappd repository on Github.

For local development with a running CES you have to apply an additional firewall rule to be able to access the service:

# allow access to the service running on port 50051
# the IP address 192.168.56.1 will be available as long as the local CES is running
ufw allow from "192.168.56.1" to any port 50051
cesappd service account

To access cesappd you need a service account which is normally created during the Dogu installation but you can generate the credentials manually.

root@ces:# cesappd service-account-create admin
username:admin_qAicxP4x
password:PijGG18pxXd8ETG2

Write these credentials to your local configuration.yaml.

service_endpoint:
  username: admin_qAicxP4x
  password: PijGG18pxXd8ETG2

Close to production

The configuration.yaml should contain the configuration of the service-endpoint.

For a close to production setup, the frontend should be build/ packed:

cd ui
yarn install
yarn start build

After that the backend delivers the frontend:

go run .

Building the dogu inside a CES

Before building the dogu with the cesapp build command you have to create a .netrc file which contains the user credentials to access private Github repositories during the docker build process.

With the make target generate-netrc the required file will be generated.

GIT_USER=mygitusernamer GIT_USER_TOKEN=myaccesstoken make generate-netrc

Be aware not to commit this file to the repository! Otherwise, your credentials will be accessible via the git commit history.