From 00e10219ca04ebf018a982571562fba3ee446caa Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 27 Sep 2021 12:33:01 -0600 Subject: [PATCH] additional progress Signed-off-by: Richard Jones --- docs/learn/1003-get-started.md | 58 +++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/docs/learn/1003-get-started.md b/docs/learn/1003-get-started.md index d29efe58..cd6be47f 100644 --- a/docs/learn/1003-get-started.md +++ b/docs/learn/1003-get-started.md @@ -24,13 +24,13 @@ In this tutorial we will learn: ## Deploy an Application Locally The following instructions assume you are working locally, but could just as easily be run on a remote -machine into which you have a shell. +machine into which you have a shell. For the sake of brevity and simplicity we will create directories under +your home directory, but feel free to replace `~/` with a path that works best for you. ### Install Dagger First, make sure [you have installed Dagger](../1001-install.md). You can run `dagger version` to ensure -you have the latest installed and working. For the sake of brevity and simplicity we will create directories under -your home directory, but feel free to replace `~/` with a path that works best for you. +you have the latest installed and working. ### Create a Dagger Project @@ -53,4 +53,54 @@ Dagger will load all `.cue` files recursively in the current Dagger project. Mor ### Write a Dagger Plan -A Dagger _plan_ is written in CUE and declaratively expresses the _resources_, _dependencies_, and _logic_ to deploy an application to an environment. +A Dagger _plan_ is written in CUE and expresses the _resources_, _dependencies_, and _logic_ to deploy an application to an environment. Unlike traditional glue code written in an scripting language (e.g.: Bash, PowerShell), a Dagger plan is _declarative_ rather than _imperative_. This frees us from thinking about order of operations, since Dagger will infer dependendencies and calculate correct order on its own. + +First create a directory to hold our plan, separate from our application code: + +```shell +mkdir ./plan +``` + +Next, create a file in `plan/` called `todoapp.cue` with the following content + +```cue +package todoapp + +import ( + "alpha.dagger.io/dagger" + "alpha.dagger.io/dagger/stream" + "alpha.dagger.io/js/yarn" +) + +// Source code of the sample application +source: dagger.#Artifact & dagger.#Input + +// Build the source code using Yarn +app: yarn.#Package & { + "source": source +} + +``` + +### Create an Environment + +```shell +dagger new local -p ./plan +dagger list +``` + +### Define Input Values per Environment + +```shell +dagger input list +``` + +```text +Input Value Set by user Description +app.source dagger.#Artifact false Application source code +``` + +```shell +dagger -e local input dir app.source ./app +``` +