Point at dokploy-deploy-action for rollouts

This commit is contained in:
2026-08-09 03:38:24 +03:00
parent 096e5c0974
commit c06d3386a6
4 changed files with 2041 additions and 133 deletions

View File

@@ -49,6 +49,7 @@ new dokploy.Domain("api", {
- [Installing](#installing)
- [Configuration](#configuration)
- [Resources and data sources](#resources-and-data-sources)
- [Deploying from CI](#deploying-from-ci)
- [Differences from the Terraform provider](#differences-from-the-terraform-provider)
- [Examples](#examples)
- [Development](#development)
@@ -123,6 +124,30 @@ pulumi config set --secret dokploy:apiKey "$DOKPLOY_API_KEY"
Data sources: `getProject`, `getProjects`, `getEnvironment`, `getApplication`,
`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
Everything is a mechanical translation of the Terraform provider, with three

View File

@@ -35,8 +35,14 @@ const staging = new dokploy.Environment("staging", {
// ------------------------------------------------------------------ secrets
const postgresPassword = new random.RandomPassword("postgres", { length: 32, special: false });
const redisPassword = new random.RandomPassword("redis", { length: 32, special: false });
const postgresPassword = new random.RandomPassword("postgres", {
length: 32,
special: false,
});
const redisPassword = new random.RandomPassword("redis", {
length: 32,
special: false,
});
// --------------------------------------------------------------- datastores
@@ -66,11 +72,13 @@ const cache = new dokploy.Redis("cache", {
// is reachable by its generated appName.
const storefrontEnv = pulumi
.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`,
`REDIS_URL=redis://:${cachePass}@${cacheHost}:6379`,
"NODE_ENV=production",
].join("\n"));
].join("\n"),
);
const storefront = new WebService("storefront", {
environmentId: shop.defaultEnvironmentId,

1850
examples/typescript/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,10 @@ export interface WebServiceArgs {
domains?: DomainSpec[];
/** 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);
const child = { parent: this };
this.application = new dokploy.Application(name, {
this.application = new dokploy.Application(
name,
{
name,
environmentId: args.environmentId,
description: args.description,
@@ -65,9 +70,22 @@ export class WebService extends pulumi.ComponentResource {
sourceType: "docker",
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,
domainType: "application",
host: d.host,
@@ -75,14 +93,21 @@ export class WebService extends pulumi.ComponentResource {
path: d.path,
https: d.https ?? true,
certificateType: (d.https ?? true) ? "letsencrypt" : "none",
}, child));
},
child,
),
);
if (args.basicAuth) {
new dokploy.Security(`${name}-auth`, {
new dokploy.Security(
`${name}-auth`,
{
applicationId: this.application.id,
username: args.basicAuth.username,
password: args.basicAuth.password,
}, child);
},
child,
);
}
this.registerOutputs({