@@ -33,7 +33,6 @@ We welcome beginners and experts alike!
|
||||
|
||||
## Alpha disclaimer
|
||||
|
||||
Dagger is *alpha-quality software*. It has many bugs, the user interface is
|
||||
minimal, and it may change in incompatible ways at any time. If you are still
|
||||
Dagger is _alpha-quality software_. It has many bugs, the user interface is minimal, and it may change in incompatible ways at any time. If you are still
|
||||
willing to try it, thank you! We appreciate your help and encourage you to ask
|
||||
questions and report issues.
|
||||
|
@@ -55,19 +55,19 @@ From the **assets** section, download the archive corresponding to your OS and A
|
||||
|
||||
You will need [Go](https://golang.org) version 1.16 or later.
|
||||
|
||||
1. Clone the dagger repository
|
||||
1\. Clone the dagger repository
|
||||
|
||||
```shell
|
||||
git clone https://github.com/dagger/dagger.git
|
||||
```
|
||||
|
||||
2. Build the `dagger` binary.
|
||||
2\. Build the `dagger` binary.
|
||||
|
||||
```shell
|
||||
cd dagger; make
|
||||
```
|
||||
|
||||
3. Copy the `dagger` tool to a location listed in your `$PATH`. For example, to copy it to `/usr/local/bin`:
|
||||
3\. Copy the `dagger` tool to a location listed in your `$PATH`. For example, to copy it to `/usr/local/bin`:
|
||||
|
||||
```shell
|
||||
cp ./cmd/dagger/dagger /usr/local/bin
|
||||
|
@@ -6,23 +6,22 @@ Dagger can be configured to use an existing buildkit daemon, running either loca
|
||||
|
||||
To use a buildkit daemon listening on TCP port `1234` on localhost:
|
||||
|
||||
```
|
||||
$ export BUILDKIT_HOST=tcp://localhost:1234
|
||||
```shell
|
||||
export BUILDKIT_HOST=tcp://localhost:1234
|
||||
```
|
||||
|
||||
To use a buildkit daemon running in a container named "super-buildkit" on the local docker host:
|
||||
|
||||
```
|
||||
$ export BUILDKIT_HOST=docker-container://super-buildkit
|
||||
```shell
|
||||
export BUILDKIT_HOST=docker-container://super-buildkit
|
||||
```
|
||||
|
||||
To use a buildkit daemon running on a remote docker host (be careful to properly secure remotely accessible docker hosts!)
|
||||
|
||||
```shell
|
||||
export BUILDKIT_HOST=docker-container://super-buildkit
|
||||
export DOCKER_HOST=tcp://my-remote-docker-host:2376
|
||||
```
|
||||
$ export BUILDKIT_HOST=docker-container://super-buildkit
|
||||
$ export DOCKER_HOST=tcp://my-remote-docker-host:2376
|
||||
```
|
||||
|
||||
|
||||
## OpenTracing Support
|
||||
|
||||
@@ -31,7 +30,7 @@ Both Dagger and buildkit support opentracing. To capture traces to
|
||||
|
||||
A `docker-compose` file is available to help bootstrap the tracing environment:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
docker-compose -f ./tracing.compose.yaml up -d
|
||||
export JAEGER_TRACE=localhost:6831
|
||||
export BUILDKIT_HOST=docker-container://dagger-buildkitd-jaeger
|
||||
@@ -40,4 +39,3 @@ dagger compute ...
|
||||
```
|
||||
|
||||
You can then go to [http://localhost:16686/](http://localhost:16686/) in your browser to see the traces.
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
## Programming in Cue
|
||||
|
||||
[Cue](https://cuelang.org) is a next-generation data language by Marcel van Lohuizen and the spiritual successor
|
||||
of GCL, the language used to configure all of Google's infrastructure.
|
||||
of GCL, the language used to configure all of Google's infrastructure.
|
||||
|
||||
Cue extends JSON with powerful features:
|
||||
|
||||
@@ -22,44 +22,44 @@ To get started with Cue, we recommend the following resources:
|
||||
* [Cuetorials](https://cuetorials.com)
|
||||
* [Cue playground](https://cuelang.org/play/)
|
||||
|
||||
|
||||
## Writing your first plan
|
||||
|
||||
To create a Dagger plan:
|
||||
|
||||
1. Create a new directory anywhere in your git repository.
|
||||
1\. Create a new directory anywhere in your git repository.
|
||||
|
||||
For example: `mkdir staging`.
|
||||
|
||||
2. Create a new file with the *.cue* extension, and open it with any text editor or IDE.
|
||||
2\. Create a new file with the *.cue* extension, and open it with any text editor or IDE.
|
||||
|
||||
For example: `staging.cue`.
|
||||
|
||||
3. Describe each relay in your plan as a field in the cue configuration.
|
||||
3\. Describe each relay in your plan as a field in the cue configuration.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
```cue
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/docker"
|
||||
"dagger.io/git"
|
||||
"dagger.io/docker"
|
||||
"dagger.io/git"
|
||||
)
|
||||
|
||||
// Relay for fetching a git repository
|
||||
repo: git.#Repository & {
|
||||
remote: "https://github.com/dagger/dagger"
|
||||
ref: "main"
|
||||
remote: "https://github.com/dagger/dagger"
|
||||
ref: "main"
|
||||
}
|
||||
|
||||
// Relay for building a docker image
|
||||
ctr: docker.#Build & {
|
||||
source: repo
|
||||
source: repo
|
||||
}
|
||||
```
|
||||
|
||||
For more inspiration, see these examples:
|
||||
|
||||
* [Deploy a static page to S3](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-a-static-page-to-s3)
|
||||
* [Deploy a simple React application](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-a-simple-react-application)
|
||||
* [Deploy a complete JAMstack app](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-a-complete-jamstack-app)
|
||||
@@ -67,41 +67,39 @@ For more inspiration, see these examples:
|
||||
* [Add HTTP monitoring to your application](https://github.com/dagger/dagger/blob/main/examples/README.md#add-http-monitoring-to-your-application)
|
||||
* [Deploy an application to your Kubernetes cluster](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-an-application-to-your-kubernetes-cluster)
|
||||
|
||||
4\. Extend your plan with relay definitions from [Dagger Universe](../stdlib), an encyclopedia of cue packages curated by the Dagger community.
|
||||
|
||||
4. Extend your plan with relay definitions from [Dagger Universe](../stdlib), an encyclopedia of cue packages curated by the Dagger community.
|
||||
|
||||
5. If you can't find the relay you need in the Universe, you can simply create your own.
|
||||
5\. If you can't find the relay you need in the Universe, you can simply create your own.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
```cue
|
||||
import (
|
||||
"strings"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Create a relay definition which generates a greeting message
|
||||
#Greeting: {
|
||||
salutation: string | *"hello"
|
||||
name: string | *"world"
|
||||
message: "\(strings.ToTitle(salutation)), \(name)!"
|
||||
salutation: string | *"hello"
|
||||
name: string | *"world"
|
||||
message: "\(strings.ToTitle(salutation)), \(name)!"
|
||||
}
|
||||
```
|
||||
|
||||
You may then create any number of relays from the same definition:
|
||||
|
||||
```
|
||||
```cue
|
||||
french: #Greeting & {
|
||||
salutation: "bonjour"
|
||||
name: "monde"
|
||||
salutation: "bonjour"
|
||||
name: "monde"
|
||||
}
|
||||
|
||||
american: #Greeting & {
|
||||
salutation: "hi"
|
||||
name: "y'all"
|
||||
salutation: "hi"
|
||||
name: "y'all"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Concepts
|
||||
|
||||
### Plans
|
||||
@@ -115,6 +113,7 @@ It lays out the application's supply chain as a graph of interconnected nodes:
|
||||
* Software dependencies: operating systems, languages, libraries, frameworks, etc.
|
||||
|
||||
The graph models the flow of code and data through the supply chain:
|
||||
|
||||
* source code flows from a git repository to a build system;
|
||||
* system dependencies are combined in a docker image, then uploaded to a registry;
|
||||
* configuration files are generated then sent to a compute cluster or load balancer;
|
||||
@@ -122,7 +121,6 @@ The graph models the flow of code and data through the supply chain:
|
||||
|
||||
Dagger plans are written in [Cue](https://cuelang.org), a powerful declarative language by the creator of GQL, the language used to deploy all applications at Google.
|
||||
|
||||
|
||||
### Environments
|
||||
|
||||
An *environment* is a live implementation of a *plan*, with its own user inputs and state.
|
||||
@@ -144,6 +142,7 @@ Relays are standalone software components: they are defined in [Cue](https://cue
|
||||
execute code in any language using the [Dagger pipeline API](FIXME).
|
||||
|
||||
A relay is made of 3 parts:
|
||||
|
||||
* Inputs: data received from the user, or upstream relays
|
||||
* A processing pipeline: code executed against each new input, using the [pipeline API](FIXME)
|
||||
* Outputs: data produced by the processing pipeline
|
||||
@@ -152,7 +151,6 @@ Relays run in parallel, with their inputs and outputs interconnected into a spec
|
||||
called a *DAG*. When a relay receives a new input, it runs it through the processing pipeline,
|
||||
and produces new outputs, which are propagated to downstream relays as inputs, and so on.
|
||||
|
||||
|
||||
### Using third-party relays
|
||||
|
||||
Cue includes a complete package system. This makes it easy to create a complex plan in very few
|
||||
@@ -161,27 +159,26 @@ lines of codes, simply by importing relays from third-party packages.
|
||||
For example, to create a plan involving Github, Heroku and Amazon RDS, one might import the three
|
||||
corresponding packages:
|
||||
|
||||
```
|
||||
```cue
|
||||
import (
|
||||
"dagger.io/github"
|
||||
"dagger.io/heroku"
|
||||
"dagger.io/amazon/rds"
|
||||
"dagger.io/github"
|
||||
"dagger.io/heroku"
|
||||
"dagger.io/amazon/rds"
|
||||
)
|
||||
|
||||
repo: github.#Repository & {
|
||||
// Github configuration values
|
||||
// Github configuration values
|
||||
}
|
||||
|
||||
backend: heroku.#App & {
|
||||
// Heroku configuration values
|
||||
// Heroku configuration values
|
||||
}
|
||||
|
||||
db: rds.#Database & {
|
||||
// RDS configuration values
|
||||
// RDS configuration values
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Creating a new relay
|
||||
|
||||
Sometimes there is no third-party relay available for a particular task in your workflow; or it may exist but need to be customized.
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Dagger vs. Other Software
|
||||
|
||||
|
||||
## Dagger vs. PaaS (Heroku, Firebase, etc.)
|
||||
|
||||
*Summary: Dagger can be used with or without a PaaS system.*
|
||||
@@ -12,7 +11,6 @@ A PaaS system is a complete platform for deploying and running certain types of
|
||||
|
||||
As an application grows, it is almost certain to outgrow the capabilities of a PaaS system, leaving no choice but to look for alternatives. A good strategy is to choose the right platform for each component. Some components continue to run on a PaaS system; others run on specialized infrastructure. This strategy can be implemented with Dagger: each component gets its own deployment plan expressed as code, and Dagger glues it all together into a single workflow.
|
||||
|
||||
|
||||
## Dagger vs. artisanal deploy scripts
|
||||
|
||||
*Summary: Dagger can augment your deploy scripts, and later help you simplify or even remove them.*
|
||||
|
Reference in New Issue
Block a user