# Set up your own FAIR Data Station

Separately from the web-hosted instance of the FAIR Data Station, it is possible to run your own FAIR DS instance. This can be achieved either by directly downloading the source code and running it locally, or by pulling a Docker FAIR Data Station image.

## Running the application locally

To run the FAIR Data Station on your local computer, download the application from [http://download.systemsbiology.nl/#/unlock/](http://download.systemsbiology.nl/#/unlock/) and download the latest fairds-VERSION.jar file. Ensure you have a Java runtime environment installed.

Then start the program in a terminal (Linux/Mac) or Command Prompt / PowerShell in Windows by navigating to the download location and typing: `java -jar fairds-VERSION.jar`

When you see the following line, the application has started...

`Started Application in 3.666 seconds (process running for 6.147)`

The application is now accessible from your own device, use the following url in your browser: [http://localhost:8083](http://localhost:8083)<!-- markdown-link-check-disable-line -->

You now have local access to the full functionality of the FAIR Data Station!

## Running with Docker

It is also possible to use the FAIR Data Station Docker image containing the latest `.jar` file. 

### Quick start
To quick start a simple container without modification possibilities use the following command:

```
docker run -p 8083:8083 docker-registry.wur.nl/m-unlock/docker/fairds:latest
```
Access the application at [http://localhost:8083](http://localhost:8083)<!-- markdown-link-check-disable-line -->

### Persisting data

If you want to have access to the data files use the following command:

:::::{tab-set}

::::{tab-item} Windows

***Note: Use Command Prompt (CMD). The current docker command does not work in PowerShell.***

> docker run -v "%cd%"/fairds_storage:/fairds_storage -it -p 8083:8083 docker-registry.wur.nl/m-unlock/docker/fairds:latest

::::


::::{tab-item} Mac

> docker run -v `$PWD`/fairds_storage:/fairds_storage -it -p 8083:8083 docker-registry.wur.nl/m-unlock/docker/fairds:latest

::::

::::{tab-item}  Linux

> docker run -v `$PWD`/fairds_storage:/fairds_storage -it -p 8083:8083 docker-registry.wur.nl/m-unlock/docker/fairds:latest

::::
:::::

This command creates a "fairds_storage" folder in the current directory.
Access the application at [http://localhost:8083](http://localhost:8083)<!-- markdown-link-check-disable-line -->

## Configuring the application

After the initial startup of the application a fairds_storage folder will be created in the current directory. This folder contains the configuration file for the application, the metadata file to ensure term standardisation and additional folders for various modules (if enabled).

```bash
fairds_storage
fairds_storage/bioprojects
fairds_storage/bioprojects/raw
fairds_storage/config.yaml
fairds_storage/metadata.xlsx
fairds_storage/validation
```

The `config.yaml` file contains the configuration for the application. You can edit this file to change the settings of the application. The following settings can be changed:

```yaml
# Menus enabled in the FAIR Data Station
menus:
  about: true
  configurator: true
  validator: true
  bioprojects: true
  ena: true
  terms: true
  irods: true
  api: true
  organise: true
```

The first section of the configuration file contains the menus that are enabled in the FAIR Data Station. You can enable or disable the menus by setting the value to `true` or `false`.

```yaml
counter:
  goat: '<script data-goatcounter="https://fairds.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>'
```

The `counter` section contains the code for the GoatCounter, which is used to track the usage of the FAIR Data Station. You can remove this section if you do not want to use GoatCounter or you can change it to your own instance.

```yaml
params:
  irods_investigation_directory: /{ZONE}/home/
```

The irods_investigation_directory parameter defines the root path for new investigations in iRODS, where {ZONE} is a placeholder that automatically resolves to the user's zone after login, allowing zone-specific directory creation under (in this case) /home/.

```yaml
irods_storage:
  tags:
    request for archive:
      attribute: "archive_status"
      value: "archive_requested"
```

This part of the YAML defines configurable archive request tags for iRODS. Each tag corresponds to a button in the iRODS archiving UI. When clicked, the button sets iRODS metadata using the specified attribute, value, and optionally units. In this example, the "request for archive" button will set archive_status = archive_requested on the selected data.

```yaml
view:
  validation:
    investigation_identifier: "e.g. NWO_UNLOCK"
    investigation_title: "e.g. Synergies between biological and ozonisation processes for micropollutant removal"
    investigation_description: "e.g. investigation into optimizing micropollutant removal from wastewater treatment plant effluent using biological treatment and ozonation"
    study_identifier: "e.g. BO3B-BR1"
    study_title: "e.g. Optimizing conditions using bioreactors."
    study_description: "e.g. What type of bioreactors are best at removing organic matter from wastewater treatment plant effluent. And what conditions can optimize these processes."
```

The `view` section contains the example values for the investigation and study identifiers, titles, and descriptions. These values are used in the validation module to show to users what is expected in these fields. You can change these values to match your own examples.

```yaml
irods:
  - label: UNLOCK
    host: data.m-unlock.nl
    port: 1247
    zone: unlock
    authscheme: PAM
    ssl: CS_NEG_REQUIRE

  - label: Vrije Universiteit Amsterdam
    host: data.yoda.vu.nl
    port: 1247
    zone: vu
    authscheme: PAM
    ssl: CS_NEG_REQUIRE
...
```

The `irods` section contains the iRODS servers that are configured for the FAIR Data Station. You can add or remove iRODS servers by adding or removing the entries in this section. Each entry contains the label, host, port, zone, authscheme, and SSL settings for the iRODS server.

After configuration, restart the application for changes to take effect.