Skip to content

Commit

Permalink
Upgrade AMI image for EC2
Browse files Browse the repository at this point in the history
A user reported that the 20.04 image was no longer available
on AWS.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Aug 30, 2023
1 parent 619f0c7 commit 8410cf0
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Install Go
uses: actions/setup-go@master
with:
go-version: 1.19.x
go-version: 1.20.x
- name: Make
run: make all
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@master
with:
go-version: 1.19.x
go-version: 1.20.x
- name: Make
run: make all

Expand Down
40 changes: 27 additions & 13 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/spf13/cobra"
)

const inletsProDefaultVersion = "0.9.18"
const inletsProDefaultVersion = "0.9.21"
const inletsProControlPort = 8123

func init() {
Expand Down Expand Up @@ -49,7 +49,7 @@ func init() {
createCmd.Flags().String("endpoint", "ovh-eu", "API endpoint (ovh), default: ovh-eu")
createCmd.Flags().String("consumer-key", "", "The Consumer Key for using the OVH API")

createCmd.Flags().Bool("tcp", true, `Provision an exit-server with inlets Pro running as a TCP server`)
createCmd.Flags().Bool("tcp", true, `Provision an exit-server with inlets running as a TCP server`)

createCmd.Flags().StringArray("letsencrypt-domain", []string{}, `Domains you want to get a Let's Encrypt certificate for`)
createCmd.Flags().String("letsencrypt-issuer", "prod", `The issuer endpoint to use with Let's Encrypt - \"prod\" or \"staging\"`)
Expand All @@ -59,22 +59,35 @@ func init() {
_ = createCmd.Flags().MarkHidden("pro")
createCmd.Flags().DurationP("poll", "n", time.Second*2, "poll every N seconds, use a higher value if you encounter rate-limiting")

createCmd.Flags().String("inlets-pro-version", inletsProDefaultVersion, `Binary release version for inlets Pro`)

createCmd.Flags().String("inlets-version", inletsProDefaultVersion, `Binary release version for inlets`)
}

// clientCmd represents the client sub command.
var createCmd = &cobra.Command{
Use: "create",
Short: "Create an exit-server with inlets Pro preinstalled.",
Long: `Create an exit-server with inlets Pro preinstalled on cloud infrastructure
with inlets Pro preloaded as a systemd service. The estimated cost of each
Short: "Create an exit-server with inlets preinstalled.",
Long: `Create an exit-server with inlets preinstalled on cloud infrastructure
with inlets preloaded as a systemd service. The estimated cost of each
VM along with what OS version and spec will be used is explained in the
project docs.`,
Example: ` inletsctl create \
Example: ` # Create a TCP tunnel server
inletsctl create \
--provider [digitalocean|equinix-metal|ec2|scaleway|civo|gce|azure|linode|hetzner] \
--access-token-file $HOME/access-token \
--region lon1`,
--region lon1
# Create a HTTPS tunnel server, terminating TLS with a certificate
# from Let's Encrypt
inletsctl create \
--letsencrypt-domain inlets.example.com \
--letsencrypt-email webmaster@example.com
# Create a HTTPS tunnel server with multiple domains
inletsctl create \
--letsencrypt-domain tunnel1.example.com \
--letsencrypt-domain tunnel2.example.com \
--letsencrypt-email webmaster@example.com
`,
RunE: runCreate,
SilenceUsage: true,
SilenceErrors: true,
Expand Down Expand Up @@ -264,10 +277,11 @@ func runCreate(cmd *cobra.Command, _ []string) error {
}
}

inletsProVersion, err := cmd.Flags().GetString("inlets-pro-version")
inletsProVersion, err := cmd.Flags().GetString("inlets-version")
if err != nil {
return err
}

if len(inletsProVersion) == 0 {
inletsProVersion = inletsProDefaultVersion
}
Expand Down Expand Up @@ -336,7 +350,7 @@ func runCreate(cmd *cobra.Command, _ []string) error {

if hostStatus.Status == "active" {
if len(letsencryptDomains) > 0 {
fmt.Printf(`inlets Pro HTTPS (%s) server summary:
fmt.Printf(`inlets HTTPS (%s) server summary:
IP: %s
HTTPS Domains: %v
Auth-token: %s
Expand Down Expand Up @@ -368,7 +382,7 @@ To delete:

return nil
} else {
fmt.Printf(`inlets Pro TCP (%s) server summary:
fmt.Printf(`inlets TCP (%s) server summary:
IP: %s
Auth-token: %s
Expand Down Expand Up @@ -527,7 +541,7 @@ func createHost(provider, name, region, zone, projectID, userData, inletsPort st

return &provision.BasicHost{
Name: name,
OS: "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210621",
OS: "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20230516",
Plan: "t3.nano",
Region: region,
UserData: base64.StdEncoding.EncodeToString([]byte(userData)),
Expand Down
23 changes: 7 additions & 16 deletions cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
)

var (
inletsPro bool
downloadVersion string
destination string
verbose bool
Expand All @@ -24,7 +23,6 @@ var (
func init() {
inletsCmd.AddCommand(downloadCmd)

downloadCmd.Flags().BoolVar(&inletsPro, "pro", true, "Download inlets Pro")
downloadCmd.Flags().StringVar(&downloadVersion, "version", "", "specific version to download")
downloadCmd.Flags().StringVar(&destination, "download-to", "/usr/local/bin", "location to download to (Default: /usr/local/bin)")
downloadCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Show download URL")
Expand All @@ -33,12 +31,11 @@ func init() {

var downloadCmd = &cobra.Command{
Use: "download",
Short: "Downloads the inlets Pro binary",
Long: `Downloads the inlets Pro binary from the GitHub releases page. Only inlets Pro is supported.`,
Short: "Downloads the inlets binary",
Long: `Downloads the inlets binary from the GitHub releases page..`,
Example: ` inletsctl download
inletsctl download --version 0.2.6
inletsctl download --pro --version 0.2.6
inletsctl download --pro`,
inletsctl download --version 0.2.6
`,
RunE: downloadInlets,
SilenceUsage: true,
SilenceErrors: true,
Expand All @@ -48,15 +45,9 @@ func downloadInlets(_ *cobra.Command, _ []string) error {

var versionUrl, downloadUrl, binaryName string

if inletsPro {
versionUrl = "https://github.com/inlets/inlets-pro/releases/latest"
downloadUrl = "https://github.com/inlets/inlets-pro/releases/download/"
binaryName = "inlets-pro"
} else {
versionUrl = "https://github.com/inlets/inlets-pro/releases/latest"
downloadUrl = "https://github.com/inlets/inlets-pro/releases/download/"
binaryName = "inlets-pro"
}
versionUrl = "https://github.com/inlets/inlets-pro/releases/latest"
downloadUrl = "https://github.com/inlets/inlets-pro/releases/download/"
binaryName = "inlets-pro"

osVal := runtime.GOOS
arch := runtime.GOARCH
Expand Down
31 changes: 16 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/inlets/inletsctl

go 1.19
go 1.20

require (
github.com/alexellis/go-execute v0.5.0
Expand All @@ -17,7 +17,7 @@ require (
// replace github.com/inlets/cloud-provision => ../cloud-provision

require (
cloud.google.com/go/compute v1.14.0 // indirect
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.3 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 // indirect
Expand All @@ -28,18 +28,19 @@ require (
github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect
github.com/aws/aws-sdk-go v1.44.191 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/digitalocean/godo v1.95.0 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dirien/ovh-go-sdk v0.2.0 // indirect
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/hetznercloud/hcloud-go v1.39.0 // indirect
Expand All @@ -57,17 +58,17 @@ require (
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.12 // indirect
github.com/vultr/govultr/v2 v2.17.2 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/api v0.109.0 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 8410cf0

Please sign in to comment.