diff --git a/samples/nocodb/.github/workflows/deploy.yaml b/samples/nocodb/.github/workflows/deploy.yaml new file mode 100644 index 00000000..84d3dcf4 --- /dev/null +++ b/samples/nocodb/.github/workflows/deploy.yaml @@ -0,0 +1,20 @@ +name: Deploy + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Deploy + uses: DefangLabs/defang-github-action@v1.0.4 \ No newline at end of file diff --git a/samples/nocodb/.gitignore b/samples/nocodb/.gitignore new file mode 100644 index 00000000..e84220b5 --- /dev/null +++ b/samples/nocodb/.gitignore @@ -0,0 +1,2 @@ +pg_data +*.log \ No newline at end of file diff --git a/samples/nocodb/README.md b/samples/nocodb/README.md new file mode 100644 index 00000000..7a6a6d76 --- /dev/null +++ b/samples/nocodb/README.md @@ -0,0 +1,56 @@ +# NocoDB + +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. + +## Prerequisites + +1. Download [Defang CLI](https://github.com/DefangLabs/defang) +2. A Postgres database +3. S3 bucket and credentials, or S3 compatible alternative +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 +5. (Optional - for local development) [Docker CLI](https://docs.docker.com/engine/install/) + +## Configuration + +For this sample, you will need to provide the following [configuration](https://docs.defang.io/docs/concepts/configuration): + +### `NC_DB` +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. + +### `NC_S3_ENDPOINT` +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. + +### `NC_S3_BUCKET_NAME` +Name of the S3 bucket. + +### `NC_S3_REGION` +Region of the S3 bucket. + +### `NC_S3_ACCESS_KEY` +Access key for the S3 bucket. + +### `NC_S3_ACCESS_SECRET` +Access secret for the S3 bucket. + +## Deploying + +1. Open the terminal and type `defang login` +2. Use the deploy the configuration values specified above using the [`defang config set` command](https://docs.defang.io/docs/concepts/configuration). +2. Type `defang compose up` in the CLI. +3. Your app will be running within a few minutes. + +## Development + +For development, we use a local postgres container and a volume mount for file uploads. To run the app locally, just run: + +`docker compose --file compose.dev.yaml up` + +--- + +Title: NocoDB + +Short Description: An open source alternative to AirTable + +Tags: NocoDB + +Languages: Dockerfile diff --git a/samples/nocodb/compose.dev.yaml b/samples/nocodb/compose.dev.yaml new file mode 100644 index 00000000..320646a9 --- /dev/null +++ b/samples/nocodb/compose.dev.yaml @@ -0,0 +1,24 @@ +services: + nocodb: + extends: + file: compose.yaml + service: nocodb + depends_on: + - postgres + environment: + NC_DB: pg://postgres:5432?u=postgres&p=password&d=nocodb + volumes: + - "nocodb_data:/usr/app/data" + + postgres: + environment: + POSTGRES_DB: nocodb + POSTGRES_PASSWORD: password + POSTGRES_USER: postgres + image: postgres:12 + volumes: + - "postgres_data:/var/lib/postgresql/data" + +volumes: + postgres_data: {} + nocodb_data: {} diff --git a/samples/nocodb/compose.yaml b/samples/nocodb/compose.yaml new file mode 100644 index 00000000..1e5fc59d --- /dev/null +++ b/samples/nocodb/compose.yaml @@ -0,0 +1,14 @@ +services: + nocodb: + image: "nocodb/nocodb:0.252.0" + environment: + NC_DB: + NC_S3_ENDPOINT: + NC_S3_BUCKET_NAME: + NC_S3_REGION: + NC_S3_ACCESS_KEY: + NC_S3_ACCESS_SECRET: + ports: + - target: 8080 + published: 8080 + mode: ingress