-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdc18bf
commit 09ad444
Showing
12 changed files
with
1,373 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DOCS_GCP_PROJECT_ID="runme-ci" | ||
DOCS_GCP_REGION="us-central1" | ||
|
||
GOAWAY=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DOCS_GCP_ARTIFACTS_REPO="Artifacts Docker repo in GCP" # Docs | ||
DOCS_GCP_CREDENTIALS="Credentials for auth with GCP" # Docs | ||
DOCS_GCP_PROJECT_ID="Project ID for deploy into GCP" # Docs | ||
DOCS_GCP_REGION="Region for deploy into GCP" # Docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
apiVersion: runme.stateful.com/v1beta1 | ||
kind: EnvSpecDefinitions | ||
metadata: | ||
name: docs.runme.dev | ||
namespace: stateful | ||
annotations: | ||
github.com/repo-url: https://github.com/stateful/docs.runme.dev | ||
spec: | ||
type: owl | ||
envSpecs: | ||
- name: Docs | ||
breaker: DOCS | ||
atomics: | ||
- key: GCP_ARTIFACTS_REPO | ||
atomic: Opaque | ||
rules: printascii | ||
required: true | ||
- key: GCP_CREDENTIALS | ||
atomic: Secret | ||
rules: json | ||
required: true | ||
- key: GCP_PROJECT_ID | ||
atomic: Plain | ||
rules: printascii | ||
required: true | ||
- key: GCP_REGION | ||
atomic: Plain | ||
rules: printascii | ||
required: true | ||
--- | ||
apiVersion: runme.stateful.com/v1beta1 | ||
kind: EnvResolution | ||
metadata: | ||
name: docs.runme.dev | ||
namespace: stateful | ||
annotations: | ||
github.com/repo-url: https://github.com/stateful/docs.runme.dev | ||
spec: | ||
type: owl | ||
path: | ||
transform: | ||
expr: key | trimPrefix("DOCS_GCP_") | lower() | ||
gcp: | ||
auth: ADC | ||
project: runme-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "docs.runme.dev", | ||
"engineVersion": "v0.13.7", | ||
"sdk": "typescript", | ||
"dependencies": [ | ||
{ | ||
"name": "docusaurus", | ||
"source": "github.com/levlaz/daggerverse/docusaurus@docusaurus/v0.7.0", | ||
"pin": "f073c72e0a7345bba2173a15269307df297c3c13" | ||
}, | ||
{ | ||
"name": "google-cloud-run", | ||
"source": "github.com/vvaswani/daggerverse/google-cloud-run@google-cloud-run/v0.1.5", | ||
"pin": "6e44ee4a901dda7d742574354132745701db3c52" | ||
} | ||
], | ||
"source": "dagger" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/sdk/** linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/sdk | ||
/**/node_modules/** | ||
/**/.pnpm-store/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
cwd: .. | ||
runme: | ||
id: 01JBWW23ENADYZXX5KFGME12KR | ||
terminalRows: 20 | ||
--- | ||
|
||
# The Docs, daggerized | ||
|
||
See what functions are available in the `docs` module, and how to use them. | ||
|
||
```sh {"id":"01JBW9KGZT5XE4B0G1Z8GK1239","terminalRows":"8"} | ||
dagger functions | ||
``` | ||
|
||
Inspect a local instance of the docs before deploying it to the cloud. | ||
|
||
```sh {"background":"true","id":"01JBWGTT8R91VNCV1JSG8KF1K5","name":"serve-locally"} | ||
dagger call --site . \ | ||
serve \ | ||
up | ||
``` | ||
|
||
## Deploy a docs site preview | ||
|
||
```sh {"id":"01JBWVFDXVDBBMRQAQA61NN6CB","name":"check","terminalRows":"3"} | ||
echo "Deploying preview into \"${DOCS_GCP_PROJECT_ID}\" in \"${DOCS_GCP_REGION}\" from registry repo \"${DOCS_GCP_ARTIFACTS_REPO}\"." | ||
``` | ||
|
||
This will deploy a preview of the docs site to the cloud. | ||
|
||
```sh {"background":"false","id":"01JBWA2741XJE0KZZTGP7P1WKB","name":"DEPLOY_URL"} | ||
dagger call --site . \ | ||
deploy \ | ||
--project="${DOCS_GCP_PROJECT_ID}" \ | ||
--region="${DOCS_GCP_REGION}" \ | ||
--repo="${DOCS_GCP_ARTIFACTS_REPO}" \ | ||
--credentials="env:DOCS_GCP_CREDENTIALS" | ||
``` | ||
|
||
```sh {"id":"01JBWV44M5ZJCAERKS9E5KP7RS","interactive":"true"} | ||
echo "Opening ${DEPLOY_URL}" | ||
open ${DEPLOY_URL} | ||
``` | ||
|
||
## See what services are running | ||
|
||
```sh {"id":"01JBX0HGR3DBKSC6PJM57845EK"} | ||
https://console.cloud.google.com/run?project=${DOCS_GCP_PROJECT_ID} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "module", | ||
"dependencies": { | ||
"@dagger.io/dagger": "./sdk", | ||
"typescript": "^5.5.4" | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* A generated module for DocsRunmeDev functions | ||
* | ||
* This module has been generated via dagger init and serves as a reference to | ||
* basic module structure as you get started with Dagger. | ||
*/ | ||
import { dag, Container, Directory, object, func, Docusaurus, Service, Secret, Platform } from "@dagger.io/dagger" | ||
|
||
@object() | ||
export class DocsRunmeDev { | ||
site: Docusaurus | ||
|
||
constructor(site: Directory) { | ||
const disableCache = false | ||
this.site = dag.docusaurus(site, { disableCache }) | ||
} | ||
|
||
/** | ||
* Returns a directory with a production-ready build of the docs site. | ||
*/ | ||
@func() | ||
build(): Directory { | ||
return this.site | ||
.build() | ||
} | ||
|
||
/** | ||
* Build container serving a build of the docs site. | ||
*/ | ||
@func() | ||
async container(): Promise<Container> { | ||
const platform = "linux/amd64" as Platform | ||
return ( | ||
dag.container({ platform }) | ||
.from("nginx:1.27.2-alpine-slim") | ||
.withDirectory("/usr/share/nginx/html", this.site.build()) | ||
.withExposedPort(80) | ||
) | ||
} | ||
|
||
/** | ||
* Bring up container serving a build of the docs site. | ||
*/ | ||
@func() | ||
async serve(): Promise<Service> { | ||
const container = await this.container() | ||
return container.asService() | ||
} | ||
|
||
protected async publish(imageRef: string): Promise<string> { | ||
const image = await this.container() | ||
return image.publish(imageRef) | ||
} | ||
|
||
/** | ||
* Deploy docs site container image to Google Cloud Run. | ||
*/ | ||
@func() | ||
async deploy(project: string, region: string, repo: string, credentials: Secret): Promise<string> { | ||
const imageRef = await this.publish(`${region}-docker.pkg.dev/${project}/${repo}/site:lastest`) | ||
|
||
return dag | ||
.googleCloudRun() | ||
.createService("runme-ci", "us-central1", imageRef, 80, credentials) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"moduleResolution": "Node", | ||
"experimentalDecorators": true, | ||
"paths": { | ||
"@dagger.io/dagger": ["./sdk"], | ||
"@dagger.io/dagger/telemetry": ["./sdk/telemetry"] | ||
} | ||
} | ||
} |
Oops, something went wrong.