Browse Source

Merge pull request #8555 from nocodb/fix/8549-add-support-to-deprecated-envs

fix: Litestream S3 - add support to deprecated env variables
pull/8566/head
Pranav C 6 months ago committed by GitHub
parent
commit
bc484166b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      packages/noco-docs/docs/020.getting-started/050.self-hosted/020.environment-variables.md
  2. 1
      packages/nocodb/Dockerfile
  3. 1
      packages/nocodb/docker/litestream.yml
  4. 11
      packages/nocodb/docker/start-litestream.sh

5
packages/noco-docs/docs/020.getting-started/050.self-hosted/020.environment-variables.md

@ -14,7 +14,7 @@ For production use cases, it is **recommended** to set at least:
- `NC_REDIS_URL` - `NC_REDIS_URL`
| Variable | Description | If absent | | Variable | Description | If absent |
| -------- | ----------- | --------- | | -------- | ----------- |-----------------------------------------------------------------------------------------------------|
| `NC_DB` | See our example database URLs [here](https://github.com/nocodb/nocodb#docker). | A local SQLite database is created in root folder if `NC_DB` is not set. | | `NC_DB` | See our example database URLs [here](https://github.com/nocodb/nocodb#docker). | A local SQLite database is created in root folder if `NC_DB` is not set. |
| `NC_DB_JSON` | Can be used instead of `NC_DB` and value should be valid knex connection JSON string. | | | `NC_DB_JSON` | Can be used instead of `NC_DB` and value should be valid knex connection JSON string. | |
| `NC_DB_JSON_FILE` | Can be used instead of `NC_DB` and value should be a valid path to knex connection JSON file. | | | `NC_DB_JSON_FILE` | Can be used instead of `NC_DB` and value should be a valid path to knex connection JSON file. | |
@ -68,7 +68,8 @@ For production use cases, it is **recommended** to set at least:
| `NC_ALLOW_LOCAL_HOOKS` | ⚠ Allow webhooks to call local links, which can raise security issues. ⚠ Set to `true` to enable, any other value is treated as `false` | Defaults to `false`. | | `NC_ALLOW_LOCAL_HOOKS` | ⚠ Allow webhooks to call local links, which can raise security issues. ⚠ Set to `true` to enable, any other value is treated as `false` | Defaults to `false`. |
| `NC_SANITIZE_COLUMN_NAME` | Sanitize the column name during column creation. Set to `true` to enable, any other value is treated as `false` | Defaults to `true`. | | `NC_SANITIZE_COLUMN_NAME` | Sanitize the column name during column creation. Set to `true` to enable, any other value is treated as `false` | Defaults to `true`. |
| `NODE_OPTIONS` | Node.js [options](https://nodejs.org/api/cli.html#node_optionsoptions) to pass to instance. | | | `NODE_OPTIONS` | Node.js [options](https://nodejs.org/api/cli.html#node_optionsoptions) to pass to instance. | |
| `LITESTREAM_S3_ENDPOINT` | URL of an S3-compatible object storage service endpoint for [Litestream](https://litestream.io/) replication of NocoDB's default SQLite database. Example: `s3.eu-central-1.amazonaws.com` | *Litestream replication is disabled if this variable is not set.* | | `LITESTREAM_S3_ENDPOINT` | URL of an S3-compatible object storage service endpoint for [Litestream](https://litestream.io/) replication of NocoDB's default SQLite database. Example: `s3.eu-central-1.amazonaws.com` | Fallback to default AWS s3 endpoint |
| `LITESTREAM_S3_REGION` | AWS region of the Litestream replication object storage bucket. | If not configured it will fallback to the default region, check litestream docs for more info |
| `LITESTREAM_S3_BUCKET` | Name of the object storage bucket to store the Litestream replication in. | *Litestream replication is disabled if this variable is not set.* | | `LITESTREAM_S3_BUCKET` | Name of the object storage bucket to store the Litestream replication in. | *Litestream replication is disabled if this variable is not set.* |
| `LITESTREAM_S3_PATH` | Directory path to use within the Litestream replication object storage bucket. | Defaults to `nocodb`. | | `LITESTREAM_S3_PATH` | Directory path to use within the Litestream replication object storage bucket. | Defaults to `nocodb`. |
| `LITESTREAM_S3_ACCESS_KEY_ID` | Authentication key ID for the Litestream replication object storage bucket. | *Litestream replication is disabled if this variable is not set.* | | `LITESTREAM_S3_ACCESS_KEY_ID` | Authentication key ID for the Litestream replication object storage bucket. | *Litestream replication is disabled if this variable is not set.* |

1
packages/nocodb/Dockerfile

@ -51,7 +51,6 @@ FROM alpine:3.19
WORKDIR /usr/src/app WORKDIR /usr/src/app
ENV LITESTREAM_S3_SKIP_VERIFY=false \ ENV LITESTREAM_S3_SKIP_VERIFY=false \
LITESTREAM_S3_PATH=nocodb \
LITESTREAM_RETENTION=1440h \ LITESTREAM_RETENTION=1440h \
LITESTREAM_RETENTION_CHECK_INTERVAL=72h \ LITESTREAM_RETENTION_CHECK_INTERVAL=72h \
LITESTREAM_SNAPSHOT_INTERVAL=24h \ LITESTREAM_SNAPSHOT_INTERVAL=24h \

1
packages/nocodb/docker/litestream.yml

@ -6,6 +6,7 @@ dbs:
- type: s3 - type: s3
endpoint: ${LITESTREAM_S3_ENDPOINT} endpoint: ${LITESTREAM_S3_ENDPOINT}
force-path-style: true force-path-style: true
region: ${LITESTREAM_S3_REGION}
skip-verify: ${LITESTREAM_S3_SKIP_VERIFY} skip-verify: ${LITESTREAM_S3_SKIP_VERIFY}
bucket: ${LITESTREAM_S3_BUCKET} bucket: ${LITESTREAM_S3_BUCKET}
path: ${LITESTREAM_S3_PATH} path: ${LITESTREAM_S3_PATH}

11
packages/nocodb/docker/start-litestream.sh

@ -11,6 +11,13 @@ fi
if [ -z "${LITESTREAM_S3_SECRET_ACCESS_KEY}" ] && [ -n "${AWS_SECRET_ACCESS_KEY}" ] ; then if [ -z "${LITESTREAM_S3_SECRET_ACCESS_KEY}" ] && [ -n "${AWS_SECRET_ACCESS_KEY}" ] ; then
export LITESTREAM_S3_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" export LITESTREAM_S3_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}"
fi fi
if [ -z "${LITESTREAM_S3_PATH}" ] && -n [ "${AWS_BUCKET_PATH}" ] ; then
export LITESTREAM_S3_PATH="${AWS_BUCKET_PATH}"
fi
if [ -z "${LITESTREAM_S3_BUCKET}" ] && [ -n "${AWS_BUCKET}" ] ; then
export LITESTREAM_S3_BUCKET="${AWS_BUCKET}"
fi
use_litestream() { use_litestream() {
[ -z "${NC_DB}" ] \ [ -z "${NC_DB}" ] \
@ -19,7 +26,6 @@ use_litestream() {
&& [ -z "${DATABASE_URL}" ] \ && [ -z "${DATABASE_URL}" ] \
&& [ -z "${DATABASE_URL_FILE}" ] \ && [ -z "${DATABASE_URL_FILE}" ] \
&& [ -z "${NC_MINIMAL_DBS}" ] \ && [ -z "${NC_MINIMAL_DBS}" ] \
&& [ -n "${LITESTREAM_S3_ENDPOINT}" ] \
&& [ -n "${LITESTREAM_S3_BUCKET}" ] \ && [ -n "${LITESTREAM_S3_BUCKET}" ] \
&& [ -n "${LITESTREAM_S3_ACCESS_KEY_ID}" ] \ && [ -n "${LITESTREAM_S3_ACCESS_KEY_ID}" ] \
&& [ -n "${LITESTREAM_S3_SECRET_ACCESS_KEY}" ] && [ -n "${LITESTREAM_S3_SECRET_ACCESS_KEY}" ]
@ -27,6 +33,9 @@ use_litestream() {
if use_litestream ; then if use_litestream ; then
# set default bucket path if not provided
: "${LITESTREAM_S3_PATH:=nocodb}"
# enable age encryption in Litestream config if indicated # enable age encryption in Litestream config if indicated
LITESTREAM_CONFIG_PATH='/etc/litestream.yml' LITESTREAM_CONFIG_PATH='/etc/litestream.yml'

Loading…
Cancel
Save