Code Monkey home page Code Monkey logo

django-polls-app-tilt-k8s-pg-minio's Introduction

Django (polls app) development in Kubernetes using Tilt with PostgreSQL, Adminer and MinIO installed using Helm.

Sample Django project demonstrating how to use Tilt with Helm to develop a Django application in Kubernetes. This project uses the polls app from the Django documentation and is configured to use PostgreSQL and MinIO as the database and file storage backend respectively.

Prerequisites

Optional Step 1 - Set the kubectl context to Docker Desktop

If you have multiple kubectl contexts, you can set the current context to Docker Desktop using the following command:

kubectl config get-contexts
kubectl config use-context docker-desktop

Step 2 - Install Tilt for macOs (if not already installed)

Follow the instructions on the Tilt website to install Tilt.

brew install tilt-dev/tap/tilt

Step 3 - Local development using Tilt

# Clone the repository
git clone https://github.com/garis-space/django-polls-app-tilt-k8s-pg-minio.git
cd django-polls-app-tilt-k8s-pg-minio

# Environment variables (edit as needed)
cp .env.example .env

When you run tilt up for the first time, Tilt will read .env file, set the environment variables and create secrets in the cluster for the Django app, PostgreSQL and minIO, then install Helm charts for PostgreSQL (with simple adminer database management), MinIO (with init buckets) and deploy the Django application (migrations and collectstatic will be run automatically) using previously created secrets to the local Kubernetes cluster. This will take a few minutes. Subsequent runs of tilt up will be much faster.

# Start Tilt
tilt up

Step 4 - Create a new superuser

From Tilt UI (http://localhost:10350), click from the left sidebar "django-polls" resource and then click the "create super user" button. This will create a new super user for the Django admin site with password from the DJANGO_SUPERUSER_PASSWORD environment variable.

Tilt UI Create superuser

Step 5 - Access the Django admin site

You can access the Django admin site at https://localhost:8000/admin. Login using the username and password from the DJANGO_SUPERUSER_USERNAME and DJANGO_SUPERUSER_PASSWORD environment variables.

Django admin site

Step 6 - Access the MinIO Console

You can access the MinIO Console at https://localhost:9001. Login using the username and password from the MINIO_ROOT_USER and MINIO_ROOT_PASSWORD environment variables.

MinIO Console

Step 7 - Access the Adminer PostgreSQL database management

You can access the Adminer PostgreSQL database management at https://localhost:8080. Login using the username and password from the POSTGRESQL_USER and POSTGRESQL_PASSWORD environment variables.

Adminer

Step 8 - Stop Tilt

Tilt will remove the Helm charts, secrets and the Django application from the local Kubernetes cluster.

tilt down

django-polls-app-tilt-k8s-pg-minio's People

Contributors

dependabot[bot] avatar garis-space avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.