examples: added outputs/inputs annotations

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-06-01 16:00:01 +02:00
parent 2bd4679646
commit 56e60c5b29
7 changed files with 49 additions and 37 deletions

View File

@ -9,40 +9,46 @@ import (
// Backend configuration // Backend configuration
backend: { backend: {
// Source code to build this container // Source code to build this container
source: git.#Repository | dagger.#Artifact source: git.#Repository | dagger.#Artifact @dagger(input)
// Container environment variables // Container environment variables
environment: [string]: string environment: {
[string]: string @dagger(input)
}
// Public hostname (need to match the master domain configures on the loadbalancer) // Public hostname (need to match the master domain configures on the loadbalancer)
hostname: string hostname: string @dagger(input)
// Container configuration // Container configuration
container: { container: {
// Desired number of running containers // Desired number of running containers
desiredCount: *1 | int desiredCount: *1 | int @dagger(input)
// Time to wait for the HTTP timeout to complete // Time to wait for the HTTP timeout to complete
healthCheckTimeout: *10 | int healthCheckTimeout: *10 | int @dagger(input)
// HTTP Path to perform the healthcheck request (HTTP Get) // HTTP Path to perform the healthcheck request (HTTP Get)
healthCheckPath: *"/" | string healthCheckPath: *"/" | string @dagger(input)
// Number of times the health check needs to fail before recycling the container // Number of times the health check needs to fail before recycling the container
healthCheckUnhealthyThreshold: *2 | int healthCheckUnhealthyThreshold: *2 | int @dagger(input)
// Port used by the process inside the container // Port used by the process inside the container
port: *80 | int port: *80 | int @dagger(input)
// Memory to allocate // Memory to allocate
memory: *1024 | int memory: *1024 | int @dagger(input)
// Override the default container command // Override the default container command
command: [...string] command: [...string] @dagger(input)
// Custom dockerfile path // Custom dockerfile path
dockerfilePath: *"" | string dockerfilePath: *"" | string @dagger(input)
// docker build args // docker build args
dockerBuildArgs: [string]: string dockerBuildArgs: {
[string]: string @dagger(input)
}
} }
// Init container runs only once when the main container starts // Init container runs only once when the main container starts
initContainer: { initContainer: {
command: [...string] command: [...string] @dagger(input)
environment: [string]: string environment: {
[string]: string @dagger(input)
}
} }
} }

View File

@ -7,7 +7,7 @@ import (
database: { database: {
let slug = name let slug = name
dbType: "mysql" | "postgresql" dbType: "mysql" | "postgresql" @dagger(input)
db: rds.#CreateDB & { db: rds.#CreateDB & {
config: infra.awsConfig config: infra.awsConfig

View File

@ -9,24 +9,30 @@ import (
frontend: { frontend: {
// Source code to build the app // Source code to build the app
source: git.#Repository | dagger.#Artifact source: git.#Repository | dagger.#Artifact @dagger(input)
writeEnvFile?: string writeEnvFile?: string @dagger(input)
// Yarn Build // Yarn Build
yarn: { yarn: {
// Run this yarn script // Run this yarn script
script: string | *"build" script: string | *"build" @dagger(input)
// Read build output from this directory // Read build output from this directory
// (path must be relative to working directory). // (path must be relative to working directory).
buildDir: string | *"build" buildDir: string | *"build" @dagger(input)
} }
// Build environment variables // Build environment variables
environment: [string]: string environment: {
environment: NODE_ENV: string | *"production" [string]: string @dagger(input)
environment: APP_URL: "https://\(name).netlify.app/" }
environment: {
NODE_ENV: string | *"production" @dagger(input)
}
environment: {
APP_URL: "https://\(name).netlify.app/" @dagger(input)
}
} }
frontend: { frontend: {

View File

@ -10,26 +10,26 @@ infra: {
awsConfig: aws.#Config awsConfig: aws.#Config
// VPC Id // VPC Id
vpcId: string vpcId: string @dagger(input)
// ECR Image repository // ECR Image repository
ecrRepository: string ecrRepository: string @dagger(input)
// ECS cluster name // ECS cluster name
ecsClusterName: string ecsClusterName: string @dagger(input)
// Execution Role ARN used for all tasks running on the cluster // Execution Role ARN used for all tasks running on the cluster
ecsTaskRoleArn?: string ecsTaskRoleArn?: string @dagger(input)
// ELB listener ARN // ELB listener ARN
elbListenerArn: string elbListenerArn: string @dagger(input)
// Secret ARN for the admin password of the RDS Instance // Secret ARN for the admin password of the RDS Instance
rdsAdminSecretArn: string rdsAdminSecretArn: string @dagger(input)
// ARN of the RDS Instance // ARN of the RDS Instance
rdsInstanceArn: string rdsInstanceArn: string @dagger(input)
// Netlify credentials // Netlify credentials
netlifyAccount: netlify.#Account netlifyAccount: netlify.#Account @dagger(input)
} }

View File

@ -1,7 +1,7 @@
package main package main
// Name of the application // Name of the application
name: string & =~"[a-z0-9-]+" name: string & =~"[a-z0-9-]+" @dagger(input)
// Inject db info in the container environment // Inject db info in the container environment
backend: environment: { backend: environment: {
@ -17,6 +17,6 @@ backend: environment: {
frontend: environment: APP_URL_API: url.backendURL frontend: environment: APP_URL_API: url.backendURL
url: { url: {
frontendURL: frontend.site.url frontendURL: frontend.site.url @dagger(output)
backendURL: "https://\(backend.hostname)/" backendURL: "https://\(backend.hostname)/" @dagger(output)
} }

View File

@ -6,14 +6,14 @@ import (
// AWS account: credentials and region // AWS account: credentials and region
awsConfig: aws.#Config & { awsConfig: aws.#Config & {
region: *"us-east-1" | string region: *"us-east-1" | string @dagger(input)
} }
// URL of the website to monitor // URL of the website to monitor
website: string | *"https://www.google.com" website: string | *"https://www.google.com" @dagger(input)
// Email address to notify of monitoring alerts // Email address to notify of monitoring alerts
email: string email: string @dagger(input)
// The monitoring service running on AWS Cloudwatch // The monitoring service running on AWS Cloudwatch
monitor: #HTTPMonitor & { monitor: #HTTPMonitor & {

View File

@ -15,7 +15,7 @@ repo: git.#Repository & {
// Host the application with Netlify // Host the application with Netlify
www: netlify.#Site & { www: netlify.#Site & {
// Site name can be overridden // Site name can be overridden
name: string | *"dagger-examples-react" name: string | *"dagger-examples-react" @dagger(input)
// Deploy the output of yarn build // Deploy the output of yarn build
// (Netlify build feature is not used, to avoid extra cost). // (Netlify build feature is not used, to avoid extra cost).