Skip to content

Instantly share code, notes, and snippets.

@tertek
Last active April 21, 2025 15:20
Show Gist options
  • Save tertek/b228b9ab6ec42ee9ef42c613eec6b90d to your computer and use it in GitHub Desktop.
Save tertek/b228b9ab6ec42ee9ef42c613eec6b90d to your computer and use it in GitHub Desktop.
Installing ODK Central on Windows 10

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

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

Install submodules

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

# 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

mv .env.template .env

Adjust variables in .env

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

@aankrah

@hussainhussaini

@FREE272
Copy link

FREE272 commented Apr 21, 2025

Before I could build I had to run this command:
New-Item -Path "./files/allow-postgres14-upgrade" -ItemType File

Without running the above command and running docker-compose build I got this output:

Compose can now delegate builds to bake for better performance.
 To do so, set COMPOSE_BAKE=true.
2025/04/21 16:54:57 http2: server: error reading preface from client //./pipe/dockerDesktopLinuxEngine: file has already been closed
[+] Building 0.6s (16/19)                                                                                                                                             docker:desktop-linux
 => => transferring dockerfile: 110B                                                                                                                                                  0.0s 
 => [postgres14 internal] load build definition from postgres14.dockerfile                                                                                                            0.0s 
 => => transferring dockerfile: 513B                                                                                                                                                  0.0s 
 => [postgres internal] load build definition from postgres-upgrade.dockerfile                                                                                                        0.0s 
 => => transferring dockerfile: 711B                                                                                                                                                  0.0s 
 => [secrets internal] load metadata for docker.io/library/node:22.12.0-slim                                                                                                          0.5s 
 => [postgres14 internal] load metadata for docker.io/library/postgres:14.10                                                                                                          0.5s 
 => [postgres internal] load metadata for docker.io/tianon/postgres-upgrade:9.6-to-14                                                                                                 0.4s 
 => [postgres internal] load .dockerignore                                                                                                                                            0.0s 
 => => transferring context: 67B                                                                                                                                                      0.0s 
 => CANCELED [postgres 1/3] FROM docker.io/tianon/postgres-upgrade:9.6-to-14@sha256:2ff78f791338b3502c8b61dc148f1e7e8a4ebdd7f69f2cdd33f0f31ec16f7896                                  0.0s 
 => [postgres internal] load build context                                                                                                                                            0.0s 
 => => transferring context: 3.61kB                                                                                                                                                   0.0s 
 => [postgres14 internal] load .dockerignore                                                                                                                                          0.0s 
 => => transferring context: 67B                                                                                                                                                      0.0s 
 => ERROR [postgres 2/3] COPY ./files/allow-postgres14-upgrade .                                                                                                                      0.0s 
 => [postgres14 internal] load build context                                                                                                                                          0.0s 
 => => transferring context: 117B                                                                                                                                                     0.0s 
 => [postgres14 1/2] FROM docker.io/library/postgres:14.10@sha256:34f4ee87fed96f254c4970e6a348c24b24b4f05ebb0880e29c8d15a5cde4e763                                                    0.1s 
 => => resolve docker.io/library/postgres:14.10@sha256:34f4ee87fed96f254c4970e6a348c24b24b4f05ebb0880e29c8d15a5cde4e763                                                               0.0s 
 => [secrets internal] load .dockerignore                                                                                                                                             0.0s 
 => => transferring context: 67B                                                                                                                                                      0.0s 
 => [secrets internal] load build context                                                                                                                                             0.0s 
 => => transferring context: 551B                                                                                                                                                     0.0s 
 => [secrets 1/2] FROM docker.io/library/node:22.12.0-slim@sha256:35531c52ce27b6575d69755c73e65d4468dba93a25644eed56dc12879cae9213                                                    0.0s 
 => => resolve docker.io/library/node:22.12.0-slim@sha256:35531c52ce27b6575d69755c73e65d4468dba93a25644eed56dc12879cae9213                                                            0.0s 
------
 > [postgres 2/3] COPY ./files/allow-postgres14-upgrade .:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref zvtkb8xfuvufq0u2l6i6x28k2::6890oc1iynetru6msz0lsnf3m: "/files/allow-postgres14-upgrade": not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment