Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/defanglabs/jupyter-postgres-demo
https://github.com/defanglabs/jupyter-postgres-demo
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/defanglabs/jupyter-postgres-demo
- Owner: DefangLabs
- Created: 2024-12-07T15:44:52.000Z (18 days ago)
- Default Branch: main
- Last Pushed: 2024-12-07T16:49:04.000Z (18 days ago)
- Last Synced: 2024-12-07T17:17:42.387Z (18 days ago)
- Language: Jupyter Notebook
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jupyter & Postgres
[![1-click-deploy](https://defang.io/deploy-with-defang.png)](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-jupyter-postgres-template%26template_owner%3DDefangSamples)
This sample shows you how to spin up a postgres database and a Jupyter notebook server. This is useful if you want to use Jupyter notebooks to read data from or persist data to a database.
## Prerequisites
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)## Development
To run the application locally, you can use the following command:
```bash
docker compose -f compose.dev.yaml up --build
```## Configuration
For this sample, you will need to provide the following [configuration](https://docs.defang.io/docs/concepts/configuration):
> Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
### `POSTGRES_PASSWORD`
The password to use for the postgres database.
```bash
defang config set POSTGRES_PASSWORD
```### `JUPYTER_TOKEN`
The token to access your Jupyter notebook server.
```bash
defang config set JUPYTER_TOKEN
```## Deployment
> [!NOTE]
> Download [Defang CLI](https://github.com/DefangLabs/defang)### Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
```bash
defang compose up
```### BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
1. [Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
2. Run in a terminal that has access to your AWS environment variables:
```bash
defang --provider=aws compose up
```---
Title: Jupyter & Postgres
Short Description: This sample shows you how to spin up a postgres database and a Jupyter notebook server.
Tags: Jupyter, Postgres, Database
Languages: Python, SQL