Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
import * as docker from "@pulumi/docker";
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import * as cluster from "./cluster";
import * as config from "./config";
import * as db from "./db";
// Get the GCR repository for our app container, and build and publish the app image.
const appImage = new docker.Image("rails-app", {
imageName: `${config.dockerUsername}/${pulumi.getProject()}_${pulumi.getStack()}`,
build: "../app",
registry: {
server: "docker.io",
username: config.dockerUsername,
password: config.dockerPassword,
},
});
// Deploy the app container as a Kubernetes load balanced service.
const appPort = 3000;
const appLabels = { app: "rails-app" };
const appDeployment = new k8s.apps.v1.Deployment("rails-deployment", {
spec: {
selector: { matchLabels: appLabels },
replicas: 1,
// limitations under the License.
import * as docker from "@pulumi/docker";
import * as gcp from "@pulumi/gcp";
import * as k8s from "@pulumi/kubernetes";
import * as kx from "@pulumi/kubernetesx";
import * as pulumi from "@pulumi/pulumi";
import { config } from "./config";
// Get the GCP project registry repository.
const registry = gcp.container.getRegistryRepository();
// Build a Docker image from a local Dockerfile context in the
// './node-app' directory, and push it to the registry.
const customImage = "node-app";
const appImage = new docker.Image(customImage, {
imageName: pulumi.interpolate`${registry.repositoryUrl}/${customImage}:v1.0.0`,
build: {
context: `./${customImage}`,
},
});
// Create a k8s provider.
const provider = new k8s.Provider("provider", {
kubeconfig: config.kubeconfig,
namespace: config.appsNamespaceName,
});
// Create a Deployment of the built container.
const appLabels = { app: customImage };
const appDeployment = new k8s.apps.v1.Deployment("app", {
spec: {
import { config } from "./config";
// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("samples");
// Create a registry in ACR.
const registry = new azure.containerservice.Registry("myregistry", {
resourceGroupName: resourceGroup.name,
sku: "Basic",
adminEnabled: true,
});
// Build a Docker image from a local Dockerfile context in the
// './node-app' directory, and push it to the registry.
const customImage = "node-app";
const appImage = new docker.Image(customImage, {
imageName: pulumi.interpolate`${registry.loginServer}/${customImage}:v1.0.0`,
build: {
context: `./${customImage}`,
},
registry: {
server: registry.loginServer,
username: registry.adminUsername,
password: registry.adminPassword,
},
});
// Create a k8s provider.
const provider = new k8s.Provider("provider", {
kubeconfig: config.kubeconfig,
namespace: config.appsNamespaceName,
});
constructor(name: string,
args: KedaStorageQueueHandlerArgs,
opts: pulumi.ComponentResourceOptions = {}) {
super("examples:keda:KedaStorageQueueHandler", name, args, opts);
const registry = args.service.registry;
// Deploy the docker image of the Function App
const dockerImage = new docker.Image("image", {
imageName: pulumi.interpolate`${registry.loginServer}/${args.queue.name}:v1.0.0`,
build: {
context: args.path,
},
registry: {
server: registry.loginServer,
username: registry.adminUsername,
password: registry.adminPassword,
},
}, { parent: this });
// Put the storage account connection string into a secret
const secretQueue = new k8s.core.v1.Secret("queue-secret", {
data: {
queueConnectionString:
args.storageAccount.primaryConnectionString.apply(c => Buffer.from(c).toString("base64")),
export const helloEndpoint = pulumi.interpolate`https://${helloApp.defaultSiteHostname}/hello`;
/**
* Scenario 2: deploying a custom image from Azure Container Registry.
*/
const customImage = "node-app";
const registry = new azure.containerservice.Registry("myregistry", {
resourceGroupName: resourceGroup.name,
sku: "Basic",
adminEnabled: true,
});
const myImage = new docker.Image(customImage, {
imageName: pulumi.interpolate`${registry.loginServer}/${customImage}:v1.0.0`,
build: {
context: `./${customImage}`,
},
registry: {
server: registry.loginServer,
username: registry.adminUsername,
password: registry.adminPassword,
},
});
const getStartedApp = new azure.appservice.AppService("get-started", {
resourceGroupName: resourceGroup.name,
appServicePlanId: plan.id,
appSettings: {
WEBSITES_ENABLE_APP_SERVICE_STORAGE: "false",
resourceGroupName: resourceGroup.name,
reserved: true,
sku: {
tier: "Basic",
size: "B1",
},
});
const registry = new azure.containerservice.Registry("myacr", {
resourceGroupName: resourceGroup.name,
sku: "Basic",
adminEnabled: true,
});
const customImage = "spring-boot-greeting-app";
const myImage = new docker.Image(customImage, {
imageName: pulumi.interpolate`${registry.loginServer}/${customImage}:v1.0.0`,
build: {
context: `../`,
},
registry: {
server: registry.loginServer,
username: registry.adminUsername,
password: registry.adminPassword,
},
});
const appService = new azure.appservice.AppService(customImage, {
resourceGroupName: resourceGroup.name,
appServicePlanId: appServicePlan.id,
appSettings: {
WEBSITES_ENABLE_APP_SERVICE_STORAGE: "false",