Saturday 7 November 2020

go web app deploy reference

 
reference:

auto open web page after web server starts

go run ./

generate go.mod

C:\Users\bob\golang1>go mod init example.com/golang1
go: creating new go.mod: module example.com/golang1

C:\Users\bob\golang1>go test
go: finding module for package github.com/gorilla/mux
go: finding module for package github.com/gorilla/sessions
go: finding module for package go.mongodb.org/mongo-driver/mongo
go: finding module for package go.mongodb.org/mongo-driver/mongo/options
go: finding module for package go.mongodb.org/mongo-driver/bson
go: finding module for package golang.org/x/crypto/bcrypt
go: finding module for package go.mongodb.org/mongo-driver/bson/primitive
go: downloading go.mongodb.org/mongo-driver v1.4.3
go: downloading github.com/gorilla/sessions v1.2.1
go: downloading github.com/gorilla/mux v1.8.0
go: downloading golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
go: found github.com/gorilla/mux in github.com/gorilla/mux v1.8.0
go: found github.com/gorilla/sessions in github.com/gorilla/sessions v1.2.1
go: found go.mongodb.org/mongo-driver/bson in go.mongodb.org/mongo-driver v1.4.3
go: found go.mongodb.org/mongo-driver/bson/primitive in go.mongodb.org/mongo-driver v1.4.3
go: found go.mongodb.org/mongo-driver/mongo in go.mongodb.org/mongo-driver v1.4.3
go: found go.mongodb.org/mongo-driver/mongo/options in go.mongodb.org/mongo-driver v1.4.3
go: found golang.org/x/crypto/bcrypt in golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
?       example.com/golang1     [no test files]

GOPATH  - project files has to be in GOPATH for deploy
>go env GOPATH
C:\Users\bob\go

govendor
govendor init
govendor add packageName
go mod vendor

go internal package - disable go internal check
create internal folder and move project files inside 
C:\Users\bob\go\src\internal\election

heroku - “no web processes running”

C:\Users\bob\go\src\heroku\election>git push heroku master
Enumerating objects: 666, done.
Counting objects: 100% (666/666), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (622/622), done.
Writing objects: 100% (666/666), 1.13 MiB | 590.00 KiB/s, done.
Total 666 (delta 69), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq... done
remote: -----> Fetching stdlib.sh.v8... done
remote: ----->
remote:        Detected go modules via go.mod
remote: ----->
remote:        Detected Module Name: example.com/election
remote: ----->
remote:  !!    The go.mod file for this project does not specify a Go version
remote:  !!
remote:  !!    Defaulting to go1.12.17
remote:  !!
remote:  !!    For more details see: https://devcenter.heroku.com/articles/go-apps-with-modules#build-configuration
remote:  !!
remote: -----> New Go Version, clearing old cache
remote: -----> Installing go1.12.17
remote: -----> Fetching go1.12.17.linux-amd64.tar.gz... done
remote: -----> Determining packages to install
remote:
remote:        Detected the following main packages to install:
remote:                 example.com/election
remote:                 example.com/election/simulator
remote:
remote: -----> Running: go install -v -tags heroku -mod=vendor example.com/election example.com/election/simulator
remote: go.mongodb.org/mongo-driver/bson/bsonoptions
remote: github.com/gorilla/securecookie
remote: github.com/gorilla/mux
remote: github.com/gorilla/sessions
remote: go.mongodb.org/mongo-driver/bson/bsontype
remote: go.mongodb.org/mongo-driver/bson/primitive
remote: github.com/go-stack/stack
remote: github.com/pkg/errors
remote: go.mongodb.org/mongo-driver/x/bsonx/bsoncore
remote: go.mongodb.org/mongo-driver/tag
remote: go.mongodb.org/mongo-driver/mongo/readpref
remote: github.com/golang/snappy
remote: github.com/klauspost/compress/fse
remote: github.com/klauspost/compress/huff0
remote: go.mongodb.org/mongo-driver/bson/bsonrw
remote: go.mongodb.org/mongo-driver/mongo/readconcern
remote: github.com/klauspost/compress/snappy
remote: github.com/klauspost/compress/zstd/internal/xxhash
remote: github.com/klauspost/compress/zstd
remote: go.mongodb.org/mongo-driver/bson/bsoncodec
remote: go.mongodb.org/mongo-driver/x/mongo/driver/address
remote: go.mongodb.org/mongo-driver/x/mongo/driver/description
remote: go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/options
remote: go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt
remote: go.mongodb.org/mongo-driver/x/mongo/driver/uuid
remote: go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage
remote: go.mongodb.org/mongo-driver/internal
remote: go.mongodb.org/mongo-driver/x/mongo/driver/dns
remote: github.com/aws/aws-sdk-go/aws/awserr
remote: github.com/aws/aws-sdk-go/internal/ini
remote: go.mongodb.org/mongo-driver/bson
remote: github.com/aws/aws-sdk-go/internal/shareddefaults
remote: github.com/aws/aws-sdk-go/internal/sync/singleflight
remote: go.mongodb.org/mongo-driver/event
remote: go.mongodb.org/mongo-driver/mongo/writeconcern
remote: go.mongodb.org/mongo-driver/x/bsonx
remote: go.mongodb.org/mongo-driver/x/mongo/driver/session
remote: go.mongodb.org/mongo-driver/x/mongo/driver
remote: go.mongodb.org/mongo-driver/x/mongo/driver/connstring
remote: github.com/aws/aws-sdk-go/aws/credentials
remote: github.com/aws/aws-sdk-go/aws/endpoints
remote: go.mongodb.org/mongo-driver/mongo/options
remote: github.com/aws/aws-sdk-go/internal/sdkio
remote: github.com/jmespath/go-jmespath
remote: github.com/aws/aws-sdk-go/aws/awsutil
remote: github.com/aws/aws-sdk-go/aws/client/metadata
remote: github.com/aws/aws-sdk-go/internal/strings
remote: github.com/aws/aws-sdk-go/internal/sdkmath
remote: golang.org/x/text/transform
remote: golang.org/x/text/unicode/norm
remote: github.com/xdg/stringprep
remote: github.com/aws/aws-sdk-go/aws
remote: github.com/aws/aws-sdk-go/aws/request
remote: github.com/aws/aws-sdk-go/private/protocol
remote: github.com/aws/aws-sdk-go/private/protocol/rest
remote: github.com/aws/aws-sdk-go/aws/signer/v4
remote: golang.org/x/crypto/pbkdf2
remote: go.mongodb.org/mongo-driver/version
remote: go.mongodb.org/mongo-driver/x/mongo/driver/operation
remote: github.com/xdg/scram
remote: golang.org/x/crypto/ocsp
remote: golang.org/x/sync/errgroup
remote: go.mongodb.org/mongo-driver/x/mongo/driver/ocsp
remote: golang.org/x/sync/semaphore
remote: golang.org/x/crypto/blowfish
remote: golang.org/x/crypto/bcrypt
remote: go.mongodb.org/mongo-driver/x/mongo/driver/auth
remote: go.mongodb.org/mongo-driver/x/mongo/driver/topology
remote: go.mongodb.org/mongo-driver/mongo
remote: example.com/election
remote: example.com/election/simulator
remote:
remote:        Installed the following binaries:
remote:                 ./bin/election
remote:                 ./bin/simulator
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 16.6M
remote: -----> Launching...
remote:        Released v3
remote:        https://chuanshuoge-election.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/chuanshuoge-election.git
 * [new branch]      master -> master
heroku ps:scale web=1

No comments:

Post a Comment