Skip to content

Commit

Permalink
feat: introduce pulumi deployments on tfgrid
Browse files Browse the repository at this point in the history
  • Loading branch information
steveej committed Jun 7, 2024
1 parent 0008426 commit 16a6b93
Show file tree
Hide file tree
Showing 18 changed files with 1,293 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi

if [[ "$(hostname)" =~ (steveej|sj-).* ]]; then
export PULUMI_CONFIG_PASSPHRASE="$(prs show Work/Holo/holochain-infra-pulumi-passphrase)"
fi

use flake
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ result*
.decrypted~keys.yaml
.storage
.direnv

# binary file
pulumi/holochain-infra

pulumi-state/.pulumi/history
pulumi-state/.pulumi/backups
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
};

holoNixpkgs.url = "https://hydra.holo.host/channel/custom/holo-nixpkgs/2112/holo-nixpkgs/nixexprs.tar.xz";

nixpkgsPulumi.url = "github:steveej-forks/nixpkgs/pulumi-version-bump";
};

outputs = inputs @ {
Expand Down Expand Up @@ -145,7 +147,9 @@
nomadCaCert = ./secrets/nomad/admin/nomad-agent-ca.pem;
nomadClientCert = ./secrets/nomad/cli/global-cli-nomad.pem;


pkgsUnstable = inputs'.nixpkgsUnstable.legacyPackages;
pkgsPulumi = inputs'.nixpkgsPulumi.legacyPackages;
in
pkgs.mkShell {
packages =
Expand Down Expand Up @@ -188,6 +192,12 @@
inputs'.threefold-rfs.packages.default

pkgs.jq
pkgsPulumi.pulumictl
(pkgsPulumi.pulumi.withPackages(pulumiPackages: with pulumiPackages; [
pulumi-language-go
pulumi-command
]))
pkgs.go_1_21
]
++ (
let
Expand Down
1 change: 1 addition & 0 deletions pulumi-state/.pulumi/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 1
1 change: 1 addition & 0 deletions pulumi-state/.pulumi/meta.yaml.attrs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"EaRWdV65+nlqCnYlI4a4Wg=="}
324 changes: 324 additions & 0 deletions pulumi-state/.pulumi/stacks/holochain-infra/dev.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pulumi-state/.pulumi/stacks/holochain-infra/dev.json.attrs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"NITBxLMu5/N2QF6rSyVE9w=="}
312 changes: 312 additions & 0 deletions pulumi-state/.pulumi/stacks/holochain-infra/dev.json.bak

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"y9xkuTSc/ltcviSxOmfxBQ=="}
4 changes: 4 additions & 0 deletions pulumi/Pulumi.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
encryptionsalt: v1:KNBcfUHWy2o=:v1:YK042d91RPDBfWqV:xVlR2oJkhgzm/F+EivUGASLvrkTNRw==
config:
holochain-infra:tfgrid_devnet_mnemonic:
secure: v1:HDOR5EME2F6JO3r7:/5QBMCuQW4FuZxSoh72uhuhL9CFdK7bCkNcDLgo0LSRZixxQgeu38G4JwQcWcE2nLAQ7sYWjzaL7Lf1KDsUsRNJP8vjaipIMnfhsw9HmtesnRNLffzzjlzw2PJc=
3 changes: 3 additions & 0 deletions pulumi/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: holochain-infra
runtime: go
description: A minimal Go Pulumi program
44 changes: 44 additions & 0 deletions pulumi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Pulumi Deployments

This is under active developments.

Please see the list of [all Pulumi related issues](https://github.com/holochain/holochain-infra/issues?q=is%3Aissue+is%3Aopen+pulumi).

## Example Usage

This example requires `mycelium` running on the executing system.

Bring up the stack

```
pulum up
```

Check whether the machine is up

```
ssh root@$(pulumi stack -s dev output mycelium_ip)
```


Deploy another NixOS config to the VM and reboot it:

```
scripts/deploy.sh
```

## Debugging

If the VM is not responding to SSH requests it's possible to connect to its terminal directly via the web console.

This requires NetworkManger installed on the executing system.

```
scripts/wireguard.sh
```

Display the console:

```
echo "http://$(pulumi stack -s dev output vm0 | jq --raw-output .console_url)"
```
97 changes: 97 additions & 0 deletions pulumi/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
module holochain-infra

go 1.21

toolchain go1.21.8

require (
github.com/pulumi/pulumi-random/sdk/v4 v4.16.1
github.com/pulumi/pulumi/sdk/v3 v3.116.0
github.com/threefoldtech/pulumi-threefold/sdk v0.6.1
)

// replace github.com/threefoldtech/pulumi-threefold/sdk v0.6.1 => ../../../others/pulumi-threefold/sdk

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/charmbracelet/bubbles v0.18.0 // indirect
github.com/charmbracelet/bubbletea v0.26.2 // indirect
github.com/charmbracelet/lipgloss v0.10.0 // indirect
github.com/cheggaaa/pb v1.0.29 // indirect
github.com/cloudflare/circl v1.3.8 // indirect
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
github.com/djherbis/times v1.6.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.12.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/opentracing/basictracer-go v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pgavlin/fx v0.1.6 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/term v1.1.0 // indirect
github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect
github.com/pulumi/esc v0.8.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/frand v1.4.2 // indirect
)
Loading

0 comments on commit 16a6b93

Please sign in to comment.