Kn Integration

Frappe app for Kuehne + Nagel SFTP

Install Kn Integration

bench get-app https://github.com/Bamboi-tech/kn_integration

Add the Frappe Gems badge to your README

Maintain Kn Integration? Paste this into your README:

[![Listed on Frappe Gems](https://frappegems.com/api/method/frappe_gems.seo.badge?app=Bamboi-tech%2Fkn_integration)](https://frappegems.com/gems/apps/Bamboi-tech/kn_integration)

About Kn Integration

KN Integration

Kuehne + Nagel integration

SFTP access

Connect to Kuehne+Nagel file exchange:

SSH_AUTH_SOCK= sftp -o IdentitiesOnly=yes -o Port=22 -i .ssh/prod/kn_mft_ed25519 Bamboi@mft.kuehne-nagel.com
SSH_AUTH_SOCK= sftp -o IdentitiesOnly=yes -o Port=22 -i ./.ssh/kn_mft_ed25519 Bamboi@mft-test.kuehne-nagel.com
# Or password based
sftp -o Port=22 Bamboi@mft.kuehne-nagel.com

Installation

You can install this app using the bench CLI:

cd $PATH_TO_YOUR_BENCH
bench get-app $URL_OF_THIS_REPO --branch develop
bench install-app kn_integration

Contributing

This app uses pre-commit for code formatting and linting. Please install pre-commit and enable it for this repository:

cd apps/kn_integration
pre-commit install

Pre-commit is configured to use the following tools for checking and formatting your code:

  • ruff
  • eslint
  • prettier
  • pyupgrade

Shared assets volume for Docker (required)

To avoid mismatched hashed CSS/JS filenames between containers, ensure the backend and frontend share a single named assets volume.

Add or include the following override in your Compose stack (kept in frappe_docker/overrides/compose.assets.volume.yaml):

services:
  backend:
    volumes:
      - assets:/home/frappe/frappe-bench/sites/assets
  frontend:
    volumes:
      - assets:/home/frappe/frappe-bench/sites/assets:ro
volumes:
  assets:
    name: frappe_docker_assets

Use it with your stack (example):

docker compose \
  -p frappe-local \
  -f gitops/docker-compose.yml \
  -f frappe_docker/overrides/compose.assets.volume.yaml up -d

Alternatively, merge the snippet into your gitops/docker-compose.yml.

Zsh helper: rebuild and sync Frappe assets

Add the following function to your ~/.zshrc to rebuild assets, sync each app's public/ into sites/assets/, bump the asset version, and restart services. This prevents CSS/JS hash mismatches between containers.

frappe_assets_sync() {

  set -euo pipefail

  local PROJECT=${1:-frappe-local}
  local COMPOSE_FILE="${2:-$HOME/frappe-local/gitops/docker-compose.yml}"
  local SITE=${3:-dev.localhost}

  # ensure custom app is installed in venv if present
  docker compose -p "$PROJECT" -f "$COMPOSE_FILE" exec backend bash -lc '
    cd /home/frappe/frappe-bench
    [ -d apps/kn_integration ] && env/bin/pip install -q -e apps/kn_integration || true
  '

  docker compose -p "$PROJECT" -f "$COMPOSE_FILE" exec backend bash -lc "
    set -e
    cd /home/frappe/frappe-bench
    NODEBIN=\$(ls -d /home/frappe/.nvm/versions/node/*/bin | head -n1); export PATH=\"$NODEBIN:$PATH\"
    bench --site $SITE migrate
    bench build --force
    for app in \$(cat sites/apps.txt); do
      [ -d apps/\$app/\$app/public ] || continue
      src=\"apps/\$app/\$app/public\"; dst=\"sites/assets/\$app\"
      rm -rf \"\$dst\"; mkdir -p \"\$dst\"; cp -a \"\$src/.\" \"\$dst/\"
    done
    bench set-config -g asset_version \$(date +%s)
    bench --site $SITE clear-website-cache
    bench --site $SITE clear-cache
  "

  docker compose -p "$PROJECT" -f "$COMPOSE_FILE" restart backend frontend

  # verification
  docker compose -p "$PROJECT" -f "$COMPOSE_FILE" exec backend  md5sum sites/assets/assets.json
  docker compose -p "$PROJECT" -f "$COMPOSE_FILE" exec frontend md5sum sites/assets/assets.json

  local HASH
  HASH=$(docker compose -p "$PROJECT" -f "$COMPOSE_FILE" exec -T backend bash -lc \
    "grep -o 'desk.bundle.[A-Z0-9]\\+\\.css' sites/assets/assets.json | tail -n1" | tr -d $'\r')
  echo "CSS hash: $HASH"
  docker compose -p "$PROJECT" -f "$COMPOSE_FILE" exec backend  bash -lc "ls -l sites/assets/frappe/dist/css/$HASH"
  docker compose -p "$PROJECT" -f "$COMPOSE_FILE" exec frontend bash -lc "ls -l sites/assets/frappe/dist/css/$HASH"
}

After adding it, reload your shell with source ~/.zshrc.

Usage:

# defaults: PROJECT=frappe-local, COMPOSE_FILE=$HOME/frappe-local/gitops/docker-compose.yml, SITE=dev.localhost
frappe_assets_sync

# custom values
frappe_assets_sync   

Notes: - The shared assets volume override above must be active so both containers see the same sites/assets. - The function requires docker compose access to the running stack and bench inside the backend container.

Troubleshooting (local bind-mount dev)

If bench errors with ModuleNotFoundError: kn_integration, run a one‑time editable install in the backend venv, then (re)install in site and migrate:

docker compose -p frappe-local exec backend bash -lc '
  cd /home/frappe/frappe-bench && env/bin/pip install -q -e apps/kn_integration
'
docker compose -p frappe-local exec backend bench --site dev.localhost install-app kn_integration
docker compose -p frappe-local exec backend bench --site dev.localhost migrate
docker compose -p frappe-local restart backend

Related Integrations apps for Frappe & ERPNext

  • Insights — Open Source Business Intelligence Tool
  • Raven — Simple, open source team messaging platform
  • Frappe Whatsapp — WhatsApp cloud integration for frappe
  • Frappe Assistant Core — Infrastructure that connects LLMs to ERPNext. Frappe Assistant Core works with the Model Context Protocol (MCP) to expose ERPNext functionality to any compatible Language Model
  • Biometric Attendance Sync Tool — A simple tool for syncing Biometric Attendance data with your ERPNext server
  • Frappe React Sdk — React hooks for Frappe
  • Frappe Js Sdk — TypeScript/JavaScript library for Frappe REST API
  • Mcp — Frappe MCP allows Frappe apps to function as MCP servers