Giter Site home page Giter Site logo

github-actions's Introduction

FerretDB

Go Reference

Go codecov

Security Packages Docs

FerretDB was founded to become the de-facto open-source substitute to MongoDB. FerretDB is an open-source proxy, converting the MongoDB 5.0+ wire protocol queries to SQL - using PostgreSQL or SQLite as a database engine.

flowchart LR
  A["Any application\nAny MongoDB driver"]
  F{{FerretDB}}
  P[(PostgreSQL)]
  S[("SQLite")]

  A -- "MongoDB protocol\nBSON" --> F
  F -- "PostgreSQL protocol\nSQL" --> P
  F -. "SQLite library\nSQL" .-> S

Why do we need FerretDB?

MongoDB was originally an eye-opening technology for many of us developers, empowering us to build applications faster than using relational databases. In its early days, its ease-to-use and well-documented drivers made MongoDB one of the simplest database solutions available. However, as time passed, MongoDB abandoned its open-source roots; changing the license to SSPL - making it unusable for many open source and early-stage commercial projects.

Most MongoDB users do not require any advanced features offered by MongoDB; however, they need an easy-to-use open-source document database solution. Recognizing this, FerretDB is here to fill that gap.

Scope and current state

FerretDB is compatible with MongoDB drivers and popular MongoDB tools. It functions as a drop-in replacement for MongoDB 5.0+ in many cases. Features are constantly being added to further increase compatibility and performance.

We welcome all contributors. See our public roadmap, a list of known differences with MongoDB, and contributing guidelines.

Quickstart

Run this command to start FerretDB with PostgreSQL backend:

docker run -d --rm --name ferretdb -p 27017:27017 ghcr.io/ferretdb/all-in-one

Alternatively, run this command to start FerretDB with SQLite backend:

docker run -d --rm --name ferretdb -p 27017:27017 -e FERRETDB_HANDLER=sqlite ghcr.io/ferretdb/all-in-one

This command will start a container with FerretDB, PostgreSQL/SQLite, and MongoDB Shell for quick testing and experiments. However, it is unsuitable for production use cases because it keeps all data inside and loses it on shutdown. See our Docker quickstart guide for instructions that don't have those problems.

With that container running, you can:

  • Connect to it with any MongoDB client application using MongoDB URI mongodb://127.0.0.1:27017/.
  • Connect to it using MongoDB Shell by just running mongosh. If you don't have it installed locally, you can run docker exec -it ferretdb mongosh.
  • For the PostgreSQL backend, connect to it by running docker exec -it ferretdb psql -U username ferretdb. FerretDB uses PostgreSQL schemas for MongoDB databases. So, if you created some collections in the test database using any MongoDB client, you can switch to it by running SET search_path = 'test'; query and see a list of PostgreSQL tables by running \d psql command.
  • For the SQLite backend, connect to it by running docker exec -it ferretdb sqlite3 /state/<database>.sqlite. So, if you created some collections in the test database using any MongoDB client, run docker exec -it ferretdb sqlite3 /state/test.sqlite and see a list of SQLite tables by running .tables command.

You can stop the container with docker stop ferretdb.

We also provide binaries and packages for various Linux distributions, as well as Go library package that embeds FerretDB into your application. See our documentation for more details.

Building and packaging

Note

We strongly advise users not to build FerretDB themselves. Instead, use binaries, Docker images, or packages provided by us.

FerretDB could be built as any other Go program, but a few generated files and build tags could affect it. See there for more details.

Managed FerretDB at cloud providers

Documentation

Community

If you want to contact FerretDB Inc., please use this form.

github-actions's People

Contributors

adetunjii avatar aleksi avatar chilagrow avatar dependabot[bot] avatar henvic avatar krishnasindhur avatar noisersup avatar rafiramadhana avatar ronaudinho avatar rumyantseva avatar seeforschauer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

github-actions's Issues

Check that the PR title starts with an imperative verb

// checkTitle checks if PR's title does not end with dot.
func checkTitle(_ *githubactions.Action, title string) error {
titleRegexp := regexp.MustCompile("[a-zA-Z0-9`'\"]$")
if match := titleRegexp.MatchString(title); !match {
return fmt.Errorf("PR title must end with a latin letter or digit.")
}
return nil
}

That function should also check that title start with an imperative verb ("Fix …", not "Fixing …", "Fixed …" or other forms).

We could probably use https://github.com/jdkato/prose/tree/v2 (despite it being archived) and check that the first token has the correct POS tag.

Read organization members

Some Conform PR checks will be different between PRs from the community and FerretDB organization members. We should read organization members and check if the PR author belongs to it.

Investigate GitHub's GraphQL API

For #45, we will need to start interacting with GitHub Projects (beta) via GraphQL API: https://docs.github.com/en/issues/trying-out-the-new-projects-experience/using-the-api-to-manage-projects

First, let's try querying that API manually via gh tool.

Second, let's investigate what Go modules we should use for that API (probably https://github.com/shurcooL/githubv4?)

Lastly, let's add some code to conform-pr GitHub Action that queries project's iteration for PRs.

Extract multiple Docker tags

For FerretDB/FerretDB#70, we want extract-docker-tag action to be able to return several tags. For PR branches, we should return a single tag like now, but for pushed git tags, we should return two Docker tags: version without v prefix and latest. To simplify migration, that probably should be a separate output field. It will be used by that code in FerretDB repo:

Add a unit test or test it with your own fork.

Use organization webhooks and log them

We want our Conform PR GitHub Action to check PR's Project fields after they are updated, but there is no such event to trigger an Action run. That's because Projects v2 are organization-scoped, and Actions are repository-scoped.

The solution is to install an organization webhook to receive Project v2 events, find matching PR, and schedule a new Conform PR run.

Let's create a simple service for it. It should use packages we already use (github.com/google/go-github and github.com/shurcooL/githubv4); it should not use any web or API framework. It should receive incoming webhooks, validate them by checking the signature, check secrets, find matching PR and schedule a new Conform PR run and just log them for now.

Webhook example:

X-Github-Event: projects_v2_item
X-Hub-Signature: sha1=5d9d657f2244700cab8e7996af2ce3ef476d5016
X-Hub-Signature-256: sha256=9c23e56fdae920dc6eb3754cd4f4272e1909b24da6d4ec3440684a6906d28051
{
    "action": "edited",
    "projects_v2_item": {
        "id": 8420853,
        "node_id": "PVTI_lADOBay1Kc4AEwi9zgCAffU",
        "project_node_id": "PVT_kwDOBay1Kc4AEwi9",
        "content_node_id": "PR_kwDOGfwnTc48u60R",
        "content_type": "PullRequest",
        "creator": {
            "login": "AlekSi",
            "id": 11512,
            "node_id": "MDQ6VXNlcjExNTEy"
        },
        "created_at": "2022-08-09T20:36:46Z",
        "updated_at": "2022-08-19T17:46:58Z",
        "archived_at": null
    },
    "changes": {
        "field_value": {
            "field_node_id": "PVTSSF_lADOBay1Kc4AEwi9zgCzrKM",
            "field_type": "single_select"
        }
    },
    "organization": {
        "login": "FerretDB",
        "id": 95204649,
        "node_id": "O_kgDOBay1KQ"
    },
    "sender": {
        "login": "AlekSi",
        "id": 11512,
        "node_id": "MDQ6VXNlcjExNTEy"
    }
}

The PR in question is #85.

Make our own git checkout action

That would checkout PR's HEAD SHA instead of merge commit that is not available for pull_request_target.
It also should checkout a named branch.

conform-pr: check PR title length

conform-pr action should check that the PR title (that is used as commit title on squash&merge) is not longer than 72 Unicode runes. That would prevent the truncation of commit messages in the GitHub UI. It also will make our changelogs better.

Make an action to extract URL from input file

We have a workflow that builds PR with documentation and deploys it to CloudFlare pages for preview. The way to see that preview URL is currently quite cumbersome. We should improve it.

Write a composite action (similar to extract-docker-tag, but much simpler) that reads "deploy.txt" file, extracts the first encountered URL, and sets the output parameter.

Use that action in the FerretDB workflow to use the deployment URL. See references to this issue.

Check Size field in PRs

Conform PR action should check that the pull request does not contain a Project v2 field (across all PR's projects) "Size" with a set value. That's because we agreed that only issues have Sizes, but not PRs.

Add basic PR verification action

Make a simple action in Go that verifies that PR's title does not end with dot as this does not work nicely with automatically generated release notes. Write tests for it.

Why make our own action instead of using some existing one? Because we will extend with our own logic later, which would be better than using (and updating) several external ones.

Check auto-merge commit title

// checkAutoMerge checks if PR's auto-merge is enabled.
func checkAutoMerge(_ *githubactions.Action, pr *graphql.PullRequest, community bool) error {
if pr.Closed || pr.AutoMerge {
return nil
}
msg := `PR should have auto-merge enabled.`
if community {
msg += ` Don't worry, maintainers will enable it for you.`
}
return errors.New(msg)
}

conform-pr's auto-merge checker should check that the commit_title property matches PR's subject number plus the PR number with # and brackets. That is to ensure that auto-merge generates the right commit subject line after the PR title is edited.

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.