Skip to content

Commit d718f91

Browse files
authored
Merge pull request #145 from DefangLabs/18-nocodb-sample
18 nocodb sample
2 parents 1343c2f + 8bf2bb1 commit d718f91

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout Repo
17+
uses: actions/checkout@v4
18+
19+
- name: Deploy
20+
uses: DefangLabs/[email protected]

samples/nocodb/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pg_data
2+
*.log

samples/nocodb/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# NocoDB
2+
3+
This sample demonstrates how to deploy a Nocodb instance with Defang. It's an open source alternative to AirTable, that makes it easy to organize and manage data.
4+
5+
## Prerequisites
6+
7+
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
8+
2. A Postgres database
9+
3. S3 bucket and credentials, or S3 compatible alternative
10+
4. (Optional) If you are using [Defang BYOC](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) authenticated with your AWS account
11+
5. (Optional - for local development) [Docker CLI](https://docs.docker.com/engine/install/)
12+
13+
## Configuration
14+
15+
For this sample, you will need to provide the following [configuration](https://docs.defang.io/docs/concepts/configuration):
16+
17+
### `NC_DB`
18+
Postgres database URL. NocoDB uses an odd, custom format for this. It should look like this: `pg://my.pg.hostname.com:5432?u=postgres&p=password&d=nocodb&ssl=true`. [Neon](https://neon.tech/) has a free tier and is easy to set up.
19+
20+
### `NC_S3_ENDPOINT`
21+
S3 endpoint URL. [Wasabi](https://wasabi.com/) is a simple option for this if you don't already have an S3 bucket or don't have an AWS account you can use.
22+
23+
### `NC_S3_BUCKET_NAME`
24+
Name of the S3 bucket.
25+
26+
### `NC_S3_REGION`
27+
Region of the S3 bucket.
28+
29+
### `NC_S3_ACCESS_KEY`
30+
Access key for the S3 bucket.
31+
32+
### `NC_S3_ACCESS_SECRET`
33+
Access secret for the S3 bucket.
34+
35+
## Deploying
36+
37+
1. Open the terminal and type `defang login`
38+
2. Use the deploy the configuration values specified above using the [`defang config set` command](https://docs.defang.io/docs/concepts/configuration).
39+
2. Type `defang compose up` in the CLI.
40+
3. Your app will be running within a few minutes.
41+
42+
## Development
43+
44+
For development, we use a local postgres container and a volume mount for file uploads. To run the app locally, just run:
45+
46+
`docker compose --file compose.dev.yaml up`
47+
48+
---
49+
50+
Title: NocoDB
51+
52+
Short Description: An open source alternative to AirTable
53+
54+
Tags: NocoDB
55+
56+
Languages: Dockerfile

samples/nocodb/compose.dev.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
services:
2+
nocodb:
3+
extends:
4+
file: compose.yaml
5+
service: nocodb
6+
depends_on:
7+
- postgres
8+
environment:
9+
NC_DB: pg://postgres:5432?u=postgres&p=password&d=nocodb
10+
volumes:
11+
- "nocodb_data:/usr/app/data"
12+
13+
postgres:
14+
environment:
15+
POSTGRES_DB: nocodb
16+
POSTGRES_PASSWORD: password
17+
POSTGRES_USER: postgres
18+
image: postgres:12
19+
volumes:
20+
- "postgres_data:/var/lib/postgresql/data"
21+
22+
volumes:
23+
postgres_data: {}
24+
nocodb_data: {}

samples/nocodb/compose.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
services:
2+
nocodb:
3+
image: "nocodb/nocodb:0.252.0"
4+
environment:
5+
NC_DB:
6+
NC_S3_ENDPOINT:
7+
NC_S3_BUCKET_NAME:
8+
NC_S3_REGION:
9+
NC_S3_ACCESS_KEY:
10+
NC_S3_ACCESS_SECRET:
11+
ports:
12+
- target: 8080
13+
published: 8080
14+
mode: ingress

0 commit comments

Comments
 (0)