Installing ODK Central

  • Post author:
  • Post last modified:May 12, 2023
  • Post comments:0 Comments
# Installing ODK Central on Windows 10

This guide helps you to setup ODK Central on Windows 10 whereby OS specific problems are being fixed.

## Prerequisites

- Node.js
- Docker & Docker Compose (Docker Desktop recommended)
- Git

## Installation

### Step 1: Setup

Clone repository

```bash
# git clone with correct EOL
git clone -c core.autocrlf=false https://github.com/getodk/central
```

Install submodules

```bash
cd central
git submodule update -i
```

Please proceed with **Step 3**

### ~~Step 2: Fix for Windows~~

**This step is not necessary anymore since git manages the correct EOL during cloning.** 

Replace EOL from CRLF to LF for all *.sh files

```bash
# Command can be run directly from terminal ./central 

## Fix .sh files needed during build
## Issue: https://forum.getodk.org/t/odk-central-build-error/29523/10
for /f "tokens=* delims=" %a in ('dir /s /b *.sh') do ( dos2unix %a )

## fix files without extensions needed for odk-cmd
## Issue: https://forum.getodk.org/t/odk-central-command-line-tools-unable-to-create-admin-user/32521
for /f "tokens=* delims=" %a in ('dir /s /b files ^| findstr /v /i "\..*$"') do ( dos2unix %a )


# Credits: 
# recursive dos2unix: https://gist.github.com/kelvinn/512f72bf1015047af945
# Exclude files in dir: https://superuser.com/a/383646/1334887

# About windows for loop
# https://www.windows-commandline.com/windows-for-loop-examples/
# https://ss64.com/nt/for.html
```

Adjust 2 lines in `nginx.dockerfile`

```
RUN /bin/sh ./files/prebuild/write-version.sh
RUN /bin/sh ./files/prebuild/build-frontend.sh
```

### Step 3: Adjust Environment

Rename environment file

```bash
mv .env.template .env
```

Adjust variables in `.env`

```shell
DOMAIN=localhost
SSL_TYPE=selfsign
```

### Step 4: Build

Start your docker service and run

```
docker-compose build
```

To finish the build run

```
docker-compose up --no-start
```

### Step 5: Start

```
docker-compose up -d
```



## Credits

The fixes have been taken from the ODK Forum. Thank to these users for sharing their solutions.

@[delcroip](https://forum.getodk.org/u/delcroip)

@[aankrah](https://forum.getodk.org/u/aankrah)

@[hussainhussaini](https://forum.getodk.org/u/hussainhussaini)

Leave a Reply