Giter VIP home page Giter VIP logo

trunk's Introduction

Trunk

version OSSRank Slack

Trunk is an open source package manager and registry for PostgreSQL (Postgres) extensions:

  • Visit pgt.dev to discover and learn more about the building blocks of this rich ecosystem
  • Use the Trunk CLI (pg-trunk) to build, publish and install Postgres extensions of all kinds.

trunk-install-larger-font

Trunk CLI

Installation

To get started, run the following commands to download and leverage cargo to install Trunk's CLI.

  1. curl https://sh.rustup.rs -sSf | sh
  2. cargo install pg-trunk

Usage

The Trunk CLI allows for building, publishing and installing Postgres extensions of all kinds. It abstracts away complexities of extension development and management with the following commands:

trunk build

Compile extensions of all kinds.

❯ trunk build
Building from path .
Detected that we are building a pgrx extension
Detected pgrx version range 0.7.4
Using pgrx version 0.7.4
Building pgrx extension at path .
.
.
.
Creating package at: ./.trunk/pgmq-0.5.0.tar.gz
Create Trunk bundle:
	pgmq.so
	extension/pgmq--0.5.0.sql
	extension/pgmq.control
	manifest.json
Packaged to ./.trunk/pgmq-0.5.0.tar.gz

trunk publish

Publish extensions to the registry, making them available to the Postgres community for discovery and installation.

❯ trunk publish pgmq \
--version 0.5.0 \
--description "Message Queue for postgres" \
--documentation "https://github.com/tembo-io/pgmq" \
--repository "https://github.com/tembo-io/pgmq" \
--license "Apache-2.0" \
--homepage "https://www.tembo.io"

trunk install

Downloads Postgres extensions from the Trunk registry and installs into your environment (only Ubuntu support at this time).

Supports nested dependencies, e.g. installing extension_a will automatically install extension_b if required.

❯ trunk install pgmq
Using pg_config: /usr/bin/pg_config
Using pkglibdir: "/usr/lib/postgresql/15/lib"
Using sharedir: "/usr/share/postgresql/15"
Downloading from: https://cdb-plat-use1-prod-pgtrunkio.s3.amazonaws.com/extensions/pgmq/pgmq-0.5.0.tar.gz
Dependencies: ["pg_partman"]
Installing pgmq 0.5.0
[+] pgmq.so => /usr/lib/postgresql/15/lib
[+] extension/pgmq--0.5.0.sql => /usr/share/postgresql/15
[+] extension/pgmq.control => /usr/share/postgresql/15

Trunk Registry - https://pgt.dev

The Trunk registry serves as a community hub for Postgres extensions of all kinds. The Trunk CLI installs extensions and their dependencies as compiled artifacts from this registry.

  • Extension discovery and search
  • Publish extensions for community use
  • Install extensions in Postgres

It's our goal to develop Trunk to allow for:

  • Usage metrics to provide insight into popular and well-maintained extensions
  • Version tracking and new release email notifications

✨ Contributing

Trunk is in active development, and we look forward to the contributions the Postgres community has to offer. If you're interested in contributing, please open a pull request, issue, or reach out!

Thanks goes to these incredible people:

trunk's People

Contributors

evanhstanton avatar ianstanton avatar vrmiguel avatar sjmiller609 avatar chuckhend avatar karlmorand avatar theory avatar ryw avatar yrashk avatar darrenbaldwin07 avatar nhudson avatar shhnwz avatar brianpursley avatar williamong68 avatar jasonmp85 avatar artemgavrilov avatar danrye avatar gunnarmorling avatar kianmeng avatar thomaslapiana avatar tricked-dev avatar

Stargazers

A.s. avatar Thiago Majesk Goulart avatar Jiho Lee avatar Lucas Resch avatar Jeshwan Khoodeeram avatar Kennan Fattahillah avatar Tino Thamjarat avatar Muliawan Oetama avatar Alessandro avatar  avatar SteveLauC avatar Brad Haan avatar Andres Riofrio avatar Thomas Harr avatar Nibsirahsieu avatar Andrea Di Mario avatar Bryan FRIMIN avatar Alex avatar Kevin Malaver avatar  avatar Maciej Walkowiak avatar Amias Li avatar Andrew avatar Ibrahim hamzat avatar Tomáš Horáček avatar Mike avatar AloisioMagalhães avatar S.W. avatar BlasterPistol avatar Raimund avatar Sid Mitra avatar Christoph Grabo avatar  avatar Jonathan Gray avatar Loïc Saint-Roch avatar Tanguy Launay avatar Cade Markegard avatar David Gidwani avatar Alexander Hofbauer avatar Tri Nguyen avatar Markus Hettich avatar Joe Nathan Abellard avatar Sam Eisenberg avatar George Kontridze avatar  avatar Wildan Zulfikar avatar Mahatma_Fatal_Error avatar Alex Rigler avatar ddff avatar KaFai avatar Duke avatar Ramiro Calle avatar  avatar Kuba Clark avatar Roberto Acevedo avatar Dennis Torres avatar Jakub Kopecký avatar Alex A. avatar Georgy Shelkovy avatar  avatar Nikolaus Schlemm avatar Marcus S. Abildskov avatar Ren Dong avatar Daniel Higa avatar Lazar Pavicevic avatar _.fmendes._ avatar Yannis Katsaros avatar Sascha Müller avatar Eder Lima avatar Bruno Bernard avatar Tony Solomonik avatar Arda Beyazoğlu avatar  avatar  avatar Narate Ketram avatar Luis Fellipe M. O. B. avatar Marcel avatar Ishan Marikar avatar Flávio Codeço Coelho avatar M Haidar Hanif avatar Victor Lang'at avatar Roman Heinrich avatar  avatar Bruno Gomes avatar Farzad Sadeghi avatar  avatar Daniel Salvador avatar Michael avatar AM avatar Mandy Schoep avatar Yasir Aslam avatar  avatar bykalim avatar omar avatar Hyeseong Kim avatar ℤiλ∀ avatar Nir Zilberman avatar Radu Suciu avatar  avatar Brihaspati G Bharani avatar

Watchers

 avatar James Cloos avatar Jeremy White avatar Izel Nakri | izelnakri.eth avatar Adarsh Shah avatar Samay Sharma avatar  avatar  avatar

trunk's Issues

[COR-775] Add support for wider range of PGRX versions

❯ trunk build
Building from path .
Detected that we are building a pgrx extension
Detected pgrx version range =0.8.2
Using pgrx version 0.8.2
Building pgrx extension at path .
Step 1/10 : ARG PG_VERSION=15
Step 2/10 : ARG PGRX_VERSION=0.8.2
Step 3/10 : FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx${PGRX_VERSION}
[/home/ian/.cargo/registry/src/github.com-1ecc6299db9ec823/pg-trunk-0.4.7/src/commands/containers.rs:306] &err = DockerStreamError {
    error: "unknown: Tag pg15-pgrx0.8.2 was deleted or has expired. To pull, revive via time machine",
}
thread 'main' panicked at 'error occurred: Other error: Docker stream error

Caused by:
    Docker stream error', /home/ian/.cargo/registry/src/github.com-1ecc6299db9ec823/pg-trunk-0.4.7/src/main.rs:51:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

We need to define a process for building and publishing PGRX-builder images. We need to support the latest version of PGRX in our builder images.

From SyncLinear.com | COR-775

Create and design database for supporting extension directory

The goal is to create and design a database used to support a postgreSQL extension directory. Conceptually-speaking, this would be a postgreSQL equivalent to npmjs.org (JavaScript), pypi.org (Python), and crates.io (Rust).

This would be a backend storage, to which source and built binary distributions would be published and indexed.

  • Where will the packages be physically stored?
  • How to best organize metadata (e.g., author(s), versions)
  • Defined steps to publish extensions

[COR-838] Extension metadata stored in a trunk.toml file

Trunk CLI should use a trunk.toml file to store extension metadata. This will hold information currently passed as flags. Example:

[extension]
name = "my_extension"
version = "0.0.0"
description = "2021"
documentation = "documentation.my_extension.com"
repository = "github.com/my_extension"
license = "PostgreSQL"
homepage = "my_extension.com"
postgres_version = "15"
architecture = "x86_64"

From SyncLinear.com | COR-838

[COR-772] Route for extension version history

Create a route that returns version history for a given extension:

  • /extensions/detail/{extension_name}/

  • array of versions for a given extension

    [
      {
        "createdAt": "2023-04-20 4:29:18.52241 +00:00:00",
        "description": "My incredible extension",
        "documentation": null,
        "homepage": "coredb.io",
        "version": "0.0.2",
        "license": "Apache-2.0",
        "name": "pgmq",
        "owners": [
          {
            "userId": "user_2PXTvcubP95TyEvTXZJOpzHjdJn",
            "userName": "coredb-service-user"
          }
        ],
        "repository": "https://github.com/CoreDB-io/coredb",
        "updatedAt": "2023-04-20 23:41:39.467896 +00:00:00"
        "publisher": "dummy"
      },
      {
        "createdAt": "2023-04-19 4:29:18.52241 +00:00:00",
        "description": "My incredible extension",
        "documentation": null,
        "homepage": "coredb.io",
        "version": "0.0.0",
        "license": "Apache-2.0",
        "name": "pgmq",
        "owners": [],
        "repository": "https://github.com/CoreDB-io/coredb",
        "updatedAt": "2023-04-20 22:41:39.467896 +00:00:00"
        "publisher": "dummy"
      },
      {
        "createdAt": "2023-04-18 4:29:18.52241 +00:00:00",
        "description": "My incredible extension",
        "documentation": null,
        "homepage": "coredb.io",
        "version": "0.0.0",
        "license": "Apache-2.0",
        "name": "pgmq",
        "owners": [],
        "repository": "https://github.com/CoreDB-io/coredb",
        "updatedAt": "2023-04-20 21:41:39.467896 +00:00:00"
        "publisher": "anotherdummy"
      },
    ]
    

From SyncLinear.com | COR-772

`trunk build` output should include `manifest.json`

trunk build output does not include manifest.json file. This file is required for trunk install. Outup file structure should look like:

❯ tar -tvf pgmq-0.2.1.tar.gz
-rw-rw-r-- ian/ian         279 2023-03-17 06:56 manifest.json
-rw-r--r-- ian/ian        2962 2023-03-16 14:25 pgmq--0.2.1.sql
-rwxr-xr-x ian/ian     2275640 2023-03-16 14:25 pgmq.so
-rw-r--r-- ian/ian         159 2023-03-16 14:25 pgmq.control

[COR-844] Test Extensions with Trunk CLI

Users should be able to test their extensions via Trunk CLI with a command like trunk test. Initially, tests should cover the following:

  • Test extension can be installed in a local, containerized postgres instance with trunk install
  • Test extension can be enabled with CREATE EXTENSION CASCADE;
  • Test we're able to run some function the extension provides (this might come later)

This will help avoid publishing extensions that do not function as expected.

From SyncLinear.com | COR-844

Tracking

Let's instrument cli to track events, so that we can show usage metrics on the web page for each extension

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.