-
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* just the docs, round 1 * update * fix * fix * fix * fix * Fix pages.yml * Update readme.md * Update readme.md * Update readme.md
- Loading branch information
Showing
7 changed files
with
287 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# Sample workflow for building and deploying a Jekyll site to GitHub Pages | ||
name: Deploy Jekyll site to Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
- "gh-pages-docs" | ||
paths: | ||
- "docs/**" | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: docs | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.3' # Not needed with a .ruby-version file | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
cache-version: 0 # Increment this number if you need to re-download cached gems | ||
working-directory: '${{ github.workspace }}/docs' | ||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v5 | ||
- name: Build with Jekyll | ||
# Outputs to the './_site' directory by default | ||
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | ||
env: | ||
JEKYLL_ENV: production | ||
- name: Upload artifact | ||
# Automatically uploads an artifact from the './_site' directory by default | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: "docs/_site/" | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Not sure what a .gitignore is? | ||
# See: https://git-scm.com/docs/gitignore | ||
|
||
# These are directly copied from Jekyll's first-party docs on `.gitignore` files: | ||
# https://jekyllrb.com/tutorials/using-jekyll-with-bundler/#commit-to-source-control | ||
|
||
# Ignore the default location of the built site, and caches and metadata generated by Jekyll | ||
_site/ | ||
.sass-cache/ | ||
.jekyll-cache/ | ||
.jekyll-metadata | ||
|
||
# Ignore folders generated by Bundler | ||
.bundle/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem "jekyll", "~> 4.3.3" # installed by `gem jekyll` | ||
# gem "webrick" # required when using Ruby >= 3 and Jekyll <= 4.2.2 | ||
|
||
gem "just-the-docs", "0.9.0" # pinned to the current release | ||
# gem "just-the-docs" # always download the latest release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
addressable (2.8.7) | ||
public_suffix (>= 2.0.2, < 7.0) | ||
bigdecimal (3.1.8) | ||
colorator (1.1.0) | ||
concurrent-ruby (1.3.4) | ||
em-websocket (0.5.3) | ||
eventmachine (>= 0.12.9) | ||
http_parser.rb (~> 0) | ||
eventmachine (1.2.7) | ||
ffi (1.17.0-arm64-darwin) | ||
ffi (1.17.0-x86_64-linux-gnu) | ||
forwardable-extended (2.6.0) | ||
google-protobuf (4.27.3-arm64-darwin) | ||
bigdecimal | ||
rake (>= 13) | ||
google-protobuf (4.27.3-x86_64-linux) | ||
bigdecimal | ||
rake (>= 13) | ||
http_parser.rb (0.8.0) | ||
i18n (1.14.5) | ||
concurrent-ruby (~> 1.0) | ||
jekyll (4.3.3) | ||
addressable (~> 2.4) | ||
colorator (~> 1.0) | ||
em-websocket (~> 0.5) | ||
i18n (~> 1.0) | ||
jekyll-sass-converter (>= 2.0, < 4.0) | ||
jekyll-watch (~> 2.0) | ||
kramdown (~> 2.3, >= 2.3.1) | ||
kramdown-parser-gfm (~> 1.0) | ||
liquid (~> 4.0) | ||
mercenary (>= 0.3.6, < 0.5) | ||
pathutil (~> 0.9) | ||
rouge (>= 3.0, < 5.0) | ||
safe_yaml (~> 1.0) | ||
terminal-table (>= 1.8, < 4.0) | ||
webrick (~> 1.7) | ||
jekyll-include-cache (0.2.1) | ||
jekyll (>= 3.7, < 5.0) | ||
jekyll-sass-converter (3.0.0) | ||
sass-embedded (~> 1.54) | ||
jekyll-seo-tag (2.8.0) | ||
jekyll (>= 3.8, < 5.0) | ||
jekyll-watch (2.2.1) | ||
listen (~> 3.0) | ||
just-the-docs (0.9.0) | ||
jekyll (>= 3.8.5) | ||
jekyll-include-cache | ||
jekyll-seo-tag (>= 2.0) | ||
rake (>= 12.3.1) | ||
kramdown (2.4.0) | ||
rexml | ||
kramdown-parser-gfm (1.1.0) | ||
kramdown (~> 2.0) | ||
liquid (4.0.4) | ||
listen (3.9.0) | ||
rb-fsevent (~> 0.10, >= 0.10.3) | ||
rb-inotify (~> 0.9, >= 0.9.10) | ||
mercenary (0.4.0) | ||
pathutil (0.16.2) | ||
forwardable-extended (~> 2.6) | ||
public_suffix (6.0.1) | ||
rake (13.2.1) | ||
rb-fsevent (0.11.2) | ||
rb-inotify (0.11.1) | ||
ffi (~> 1.0) | ||
rexml (3.3.5) | ||
strscan | ||
rouge (4.3.0) | ||
safe_yaml (1.0.5) | ||
sass-embedded (1.77.8-arm64-darwin) | ||
google-protobuf (~> 4.26) | ||
sass-embedded (1.77.8-x86_64-linux-gnu) | ||
google-protobuf (~> 4.26) | ||
strscan (3.1.0) | ||
terminal-table (3.0.2) | ||
unicode-display_width (>= 1.1.1, < 3) | ||
unicode-display_width (2.5.0) | ||
webrick (1.8.1) | ||
|
||
PLATFORMS | ||
arm64-darwin | ||
x86_64-linux-gnu | ||
|
||
DEPENDENCIES | ||
jekyll (~> 4.3.3) | ||
just-the-docs (= 0.9.0) | ||
|
||
BUNDLED WITH | ||
2.5.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
title: pg-boss Docs | ||
description: pg-boss Documentation | ||
theme: just-the-docs | ||
|
||
url: https://timgit.github.io/pg-boss | ||
|
||
color_scheme: dark | ||
|
||
aux_links: | ||
GitHub: https://github.com/timgit/pg-boss | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# pg-boss Docs | ||
|
||
Queueing jobs in Postgres from Node.js like a boss. | ||
|
||
[![npm version](https://badge.fury.io/js/pg-boss.svg)](https://badge.fury.io/js/pg-boss) | ||
[![Build](https://github.com/timgit/pg-boss/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/timgit/pg-boss/actions/workflows/ci.yml) | ||
[![Coverage Status](https://coveralls.io/repos/github/timgit/pg-boss/badge.svg?branch=master)](https://coveralls.io/github/timgit/pg-boss?branch=master) | ||
|
||
```js | ||
async function readme() { | ||
const PgBoss = require('pg-boss'); | ||
const boss = new PgBoss('postgres://user:pass@host/database'); | ||
|
||
boss.on('error', console.error) | ||
|
||
await boss.start() | ||
|
||
const queue = 'readme-queue' | ||
|
||
await boss.createQueue(queue) | ||
|
||
const id = await boss.send(queue, { arg1: 'read me' }) | ||
|
||
console.log(`created job ${id} in queue ${queue}`) | ||
|
||
await boss.work(queue, async ([ job ]) => { | ||
console.log(`received job ${job.id} with data ${JSON.stringify(job.data)}`) | ||
}) | ||
} | ||
|
||
readme() | ||
.catch(err => { | ||
console.log(err) | ||
process.exit(1) | ||
}) | ||
``` | ||
|
||
pg-boss is a job queue built in Node.js on top of PostgreSQL in order to provide background processing and reliable asynchronous execution to Node.js applications. | ||
|
||
pg-boss relies on [SKIP LOCKED](https://www.2ndquadrant.com/en/blog/what-is-select-skip-locked-for-in-postgresql-9-5/), a feature built specifically for message queues to resolve record locking challenges inherent with relational databases. This provides exactly-once delivery and the safety of guaranteed atomic commits to asynchronous job processing. | ||
|
||
This will likely cater the most to teams already familiar with the simplicity of relational database semantics and operations (SQL, querying, and backups). It will be especially useful to those already relying on PostgreSQL that want to limit how many systems are required to monitor and support in their architecture. | ||
|
||
|
||
## Summary | ||
* Exactly-once job delivery | ||
* Create jobs within your existing database transaction | ||
* Backpressure-compatible polling workers | ||
* Cron scheduling | ||
* Queue storage policies to support a variety of rate limiting, debouncing, and concurrency use cases | ||
* Priority queues, dead letter queues, job deferral, automatic retries with exponential backoff | ||
* Pub/sub API for fan-out queue relationships | ||
* Raw SQL support for non-Node.js runtimes via INSERT or COPY | ||
* Serverless function compatible | ||
* Multi-master compatible (for example, in a Kubernetes ReplicaSet) | ||
|
||
## Requirements | ||
* Node 20 or higher | ||
* PostgreSQL 13 or higher | ||
|
||
## Installation | ||
|
||
```bash | ||
# npm | ||
npm install pg-boss | ||
|
||
# yarn | ||
yarn add pg-boss | ||
``` | ||
|
||
## Documentation | ||
* [Docs](docs/readme.md) | ||
|
||
## Contributing | ||
To setup a development environment for this library: | ||
|
||
```bash | ||
git clone https://github.com/timgit/pg-boss.git | ||
npm install | ||
``` | ||
|
||
To run the test suite, linter and code coverage: | ||
```bash | ||
npm run cover | ||
``` | ||
|
||
The test suite will try and create a new database named pgboss. The [config.json](test/config.json) file has the default credentials to connect to postgres. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters