docs: added missing dagger init

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-10-05 18:59:34 -07:00
parent d39cc200ca
commit 91ad12bff1
6 changed files with 40 additions and 5 deletions

View File

@ -170,6 +170,7 @@ push.ref "localhost:5000/todoapp:latest@sha256:<hash>" Image ref
push.digest "sha256:<hash>" Image digest push.digest "sha256:<hash>" Image digest
run.ref "localhost:5000/todoapp:latest@sha256:<hash>" Image reference (e.g: nginx:alpine) run.ref "localhost:5000/todoapp:latest@sha256:<hash>" Image reference (e.g: nginx:alpine)
run.run.env.IMAGE_REF "localhost:5000/todoapp:latest@sha256:<hash>" - run.run.env.IMAGE_REF "localhost:5000/todoapp:latest@sha256:<hash>" -
appURL "http://localhost:8080/" Application URL
``` ```
Congratulations! You&rsquo;ve deployed your first Dagger plan! You can now [view the todo app](http://localhost:8080) in your browser! Congratulations! You&rsquo;ve deployed your first Dagger plan! You can now [view the todo app](http://localhost:8080) in your browser!

View File

@ -92,7 +92,7 @@ Otherwise, don't worry: a Cue module is simply a directory with one or more Cue
This guide will use the same directory as the root of the Dagger project and the Cue module, but you can create your Cue module anywhere inside the Dagger project. In general, you won't have to worry about it at all. You will initialize a dagger project with the following command. This guide will use the same directory as the root of the Dagger project and the Cue module, but you can create your Cue module anywhere inside the Dagger project. In general, you won't have to worry about it at all. You will initialize a dagger project with the following command.
```shell ```shell
dagger init # Optional, already present in `todoapp` dagger init
``` ```
> In our case, `todoapp` already contains a `.dagger` directory, so this step is optional. > In our case, `todoapp` already contains a `.dagger` directory, so this step is optional.

View File

@ -36,13 +36,20 @@ mkdir gcpcloudrun
### Create a basic plan ### Create a basic plan
```cue file=./tests/gcpcloudrun/source.cue title="todoapp/cue.mod/gcpcloudrun/source.cue" ```cue file=./tests/gcpcloudrun/source.cue title="todoapp/cue.mod/gcpcloudrun/source.cue"
``` ```
## Set up the environment ## Set up the environment
### Create a new environment ### Create a new environment
Now that your Cue package is ready, let's create an environment to run it: Let's create a project:
```shell
dagger init
```
Let's create an environment to run it:
```shell ```shell
dagger new 'gcpcloudrun' -p ./gcpcloudrun dagger new 'gcpcloudrun' -p ./gcpcloudrun

View File

@ -151,6 +151,7 @@ kubectl delete -f k8s/
Create a file named `todoapp.cue` and add the following configuration to it. Create a file named `todoapp.cue` and add the following configuration to it.
```cue file=tests/kube-kind/basic/todoapp.cue title="todoapp/kube/todoapp.cue" ```cue file=tests/kube-kind/basic/todoapp.cue title="todoapp/kube/todoapp.cue"
``` ```
This defines a `todoApp` variable containing the Kubernetes objects used to create a todoapp deployment. It also This defines a `todoApp` variable containing the Kubernetes objects used to create a todoapp deployment. It also
@ -169,6 +170,7 @@ The following `config.cue` defines:
- `kubeconfig` a generic value created to embed this string `kubeconfig` value - `kubeconfig` a generic value created to embed this string `kubeconfig` value
```cue file=tests/kube-kind/config.cue title="todoapp/kube/config.cue" ```cue file=tests/kube-kind/config.cue title="todoapp/kube/config.cue"
``` ```
</TabItem> </TabItem>
@ -183,6 +185,7 @@ The below `config.cue` defines:
using `alpha.dagger.io/gcp/gke` using `alpha.dagger.io/gcp/gke`
```cue file=tests/kube-gcp/basic/config.cue title="todoapp/kube/config.cue" ```cue file=tests/kube-gcp/basic/config.cue title="todoapp/kube/config.cue"
``` ```
</TabItem> </TabItem>
@ -197,6 +200,7 @@ The below `config.cue` defines:
using `alpha.dagger.io/aws/eks` using `alpha.dagger.io/aws/eks`
```cue file=tests/kube-aws/basic/config.cue title="todoapp/kube/config.cue" ```cue file=tests/kube-aws/basic/config.cue title="todoapp/kube/config.cue"
``` ```
</TabItem> </TabItem>
@ -207,7 +211,13 @@ The below `config.cue` defines:
#### Create a new environment #### Create a new environment
Now that your Cue package is ready, let's create an environment to run it: Let's create a project:
```shell
dagger init
```
Let's create an environment to run it:
```shell ```shell
dagger new 'kube' -p kube dagger new 'kube' -p kube
@ -390,6 +400,7 @@ Let's see how to deploy an image locally and push it to the local cluster
- `kustomization`, apply kustomization to image - `kustomization`, apply kustomization to image
```cue file=tests/kube-kind/deployment/todoapp.cue title="todoapp/kube/todoapp.cue" ```cue file=tests/kube-kind/deployment/todoapp.cue title="todoapp/kube/todoapp.cue"
``` ```
</TabItem> </TabItem>
@ -406,6 +417,7 @@ The two files have to be edited to do so.
- definition of a new `gcrCreds` value that contains ecr credentials for remote image push to GCR - definition of a new `gcrCreds` value that contains ecr credentials for remote image push to GCR
```cue file=tests/kube-gcp/deployment/config.cue title="todoapp/kube/config.cue" ```cue file=tests/kube-gcp/deployment/config.cue title="todoapp/kube/config.cue"
``` ```
`kube/todoapp.cue`, on the other hand, faces these changes: `kube/todoapp.cue`, on the other hand, faces these changes:
@ -417,6 +429,7 @@ The two files have to be edited to do so.
- `kustomization`, apply kustomization to image - `kustomization`, apply kustomization to image
```cue file=tests/kube-gcp/deployment/todoapp.cue title="todoapp/kube/todoapp.cue" ```cue file=tests/kube-gcp/deployment/todoapp.cue title="todoapp/kube/todoapp.cue"
``` ```
</TabItem> </TabItem>
@ -432,6 +445,7 @@ The two files have to be edited to do so.
- definition of a new `ecrCreds` value that contains ecr credentials for remote image push to ECR - definition of a new `ecrCreds` value that contains ecr credentials for remote image push to ECR
```cue file=tests/kube-aws/deployment/config.cue title="todoapp/kube/config.cue" ```cue file=tests/kube-aws/deployment/config.cue title="todoapp/kube/config.cue"
``` ```
`kube/todoapp.cue`, on the other hand, faces these changes: `kube/todoapp.cue`, on the other hand, faces these changes:
@ -443,6 +457,7 @@ The two files have to be edited to do so.
- `kustomization`, apply kustomization to image - `kustomization`, apply kustomization to image
```cue file=tests/kube-aws/deployment/todoapp.cue title="todoapp/kube/todoapp.cue" ```cue file=tests/kube-aws/deployment/todoapp.cue title="todoapp/kube/todoapp.cue"
``` ```
</TabItem> </TabItem>
@ -542,11 +557,13 @@ repetition.
Let's define a re-usable `#Deployment` definition in `kube/deployment.cue`. Let's define a re-usable `#Deployment` definition in `kube/deployment.cue`.
```cue file=tests/kube-kind/cue-manifest/deployment.cue title="todoapp/kube/deployment.cue" ```cue file=tests/kube-kind/cue-manifest/deployment.cue title="todoapp/kube/deployment.cue"
``` ```
Indeed, let's also define a re-usable `#Service` definition in `kube/service.cue`. Indeed, let's also define a re-usable `#Service` definition in `kube/service.cue`.
```cue file=tests/kube-kind/cue-manifest/service.cue title="todoapp/kube/service.cue" ```cue file=tests/kube-kind/cue-manifest/service.cue title="todoapp/kube/service.cue"
``` ```
### Generate Kubernetes manifest ### Generate Kubernetes manifest
@ -557,6 +574,7 @@ without having boilerplate nor repetition.
Create a new definition named `#AppManifest` that will generate the YAML in `kube/manifest.cue`. Create a new definition named `#AppManifest` that will generate the YAML in `kube/manifest.cue`.
```cue file=tests/kube-kind/cue-manifest/manifest.cue title="todoapp/kube/manifest.cue" ```cue file=tests/kube-kind/cue-manifest/manifest.cue title="todoapp/kube/manifest.cue"
``` ```
### Update manifest ### Update manifest
@ -580,18 +598,21 @@ values={[
<TabItem value="kind"> <TabItem value="kind">
```cue file=tests/kube-kind/cue-manifest/todoapp.cue title="todoapp/kube/todoapp.cue" ```cue file=tests/kube-kind/cue-manifest/todoapp.cue title="todoapp/kube/todoapp.cue"
``` ```
</TabItem> </TabItem>
<TabItem value="gke"> <TabItem value="gke">
```cue file=tests/kube-gcp/cue-manifest/todoapp.cue title="todoapp/kube/todoapp.cue" ```cue file=tests/kube-gcp/cue-manifest/todoapp.cue title="todoapp/kube/todoapp.cue"
``` ```
</TabItem> </TabItem>
<TabItem value="eks"> <TabItem value="eks">
```cue file=tests/kube-aws/cue-manifest/todoapp.cue title="todoapp/kube/todoapp.cue" ```cue file=tests/kube-aws/cue-manifest/todoapp.cue title="todoapp/kube/todoapp.cue"
``` ```
</TabItem> </TabItem>

View File

@ -108,7 +108,13 @@ This defines:
##### 1. Create a new environment ##### 1. Create a new environment
Now that the Cue package is ready, let's create an environment to run it: Let's create a project:
```shell
dagger init
```
Let's create an environment to run it:
```shell ```shell
dagger new 'cloudformation' -p ./cloudformation dagger new 'cloudformation' -p ./cloudformation

View File

@ -29,5 +29,5 @@ registry: docker.#Run & {
// we defined in the previous file // we defined in the previous file
push: target: "localhost:5000/todoapp" push: target: "localhost:5000/todoapp"
// output the application URL // Application URL
appURL: "http://localhost:8080/" & dagger.#Output appURL: "http://localhost:8080/" & dagger.#Output