https://github.com/dlang/dub-registry
Online registry for dub packages
https://github.com/dlang/dub-registry
d dlang dub dub-registry online-registry registry vibed
Last synced: about 2 months ago
JSON representation
Online registry for dub packages
- Host: GitHub
- URL: https://github.com/dlang/dub-registry
- Owner: dlang
- License: bsl-1.0
- Created: 2012-10-31T08:14:47.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2024-11-24T12:18:58.000Z (over 1 year ago)
- Last Synced: 2025-01-23T18:45:30.783Z (about 1 year ago)
- Topics: d, dlang, dub, dub-registry, online-registry, registry, vibed
- Language: D
- Size: 1.53 MB
- Stars: 82
- Watchers: 35
- Forks: 64
- Open Issues: 104
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
DUB registry
============
 Online registry for [dub](https://github.com/dlang/dub/) packages, see .
[](https://www.heroku.com/deploy?template=https://github.com/dlang/dub-registry)
How to build & run locally
--------------------------
Requirements:
- OpenSSL
- MongoDB
```console
dub
```
Running as a mirror
-------------------
```console
dub -- --mirror=https://code.dlang.org
```
GitHub/GitLab/Gitea (Codeberg) API
-----------------
By default the GitHub/GitLab update cron job will use anonymous authentication on your local machine. As GitHub's API without authentication is quite rate-limited, you probably want to use authenticated API requests.
You can do so by creating a `settings.json` in the root folder of the dub-registry and adding credentials for the needed APIs:
```json
{
"github-auth": "",
"gitlab-url": "https://gitlab.com/",
"gitlab-auth": "",
"bitbucket-user": "",
"bitbucket-password": "",
"gitea-url": "https://codeberg.org/",
"gitea-auth": " Applications -> New Token)>"
}
```
It's recommended to create a separate account for the DUB registry GitHub authentication. Equally, if no GitLab packages are used in your local repository, no GitLab authentication is needed.
It's absolutely recommended to create a personal access token without any extra permissions for your GitHub account instead of entering your password plain text into the settings file. You can generate an access token at https://github.com/settings/tokens (Settings -> Developer Settings -> Personal access tokens)
### SECURITY NOTICE
Development versions prior to 2.3.0 were leaking the GitLab private token in error messages shown to the user. Please make sure to use the latest version along with a freshly generated token.
### Codeberg support (via Gitea/Forgejo)
Codeberg runs Forgejo, a fork of Gitea. dub-registry supports generic Gitea/Forgejo instances. To enable Codeberg support:
- Set `gitea-url` to `https://codeberg.org/` in your `settings.json` (or use env var `GITEA_URL`).
- (Optional) Set `gitea-auth` to a personal access token for higher API rate limits and to access private repositories (env var `GITEA_AUTH`).
Note: currently only a single Gitea/Forgejo instance can be configured at a time.
Running without the cron job
----------------------------
For local development it's often useful to disable the cron job, you can do so with the `--no-monitoring` flag:
```console
dub -- --no-monitoring
```
Importing a one-time snapshot from the registry
-----------------------------------------------
You can download a dump of all packages and import it into your local registry for development:
```console
curl https://code.dlang.org/api/packages/dump > mirror.json
dub -- --mirror=mirror.json
```
Starting the registry with `mirror.json` will import all packages within the JSON file.
Once all packages have been imported, you can start the registry as you normally would:
```console
dub
```
And you should notice that it now contains all packages which are listed on code.dlang.org
Note that `--mirror=mirror.json` and `--mirror=https://code.dlang.org` are very similar and the `mirror.json` is only preferred for local development because it allows to easily nuke the entire mongo database and re-initialize it without needing any connection to the internet.
Build/Running dub-registry with Docker
---------------------------------------
- Build:
```console
export DUB_REGISTRY_HOME=$PWD
docker compose build
```
- Run:
```console
export DUB_REGISTRY_HOME=$PWD
docker compose up -d
```
- Stop:
```console
docker compose down
```
This will run both `mongodb` and `dub-registry` while persisting the database in the `$DUB_REGISTRY_HOME` location. The registry is accessible at http://127.0.0.1:9095
The registry can be configured by adding the `settings.json` file in `$DUB_REGISTRY_HOME` folder.