Easy local development with Kubernetes, without Docker.
This example uses the MERN Stack Example application from MongoDB to show how to containerize and run an existing application in Tilt and Rancher Desktop.
- Install Rancher Desktop.
- Install Tilt.
- Clone this repository to your machine.
- Run
git submodule init
andgit submodule update
to clone the mern-stack-example code into themern-stack-example
directory. - Run
tilt up
. (Note that when you quit Tilt with ctrl-C, the k8s workloads continue to run in the background. Runtilt down
to destroy them.) - Navigate to Tilt dashboard at http://localhost:10350/ to watch service startup.
- Navigate to web interface at http://localhost:3000/.
- Tiltfile: Tilt configuration for local dev
- ./pipeline: Pipeline configuration files to support the example application
- ./pipeline/build: Dockerfiles to build the MERN example applications
- ./pipeline/helm-charts: Helm charts for the MERN example applications
- ./pipeline/values: Helm value overrides files for the MongoDB Helm chart
This example includes 3 services:
- mongodb: Loaded from Bitnami MongoDB Helm chart
- client: A React web application
- server: An Express API service
These service have been copied / adapted from https://github.com/mongodb-developer/mern-stack-example.
The mongodb
service is installed from the Bitnami helm chart. The MERN example applications are from
MongoDB's MERN Stack example application
Both client
and server
have live updates enabled. If any files in the source directory are
changed, Tilt will copy them into the running container.
Individual services are also exposed directly on different ports - see the Tilt dashboard for links to individual services.
- http://localhost:3000/ - mapped to
client
- http://localhost:5000/ - mapped to
server
- Please we've encounterer problem when running npm install with package-lock.json in mern-stack-example/mern/client. Please try to run 'npm i' locally first. If it still failed please switch to node 14.x