e972863be6
Signed-off-by: Sam Alba <sam.alba@gmail.com> |
||
---|---|---|
.. | ||
dagger-dev | ||
docker | ||
hello-world | ||
jamstack | ||
kubernetes-app | ||
kubernetes-aws | ||
mini | ||
monitoring | ||
react | ||
README.md |
Dagger Examples
All example commands should be executed in the examples/
directory
in an up-to-date checkout of the dagger repository.
Deploy a simple React application
This example shows how to deploy an example React Application. Read the deployment plan
Audience: Javascript developers looking to deploy their application.
Components:
- Netlify for application hosting
- Yarn for building
- Github for source code hosting
- React-Todo-App by Kabir Baidhya as a sample application.
- Change the current directory to the example deployment plan
cd ./react
- Create a new deployment from the plan
dagger new
- Configure the deployment with your Netlify access token. You can create new tokens from the Netlify dashboard.
dagger input text www.account.token MY_TOKEN
NOTE: there is a dedicated command for encrypted secret inputs, but it is not yet implemented. Coming soon!
- Deploy!
dagger up
Provision a Kubernetes cluster on AWS
This example shows how to provision a new Kubernetes cluster on AWS, and configure your kubectl
client to use it. Read the deployment plan
Audience: infrastructure teams looking to provisioning kubernetes clusters as part of automated CICD pipelines.
Components:
- Amazon EKS for Kubernetes hosting
- Amazon CloudFormation for infrastructure provisioning
- Kubectl as kubernetes client
- Change the current directory to the example deployment plan
cd ./kubernetes-aws
- Create a new deployment from the plan
dagger new
- Configure the deployment with your AWS credentials
dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY
dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY
- Deploy!
dagger up
- Export the generated kubectl config
dagger query kubeconfig.kubeconfig | jq . > kubeconfig
Add HTTP monitoring to your application
This example shows how to implement a robust HTTP(s) monitoring service on top of AWS. Read the deployment plan.
Audience: application team looking to improve the reliability of their application.
Components:
- Amazon Cloudwatch Synthetics for hosting the monitoring scripts
- Amazon CloudFormation for infrastructure provisioning
- Change the current directory to the example deployment plan
cd ./monitoring
- Create a new deployment from the plan
dagger new
- Configure the deployment with your AWS credentials
dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY
dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY
- Configure the monitoring parameters
dagger input text website https://MYWEBSITE.TLD
dagger input text email my_email@my_domain.tld
- Deploy!
dagger up
Deploy an application to your Kubernetes cluster
This example shows two different ways to deploy an application to an existing Kubernetes cluster: with and without a Helm chart. Read the deployment plan](https://github.com/dagger/dagger/tree/main/examples/kubernetes-app)
NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster.
Components:
- Amazon EKS for Kubernetes hosting
- Kubectl as kubernetes client
- Helm to manage kubernetes configuration (optional)
How to run:
- Change the current directory to the example deployment plan
cd ./kubernetes-app
- Create a new deployment from the plan
dagger new
- Configure the deployment with your AWS credentials
dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY
dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY
- Configure the EKS cluster to deploy to
Note: if you have run the kubernetes-aws
example, you may skip this step.
dagger input text cluster.clusterName MY_CLUSTER_NAME
- Load the Helm chart
dagger input dir helmChart.chart=./kubernetes-app/testdata/mychart
- Deploy!
dagger up