add linode-js-webserver example
MODIFY
README.md
README.md
@@ -29,6 +29,7 @@ Example | Language | Cloud |
[CloudWatch Log Groups, Event Targets, Metric Alarms, IAM roles, and more! (TypeScript)](aws-ts-resources) <br/> An example that shows how to create a number of AWS resources, including `cloudwatch.Dashboard`, `cloudwatch.EventRule`, `cloudwatch.LogGroup`, `sqs.Queue`, and more. | TypeScript | AWS |
[Azure App Service with SQL Database and Application Insights](azure-ts-appservice) <br/> Deploy Azure App Service along with SQL Database and Application Insights | TypeScript | Azure |
[Azure Functions](azure-ts-functions) <br/> A simple component for deploying inline code to Azure Functions | TypeScript | Azure |
+[Linode instance (JavaScript)](linode-js-webserver) <br/> Provision a simple Linux web server that serves traffic on port 80 | JavaScript | Linode |
### Cloud Applications

ADD
linode-js-webserver/Pulumi.yaml
+name: webserver-linode
+runtime: nodejs
+description: Basic example of an Linode web server accessible over HTTP

ADD
linode-js-webserver/index.ts
+const pulumi = require("@pulumi/pulumi");
+const linode = require("@pulumi/linode");
+const debian9 = "linode/debian9";
+
+// (optional) create a simple web server using a startup script for the instance
+const startupScript = `#!/bin/bash
+echo "Hello, World!" > index.html
+nohup python -m SimpleHTTPServer 80 &`;
+
+const profile = pulumi.output(linode.getProfile());
+
+const stackscript = new linode.StackScript("simple-server", {
+ label: "simple-server",
+ script: startupScript,
+ description: "SimpleHTTPServer example StackScript",
+ images: [debian9],
+});
+
+const linodeInstance = new linode.Instance("instance", {
+ instanceType: "g6-nanode-1",
+ stackscriptId: stackscript,
+ image: debian9,
+ region: "us-east",
+ // Include all "LISH" registered SSH Keys
+ authorizedKeys: profile.authorizedKeys,
+ // Include all User configured SSH Keys
+ authorizedUsers: [profile.username],
+}, { dependsOn: [stackscript] });
+
+exports.instanceLabel = linodeInstance.label;
+exports.instanceIP = linodeInstance.ipAddress;

ADD
linode-js-webserver/package.json
+{
+ "name": "webserver-linode",
+ "version": "0.1.0",
+ "main": "index.js",
+ "dependencies": {
+ "@pulumi/pulumi": "latest",
+ "@pulumi/linode": "latest"
+ }
+}

add linode-js-webserver example (#295)