# Development Environment

## Orientation

The Databus is implemented in Javascript using Nodejs+Express for the Server and Angularjs for the client-side webapp. The nodejs server is providing both the API and the webapp resources. The webapp does not have its own server and runs only in the browser.

The Databus is best developed using Visual Studio Code to use the startup scripts in the `.vscode` folder.

## Requirements

* `node.js`: v16.13.0 or higher

```
# see https://github.com/nodesource/distributions/blob/master/README.md
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

```

* `npm`: 7.24.0 or higher

```
sudo npm install -g npm@latest
```

* `docker`: 20.10.2 or higher
* `docker-compose`: 1.25.0 or higher

```
sudo apt-get install docker docker-compose
```

* `php`: v8.1.0 or higher

```
sudo apt install php-cli
```

* `java`

## Clone Repository & Prepare for Development

```
git clone https://github.com/dbpedia/databus.git
cd databus
```

* `git hook` to automatically add files (generated by `model-docu/model.php`) to commits

```
cd .git/hooks
ln -s ../../.githooks/pre-commit pre-commit
cd ../..
```

## Building the Databus Docker Image

The following instructions will build the docker image for the Databus Server. Only do this if you want to run the Databus as a dockerized application. If you want to run the Databus without docker, you can skip this section.

```
bash build-docker-image.sh
```

The `build-docker-image.sh` script will install all npm dependencies for the server and webclient and build the docker image for the Databus application.

## Starting the Databus Locally

### Starting the Databus Environment

Go to the `devenv` directory of the repository and start the database and lookup search containers

```
make env-build
make env-start
```

You can restart these containers using `make env-restart`. Additionally, there is a make instruction for a restart with database wipe (`make env-clean-start`)

### Starting the Databus Server

First, install all dependencies by running:

```
make srv-install
```

Then run either:

```
make srv-start-auth0
```

*or*

```
make srv-start_dbpedia_keycloak
```

Each script contains a different configuration for a specific OIDC provider (Auth0 with Google Auth *or* DBpedia Login)

**PLEASE NOTE:** The sample OIDC providers are a development setup and should never be used in production. Please use your own OIDC provider for authentication in production.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dbpedia.gitbook.io/databus/devenv.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
