Point at dokploy-deploy-action for rollouts
This commit is contained in:
25
README.md
25
README.md
@@ -49,6 +49,7 @@ new dokploy.Domain("api", {
|
|||||||
- [Installing](#installing)
|
- [Installing](#installing)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Resources and data sources](#resources-and-data-sources)
|
- [Resources and data sources](#resources-and-data-sources)
|
||||||
|
- [Deploying from CI](#deploying-from-ci)
|
||||||
- [Differences from the Terraform provider](#differences-from-the-terraform-provider)
|
- [Differences from the Terraform provider](#differences-from-the-terraform-provider)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
- [Development](#development)
|
- [Development](#development)
|
||||||
@@ -123,6 +124,30 @@ pulumi config set --secret dokploy:apiKey "$DOKPLOY_API_KEY"
|
|||||||
Data sources: `getProject`, `getProjects`, `getEnvironment`, `getApplication`,
|
Data sources: `getProject`, `getProjects`, `getEnvironment`, `getApplication`,
|
||||||
`getServers`.
|
`getServers`.
|
||||||
|
|
||||||
|
## Deploying from CI
|
||||||
|
|
||||||
|
Like the Terraform provider, this one manages *configuration*, not *rollouts*.
|
||||||
|
Creating an `Application` writes its definition; it does not build or start
|
||||||
|
anything.
|
||||||
|
|
||||||
|
[`dokploy-deploy-action`](https://github.com/maxvojtkov/dokploy-deploy-action)
|
||||||
|
covers the other half on GitHub Actions and Gitea Actions: it triggers a
|
||||||
|
deployment, waits for the build, and fails the job when the deployment fails.
|
||||||
|
Export the application id from your stack and hand it over.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
export const apiApplicationId = api.id;
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: maxvojtkov/dokploy-deploy-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DOKPLOY_HOST }}
|
||||||
|
api-key: ${{ secrets.DOKPLOY_API_KEY }}
|
||||||
|
application-id: ${{ steps.stack.outputs.apiApplicationId }}
|
||||||
|
docker-image: ghcr.io/acme/api:${{ github.sha }}
|
||||||
|
```
|
||||||
|
|
||||||
## Differences from the Terraform provider
|
## Differences from the Terraform provider
|
||||||
|
|
||||||
Everything is a mechanical translation of the Terraform provider, with three
|
Everything is a mechanical translation of the Terraform provider, with three
|
||||||
|
|||||||
@@ -35,8 +35,14 @@ const staging = new dokploy.Environment("staging", {
|
|||||||
|
|
||||||
// ------------------------------------------------------------------ secrets
|
// ------------------------------------------------------------------ secrets
|
||||||
|
|
||||||
const postgresPassword = new random.RandomPassword("postgres", { length: 32, special: false });
|
const postgresPassword = new random.RandomPassword("postgres", {
|
||||||
const redisPassword = new random.RandomPassword("redis", { length: 32, special: false });
|
length: 32,
|
||||||
|
special: false,
|
||||||
|
});
|
||||||
|
const redisPassword = new random.RandomPassword("redis", {
|
||||||
|
length: 32,
|
||||||
|
special: false,
|
||||||
|
});
|
||||||
|
|
||||||
// --------------------------------------------------------------- datastores
|
// --------------------------------------------------------------- datastores
|
||||||
|
|
||||||
@@ -66,11 +72,13 @@ const cache = new dokploy.Redis("cache", {
|
|||||||
// is reachable by its generated appName.
|
// is reachable by its generated appName.
|
||||||
const storefrontEnv = pulumi
|
const storefrontEnv = pulumi
|
||||||
.all([db.appName, postgresPassword.result, cache.appName, redisPassword.result])
|
.all([db.appName, postgresPassword.result, cache.appName, redisPassword.result])
|
||||||
.apply(([dbHost, dbPass, cacheHost, cachePass]) => [
|
.apply(([dbHost, dbPass, cacheHost, cachePass]) =>
|
||||||
|
[
|
||||||
`DATABASE_URL=postgresql://shop:${dbPass}@${dbHost}:5432/shop`,
|
`DATABASE_URL=postgresql://shop:${dbPass}@${dbHost}:5432/shop`,
|
||||||
`REDIS_URL=redis://:${cachePass}@${cacheHost}:6379`,
|
`REDIS_URL=redis://:${cachePass}@${cacheHost}:6379`,
|
||||||
"NODE_ENV=production",
|
"NODE_ENV=production",
|
||||||
].join("\n"));
|
].join("\n"),
|
||||||
|
);
|
||||||
|
|
||||||
const storefront = new WebService("storefront", {
|
const storefront = new WebService("storefront", {
|
||||||
environmentId: shop.defaultEnvironmentId,
|
environmentId: shop.defaultEnvironmentId,
|
||||||
|
|||||||
1850
examples/typescript/pnpm-lock.yaml
generated
Normal file
1850
examples/typescript/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,10 @@ export interface WebServiceArgs {
|
|||||||
|
|
||||||
domains?: DomainSpec[];
|
domains?: DomainSpec[];
|
||||||
/** username/password pair to put the whole service behind basic auth. */
|
/** username/password pair to put the whole service behind basic auth. */
|
||||||
basicAuth?: { username: pulumi.Input<string>; password: pulumi.Input<string> };
|
basicAuth?: {
|
||||||
|
username: pulumi.Input<string>;
|
||||||
|
password: pulumi.Input<string>;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +46,9 @@ export class WebService extends pulumi.ComponentResource {
|
|||||||
super("dokploy:index:WebService", name, {}, opts);
|
super("dokploy:index:WebService", name, {}, opts);
|
||||||
const child = { parent: this };
|
const child = { parent: this };
|
||||||
|
|
||||||
this.application = new dokploy.Application(name, {
|
this.application = new dokploy.Application(
|
||||||
|
name,
|
||||||
|
{
|
||||||
name,
|
name,
|
||||||
environmentId: args.environmentId,
|
environmentId: args.environmentId,
|
||||||
description: args.description,
|
description: args.description,
|
||||||
@@ -65,9 +70,22 @@ export class WebService extends pulumi.ComponentResource {
|
|||||||
sourceType: "docker",
|
sourceType: "docker",
|
||||||
dockerImage: args.dockerImage,
|
dockerImage: args.dockerImage,
|
||||||
}),
|
}),
|
||||||
}, child);
|
sourceType: "gitea",
|
||||||
|
buildType: "dockerfile",
|
||||||
|
autoDeploy: true,
|
||||||
|
giteaId: "test",
|
||||||
|
owner: "test",
|
||||||
|
repository: "test",
|
||||||
|
branch: "main",
|
||||||
|
},
|
||||||
|
child,
|
||||||
|
);
|
||||||
|
|
||||||
this.domains = (args.domains ?? []).map((d, i) => new dokploy.Domain(`${name}-domain-${i}`, {
|
this.domains = (args.domains ?? []).map(
|
||||||
|
(d, i) =>
|
||||||
|
new dokploy.Domain(
|
||||||
|
`${name}-domain-${i}`,
|
||||||
|
{
|
||||||
applicationId: this.application.id,
|
applicationId: this.application.id,
|
||||||
domainType: "application",
|
domainType: "application",
|
||||||
host: d.host,
|
host: d.host,
|
||||||
@@ -75,14 +93,21 @@ export class WebService extends pulumi.ComponentResource {
|
|||||||
path: d.path,
|
path: d.path,
|
||||||
https: d.https ?? true,
|
https: d.https ?? true,
|
||||||
certificateType: (d.https ?? true) ? "letsencrypt" : "none",
|
certificateType: (d.https ?? true) ? "letsencrypt" : "none",
|
||||||
}, child));
|
},
|
||||||
|
child,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
if (args.basicAuth) {
|
if (args.basicAuth) {
|
||||||
new dokploy.Security(`${name}-auth`, {
|
new dokploy.Security(
|
||||||
|
`${name}-auth`,
|
||||||
|
{
|
||||||
applicationId: this.application.id,
|
applicationId: this.application.id,
|
||||||
username: args.basicAuth.username,
|
username: args.basicAuth.username,
|
||||||
password: args.basicAuth.password,
|
password: args.basicAuth.password,
|
||||||
}, child);
|
},
|
||||||
|
child,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.registerOutputs({
|
this.registerOutputs({
|
||||||
|
|||||||
Reference in New Issue
Block a user