Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .eslintrc.json

This file was deleted.

53 changes: 53 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
version: 2
updates:
# deps
- package-ecosystem: npm
target-branch: 'master'
schedule:
interval: weekly
allow:
- dependency-type: production
directory: /
commit-message:
prefix: 'deps'
groups:
map-colonies:
patterns:
- '@map-colonies/*'
opentelemetry:
patterns:
- '@opentelemetry/*'
aws-sdk:
patterns:
- '@aws-sdk/*'
patch:
update-types:
- patch
# dev-deps
- package-ecosystem: npm
schedule:
interval: weekly
allow:
- dependency-type: development
directory: /
commit-message:
prefix: 'devdeps'
groups:
map-colonies:
patterns:
- '@map-colonies/*'
types:
patterns:
- '@types/*'
dev-patch:
update-types:
- patch

# github deps
- package-ecosystem: github-actions
schedule:
interval: weekly
commit-message:
prefix: 'ci'
directory: '/'
73 changes: 73 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: pull_request

on: pull_request

permissions:
contents: read
pull-requests: read

jobs:
eslint:
name: Run TS Project eslint
runs-on: ubuntu-latest

strategy:
matrix:
node: [24.x]

steps:
- name: Check out Git repository
uses: actions/checkout@v6

- name: Init Nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1
with:
node-version: ${{ matrix.node }}

- name: Run linters
uses: wearerequired/lint-action@v2
with:
eslint: true
prettier: true
eslint_extensions: ts
tsc: true

helm-lint:
name: Run Helm lint Check
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Helm Lint Checks
uses: MapColonies/shared-workflows/actions/helm-lint@helm-lint-v1

# security scanning on PRs is handled by the separate snyk.yml workflow

tests:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
node: [24.x]
steps:
- name: Check out Git repository
uses: actions/checkout@v6

- name: Init Nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1
with:
node-version: ${{ matrix.node }}

- name: Run tests
run: npm run test

- name: Upload test/coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: Test Report Node-${{ matrix.node }}
path: html/**
21 changes: 21 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v5
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
token: ${{ secrets.GH_PAT }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ lib-cov
coverage
*.lcov

# vitest html reporter output
html

# nyc test coverage
.nyc_output

Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit ${1}
6 changes: 6 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Skip Husky install in production and CI
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0);
}
const husky = (await import('husky')).default;
console.log(husky());
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx pretty-quick --staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v24
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ node_modules
*.html
coverage
helm
html
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "6.1.0"
}
16 changes: 0 additions & 16 deletions .versionrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=16
ARG NODE_VERSION=24

FROM ubuntu:20.04 AS buildPlanetDumpNg

Expand Down
48 changes: 42 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,71 @@ Options:
"post-clean-workdir", "post-clean-all"] [default: "none"]
```

### schedule
Runs the `create` or `pg_dump` pipeline repeatedly on a cron schedule, in-process (using [node-cron](https://github.com/merencia/node-cron)), instead of exiting after a single run. Accepts every option from `create`/`pg_dump` above (only the options relevant to `--target` are required), plus:
```
index.js schedule

run the create or pg_dump pipeline repeatedly on a cron schedule

Options:
--version Show version number [boolean]
-h, --help Show help [boolean]
--target which pipeline to run on each
scheduled tick
[string] [required] [choices: "create", "pg_dump"]
--cronExpression, --cron-expression a cron expression controlling the
schedule [string] [required]
--runOnInit, --run-on-init immediately run the pipeline once at
startup, before waiting for the
first scheduled tick
[boolean] [default: false]
```
A tick is skipped (with a warning logged) if the previous run is still in progress, so runs never overlap. The process shuts down gracefully on `SIGTERM`/`SIGINT`.

## Deployment Modes

- One-shot (`pg_dump`/`create`): for manual or CI-triggered runs, or a Kubernetes `Job`. The process exits after a single run.
- Recurring (`schedule`): for a long-running Kubernetes `Deployment` (a single always-on pod) that schedules its own dumps internally — no external scheduler needed.

## Cli Environment Variables

Any option that can be set using the cli command line, can be also set by writing its value in `SNAKE_CASE`.
For example, the option `--s3-bucket-name` can be set by using the `S3_BUCKET_NAME` environment variables.

## Configuration

Application configuration (as opposed to per-invocation CLI options) is validated against the
[`vector/planetDumper`](https://github.com/MapColonies/schemas) schema via
[`@map-colonies/config`](https://github.com/MapColonies/config). Defaults live in `config/default.json`;
every field's environment variable override is defined on the schema itself (`x-env-value`), so there is
no separate `custom-environment-variables.json` to keep in sync. By default the app runs in offline mode
(reading only the local `config/` files, no config-server dependency) - set `CONFIG_OFFLINE_MODE=false`
and `CONFIG_SERVER_URL` to use a remote config-server instead.

**Env Variables**

Required environment variables:
Required environment variables (native to `pg_dump`/`psql`, not part of the schema-managed config -
these are read directly by the postgres binaries, not by planet-dumper's own code):

- `PGHOST` - Database host
- `PGDATABASE` - Database name
- `PGUSER` - Database user
- `PGPASSWORD` - Database user's password
- `PGPORT` - Database's port
- `POSTGRES_ENABLE_SSL_AUTH` - flag for enabling postgres certificate, auth set as 'true' for enabling any other value will be falsy

Optional environment variables:

- `POSTGRES_ENABLE_SSL_AUTH` - flag for enabling postgres certificate auth, defaults to `false`
- `PG_DUMP_VERBOSE` - verbose flag for pg_dump defaults to false
- `NG_DUMP_MAX_CONCURRENCY` - maximum number of disk writing threads to run for *each* table
- `HTTP_CLIENT_TIMEOUT` - http client timeout duration in ms, defaults to 1000ms

Required if `POSTGRES_ENABLE_SSL_AUTH` is true:

- `POSTGRES_SSL_CERT` - path to cert file
- `POSTGRES_SSL_KEY` - path to cert auth kay
- `POSTGRES_SSL_ROOT_CERT` - path to root cert
- `POSTGRES_CA_PATH` - path to the root CA certificate file
- `POSTGRES_CERT_PATH` - path to the client certificate file
- `POSTGRES_KEY_PATH` - path to the client certificate key file

**Exit Codes:**

Expand All @@ -103,7 +139,7 @@ Required if `POSTGRES_ENABLE_SSL_AUTH` is true:
## Building and Running

### Build argument variables
- `NODE_VERSION` - the version of node, defaults to 16
- `NODE_VERSION` - the version of node, defaults to 24
- `PLANET_DUMP_NG_TAG` - the version of planet-dump-ng, defaults to v1.2.7
- `POSTGRESQL_VERSION` - the version of postgresql-client to be installed, by default version 15
notice that the postgresql-client version should be determined by your postgresql database version, tested on versions 12, 13, 14 and 15 of postgres.
Expand Down
8 changes: 4 additions & 4 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
"scope-enum": [2, "always", ["deps", "configurations"]],
}
extends: ['@map-colonies/commitlint-config'],
rules: {
'scope-enum': [2, 'always', ['deps', 'configurations']],
},
};
Loading
Loading