forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Equinix Metal examples equivalent to Packet.net to help with p…
…rovider deprecation (pulumi#907)
- Loading branch information
Showing
14 changed files
with
215 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -230,6 +230,7 @@ jobs: | |
- Aws | ||
- Azure | ||
- Gcp | ||
- EquinixMetal | ||
- Packet | ||
- Cloud | ||
dotnet-version: | ||
|
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 |
---|---|---|
|
@@ -244,6 +244,7 @@ jobs: | |
- Azure | ||
- Gcp | ||
- Packet | ||
- EquinixMetal | ||
- Cloud | ||
dotnet-version: | ||
- 3.1.301 | ||
|
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 |
---|---|---|
|
@@ -193,6 +193,7 @@ jobs: | |
- Azure | ||
- Gcp | ||
- Packet | ||
- EquinixMetal | ||
- Cloud | ||
dotnet-version: | ||
- 3.1.301 | ||
|
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 @@ | ||
/bin/ |
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 @@ | ||
name: equinix-metal-py-webserver | ||
description: A simple server on Equinix Metal. | ||
runtime: python |
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,51 @@ | ||
[![Deploy](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new) | ||
|
||
# Equinix Metal Webserver | ||
|
||
This example demonstrates creating a webserver in Equinix Metal with Python | ||
|
||
# Running the Example | ||
|
||
After cloning this repo, `cd` into it and run these commands. | ||
|
||
1. Create a new stack, which is an isolated deployment target for this example: | ||
|
||
```bash | ||
$ pulumi stack init | ||
``` | ||
|
||
1. Install all of the dependencies for the application: | ||
|
||
1. Create a Python virtualenv, activate it, and install dependencies: | ||
|
||
This installs the dependent packages [needed](https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/) for our Pulumi program. | ||
|
||
```bash | ||
$ python3 -m venv venv | ||
$ source venv/bin/activate | ||
$ pip3 install -r requirements.txt | ||
``` | ||
|
||
1. Deploy everything with the `pulumi up` command. This provisions the webserver: | ||
|
||
```bash | ||
$ pulumi up | ||
``` | ||
|
||
1. After a couple minutes, your webserver will be ready. | ||
|
||
```bash | ||
$ pulumi up | ||
... | ||
Outputs: | ||
+ ip : "147.75.65.213" | ||
+ name: "new-vervet" | ||
``` | ||
|
||
1. Once you are done, you can destroy all of the resources, and the stack: | ||
|
||
```bash | ||
$ pulumi destroy | ||
$ pulumi stack rm | ||
``` |
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,27 @@ | ||
import pulumi_equinix_metal as metal | ||
import pulumi_random as random | ||
from pulumi import export | ||
|
||
random_host_name = random.RandomPet("hostname") | ||
|
||
project = metal.get_project( | ||
name="ci-project" | ||
) | ||
|
||
vm = metal.Device( | ||
"vm", | ||
billing_cycle="hourly", | ||
facilities=["ewr1"], | ||
hostname=random_host_name.id, | ||
operating_system="coreos_stable", | ||
plan="baremetal_0", | ||
project_id=project.id, | ||
ip_addresses=[{ | ||
"type": "public_ipv4", | ||
}, { | ||
"type": "private_ipv4", | ||
}] | ||
) | ||
|
||
export('ip', vm.access_public_ipv4) | ||
export('name', vm.hostname) |
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 @@ | ||
pulumi>=2.0.0,<3.0.0 | ||
pulumi-equinix-metal>=1.0.0,<2.0.0 | ||
pulumi-random>=2.0.0,<3.0.0 |
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 @@ | ||
name: webserver-equinix-metal | ||
description: A simple server on Equinix Metal. | ||
runtime: nodejs | ||
|
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 @@ | ||
[![Deploy](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new) | ||
|
||
# Equinix Metal Webserver | ||
|
||
This example demonstrates creating a webserver in Equinix Metal | ||
|
||
# Running the Example | ||
|
||
After cloning this repo, `cd` into it and run these commands. | ||
|
||
1. Create a new stack, which is an isolated deployment target for this example: | ||
|
||
```bash | ||
$ pulumi stack init | ||
``` | ||
|
||
1. Install all of the dependencies for the application: | ||
|
||
```bash | ||
$ npm install | ||
``` | ||
|
||
1. Deploy everything with the `pulumi up` command. This provisions the webserver: | ||
|
||
```bash | ||
$ pulumi up | ||
``` | ||
|
||
1. After a couple minutes, your webserver will be ready. | ||
|
||
```bash | ||
$ pulumi up | ||
... | ||
Outputs: | ||
+ ip : "147.75.65.213" | ||
+ name: "new-vervet" | ||
``` | ||
|
||
1. Once you are done, you can destroy all of the resources, and the stack: | ||
|
||
```bash | ||
$ pulumi destroy | ||
$ pulumi stack rm | ||
``` |
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,26 @@ | ||
// Copyright 2016-2019, Pulumi Corporation. All rights reserved. | ||
|
||
import * as metal from "@pulumi/equinix-metal"; | ||
import * as random from "@pulumi/random"; | ||
|
||
const randomHostName = new random.RandomPet("hostname"); | ||
|
||
const project = metal.getProject({name: "ci-project"}); | ||
|
||
const vm = new metal.Device("vm", { | ||
facilities: [metal.Facility.EWR1], | ||
billingCycle: metal.BillingCycle.Hourly, | ||
hostname: randomHostName.id, | ||
operatingSystem: metal.OperatingSystem.CoreOSStable, | ||
plan: metal.Plan.T1SmallX86, | ||
projectId: project.then(p => p.id), | ||
ipAddresses: [{ | ||
type: "public_ipv4", | ||
}, | ||
{ | ||
type: "private_ipv4", | ||
}], | ||
}); | ||
|
||
export const ip = vm.accessPublicIpv4; | ||
export const name = vm.hostname; |
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,12 @@ | ||
{ | ||
"name": "equinix-metal-ts-webserver", | ||
"version": "0.1.0", | ||
"devDependencies": { | ||
"@types/node": "^8.0.0" | ||
}, | ||
"dependencies": { | ||
"@pulumi/equinix-metal": "^1.0.0", | ||
"@pulumi/random": "latest" | ||
}, | ||
"license": "Apache-2.0" | ||
} |
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,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "bin", | ||
"target": "es6", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"stripInternal": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strictNullChecks": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} | ||
|
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