{"id":37919954,"url":"https://github.com/cdluc3/n2t","last_synced_at":"2026-05-26T21:01:07.798Z","repository":{"id":226279279,"uuid":"421517765","full_name":"CDLUC3/N2T","owner":"CDLUC3","description":"next-gen N2T resolver","archived":false,"fork":false,"pushed_at":"2026-05-26T16:36:08.000Z","size":5334,"stargazers_count":5,"open_issues_count":14,"forks_count":5,"subscribers_count":16,"default_branch":"main","last_synced_at":"2026-05-26T18:14:51.872Z","etag":null,"topics":["ark","identifier","resolver"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CDLUC3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-26T17:16:44.000Z","updated_at":"2025-12-30T06:28:27.000Z","dependencies_parsed_at":"2024-09-17T17:44:03.495Z","dependency_job_id":"eeed0fb5-a382-4c3b-ad80-844840c322fb","html_url":"https://github.com/CDLUC3/N2T","commit_stats":null,"previous_names":["cdluc3/n2t"],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/CDLUC3/N2T","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDLUC3%2FN2T","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDLUC3%2FN2T/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDLUC3%2FN2T/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDLUC3%2FN2T/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CDLUC3","download_url":"https://codeload.github.com/CDLUC3/N2T/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDLUC3%2FN2T/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33538660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ark","identifier","resolver"],"created_at":"2026-01-16T17:27:18.358Z","updated_at":"2026-05-26T21:01:07.791Z","avatar_url":"https://github.com/CDLUC3.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# N2T Python Implementation\n\nN2T is an identifier scheme resolver. \n\nIts role is to redirect clients to the registered handler for an identifier \nscheme. The handler is expected to continue interaction with the client for \nidentifier resolution.\n\n## Manual Deploy on Amazon Linux 2023\n\nThe steps to deployment are broadly:\n\n1. Setup Nginx Unit as the web server\n2. Install the n2t python application\n3. Configure the n2t application with identifier schem information\n\n### Setup Nginx Unit as the web server\n\nOn server instance:\n\nGiven the YUM repository description file `unit.repo`:\n```\n[unit]\nname=unit repo\nbaseurl=https://packages.nginx.org/unit/amzn/2023/$basearch/\ngpgcheck=0\nenabled=1\n```\n\nAdd the repository and install Nginx `unit`: \n```\nsudo yum update\nsudo yum install yum-utils\nsudo /usr/bin/yum-config-manager --add-repo unit.repo\nsudo yum update\nsudo yum install unit\nsudo yum install unit-devel unit-jsc17 unit-python311 unit-wasm\nsudo cdlsysctl start unit\n```\n\nNote: The service is installed as disabled and needs to be enabled, but \n`cdlsysctl` doesn't allow that so needs to be done by an administrator, e.g.:\n```\nsudo systemctl enable unit\n```\n\nIs the service running?\n```\nsudo cdlsysctl status unit\n● unit.service - NGINX Unit\n     Loaded: loaded (/usr/lib/systemd/system/unit.service; disabled; preset: disabled)\n     Active: active (running) since Wed 2024-02-28 04:32:23 PST; 4s ago\n   Main PID: 1893665 (unitd)\n      Tasks: 3 (limit: 1055)\n     Memory: 5.7M\n        CPU: 16ms\n     CGroup: /system.slice/unit.service\n             ├─1893665 \"unit: main v1.32.0 [/usr/sbin/unitd --log /var/log/unit/unit.log --pid /var/run/unit/unit.pid --no-daemon]\"\n             ├─1893667 \"unit: controller\"\n             └─1893668 \"unit: router\"\n```\n\nTo enable access to `unit` by the `ezid` user, it is necessary to override the \ndefault systemd startup for unit. This is done with an `override.conf` file in\n`/etc/systemd/system/unit.service.d`:\n```\n[Service]\nEnvironment=\"UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid --user ezid --group ezid\"\nGroup=ezid\nExecStartPost=/usr/bin/sh -c 'sleep 3; chmod 660 /var/run/unit/control.sock; chmod 640 /var/log/unit/*.log'\n```\n\nShow the current `unit` configuration:\n```\n$ curl -X GET --unix-socket /var/run/unit/control.sock http://localhost/config/\n{\n\t\"listeners\": {},\n\t\"routes\": [],\n\t\"applications\": {}\n}\n```\n\n### Install the n2t python application\n\nSetup python and application. Installing the application is done by cloning from \nthe GitHub repository. From the application home (i.e. `/ezid` on UC3 systems):\n\n```\ngit clone https://github.com/CDLUC3/n2t.git\ncd n2t\npython3.11 -m venv venv\nsource venv/bin/.activate\npython --version\n  Python 3.11.6\npython -m pip install -U pip\npython -m pip install -e .\n```\n\nRun the `n2t` cli to verify the application is installed:\n\n```\n$  n2t\nUsage: n2t [OPTIONS] COMMAND [ARGS]...\n\n  Management commands for N2T.\n\n  This script is used for initializing the JSON representation of scheme\n  records from the original YAML and creating or updating the sqlite store\n  used by the resolver application.\n\nOptions:\n  -c, --config FILE\n  --help             Show this message and exit.\n\nCommands:\n  info       Print application version and basic status.\n  loaddb     Load or update the scheme database.\n  yaml2json  Generate or update JSON record from YAML source.\n```\n\n### Configure the n2t application with identifier scheme information\n\nBefore operation, the N2T application scheme database must be initialized. This \nprocess creates an sqlite database containing the scheme records to support \nresolution. The scheme records are loaded from the JSON sources, and the \ndatabase will need to be updated when the JSON sources are modified.\n\nThe N2T application is configured using a `.env` file. The available properties\ninclude:\n\n| Key                          | Default                          | Description                                                               |\n|------------------------------|----------------------------------|---------------------------------------------------------------------------|\n| `N2T_HOST`                   | `localhost`                      | Address to listen when running in dev mode.                               |\n| `N2T_PORT`                   | `8000`                           | Port to listen on when running in dev mode.                               |\n| `N2T_PROTOCOL`               | `http`                           | Protocol to listen on (`http` or `https`).                                |\n| `N2T_DB_CONNECTION_STRING`* | `sqlite:///BASE/data/n2t/sqlite` | SQLAlchemy connection string (sqlite preferred).                          | \n| `N2T_JSON_DIR`*             | `BASE/schemes`                   | Folder where the scheme definitions are located.                          |\n| `N2T_STATIC_DIR`*           | `BASE/static`                    | Folder from where static content is served (styles, images, scripts).     | \n| `N2T_TEMPLATE_DIR`*         | `BASE/templates`                 | Folder from which templated content is served.                            |\n| `N2T_ENVIRONMENT`            | `development`                     | A human readable label for the service (development, staging, production) | \n\n*: Default folder locations are relative to the `n2t` folder in the cloned repository. \n\nA typical configuration file for a staging environment will be:\n```\nN2T_DB_CONNECTION_STRING=\"sqlite:///data/n2t.sqlite\"\nN2T_JSON_DIR=\"schemes\"\nN2T_ENVIRONMENT=\"staging\"\n```\n\nThose settings indicate the name of the environment \"staging\", that the JSON\nscheme definitions are in the folder `schemes` and the application\ndatabase is `data/n2t.sqlite`. The folders are relative to the location where\nthe `n2t` command is run. These properties may also use absolute paths, for\nexample:\n\n```\nN2T_DB_CONNECTION_STRING=\"sqlite:////ezid/var/n2t.sqlite\"\nN2T_JSON_DIR=\"/ezid/n2t/schemes\"\n```\n\nAny of the settings are overridden by an equivalent named environment variable\nif set.\n\nIf the `schemes` folder is not present it needs to be created from the \nlegacy N2T prefixes file:\n\n```\nwget \"https://legacy-n2t.n2t.net/e/n2t_full_prefixes.yaml\"\nn2t yaml2json\n```\n\nThe application database may be created and populated when the JSON scheme\nrecords are available:\n\n```\ncd /ezid/n2t\nmkdir -p data\nn2t loaddb\n```\n\nTo verify setup, use the `info` command. The output should be something like:\n\n```\n$ n2t info\n{\n  \"version\": \"0.5.0\",\n  \"environment\": \"development\",\n  \"status\": \"initialized\",\n  \"description\": \"n2t_full_prefixes\",\n  \"created\": \"2024-03-06T16:01:43.245204\",\n  \"schemes\": {\n    \"total\": 2774,\n    \"valid\": 1596\n  }\n}\n```\n\n## Managing Scheme Records\n\n## Local Development\n\nClone the repository:\n\n```\ngit clone https://github.com/CDLUC3/N2T.git\ncd N2T\n```\n\nInitialize a virtual environment:\n\n```\nuv venv .venv\n```\n\nInstall the dependencies (includes the dev group dependencies):\n\n```\nuv sync\n```\n\nCreate a data folder and generate the resolver database:\n\n```\nmkdir data\nuv run n2t -c dev-config.env loaddb\n```\n\nRun the local server:\n\n```\nuv run n2t -c dev-config.env serve\n```\n\n**Hint:** Running `source .venv/bin/activate` will load the virtual environment to the current shell, so you can run the `n2t` commands without `uv run`, e.g.:\n\n```\nsource .venv/bin/activate\nn2t --help\nUsage: n2t [OPTIONS] COMMAND [ARGS]...\n\n  Management commands for N2T.\n\n  This script is used for initializing the JSON representation of scheme\n  records from the original YAML and creating or updating the sqlite store\n  used by the resolver application.\n\nOptions:\n  -c, --config FILE\n  --help             Show this message and exit.\n\nCommands:\n  info       Print application version and basic status.\n  loaddb     Load or update the scheme database.\n  serve\n  yaml2json  Generate or update JSON record from YAML source.\n```\n\nThe virtual environment can be unloaded with `deactivate`\n\n\n### Nginx Unit on OS X (silicon)\n\n```\nbrew install nginx/unit/unit\nbrew install unit-python3\n\n/opt/homebrew/opt/unit/bin/unitd --no-daemon\n```\n\nControl socket: `/opt/homebrew/var/run/unit/control.sock`\nLog file: `/opt/homebrew/var/log/unit/unit.log `\n\n```\nexport UNIT_CONTROL=\"/opt/homebrew/var/run/unit/control.sock\"\n```\n\nSet configuration:\n```\ncurl -X PUT --data-binary @unit.conf --unix-socket ${UNIT_CONTROL} http://localhost/config/applications/n2t\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdluc3%2Fn2t","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdluc3%2Fn2t","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdluc3%2Fn2t/lists"}