Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/blog: Launch to google cloud fails #37179

Closed
marcusjwhelan opened this issue Feb 12, 2020 · 2 comments
Closed

x/blog: Launch to google cloud fails #37179

marcusjwhelan opened this issue Feb 12, 2020 · 2 comments

Comments

@marcusjwhelan
Copy link

https://blog.golang.org/docker

What version of Go are you using (go version)?

$ go version
go version go1.13.7 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/marcus/.cache/go-build"
GOENV="/home/marcus/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/marcus/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

I fallowed the directions
renamed some things. all the areas with outyet are replaced with gotest1 github is gotest1, image name on docker hub is gotest1, and project name is gotest1 for gcloud.

my containers.yaml files

version: latest
containers:
- name: gotest1
  image: mjwrazor/gotest1
  ports:
  - name: http
    hostPort: 80
    containerPort: 8080

What did you expect to see?

It launch on google cloud

What did you see instead?

gcloud compute instances create gotest1 --image container-vm-v20140925 --image-project debian-cloud --metadata-from-file google-container-manifest=containers.yaml --tags http-server --zone us-central1-a --machine-type f1-micro
ERROR: (gcloud.compute.instances.create) Could not fetch resource:
 - Invalid value for field 'resource.disks[0].initializeParams.sourceImage': 'https://compute.googleapis.com/compute/v1/projects/debian-cloud/global/images/container-vm-v20140925'. The referenced image resource cannot be found.

Any suggestions would be great or some more explanation/links to what all these things are for the gcloud. A little late in the day will be back to read into more of them.

@gopherbot gopherbot added this to the Unreleased milestone Feb 12, 2020
@marcusjwhelan
Copy link
Author

Well, pretty much all the gcloud items are deprecated. I will post what I did to get this up and running.

Following this tutorial on google cloud I was able to get rid of the create script and yaml file and replaced them with the files they show in this tutorial

It looks like google-containers are deprecated and google-container in the metadata-from-file section. The container-vm-v20140925 is also deprecated because its based on an old system. They now use deployment-manager

Since the link I sent might change I will at least post the commands I put into gcloud to post the project.

// if project does not exist
gcloud projects create gotest1
// else
gcloud config set project gotest1

set set project to PROJECT ID

gcloud config set project PROJECT-ID

Launch deployment to google cloud COS container optimized OS
make sure to have
* container_manifest.yaml
* container_vm.py
* container_vm.schema
* container_vm.yaml

gcloud deployment-manager deployments create gotest1-deployment \
--config container_vm.yaml

Createas VM instance on google cloud with
name: gotest1-deployment-gotest1-vm
gotetst1-deployment came from the create above and the gotest1-vm comes from container_vm.yaml file

Get a description of the instance

gcloud compute instances describe gotest1-deployment-gotest1-vm

Not able to view page yet. Need to create a firewall rule

gcloud compute firewall-rules create allow-80 --allow tcp:8080

Allows to go to external IP at ip:8080, not 80. need to figure out how to do this.

ssh into instance

gcloud compute ssh gotest1 --project ProjectID \
--zone ZONE

Can update firewall but it doesnt seem to allow, I think the manifest needs to change

gcloud compute firewall-rules update allow-80 --allow tcp:80

After you git push any changes need to update the image on the instance

gcloud compute instances update-container gotest1-deployment-gotest1-vm \
--container-image=mjwrazor/gotest1 \
--zone ZONE \
--container-restart-policy=always

@dmitshur
Copy link
Contributor

This is a very old blog post, and the APIs have changed significantly to make it a poor guide.

It's not in scope to keep such blog posts updated over time.

I'll close this issue because there's nothing actionable to do in x/blog, but I suggest looking at https://golang.org/wiki/Questions for a list of places that are better suited for asking questions. Since this question is specific to Google Cloud, you'll be able to get better help on a forum that is more dedicated to that topic.

@golang golang locked and limited conversation to collaborators Feb 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants