Trong Windows, các biến môi trường được đặt thông qua nút “Biến môi trường” trên tab **`Nâng cao`** của bảng điều khiển “Hệ thống”. Bạn có thể tìm thêm thông tin về cách đặt biến môi trường tại đây
Thiết lập
Heroku CLI yêu cầu Git, hệ thống kiểm soát phiên bản phổ biến. Nếu bạn chưa cài đặt Git, hãy hoàn thành phần sau trước khi tiếp tục
Trong bước này, bạn sẽ cài đặt Giao diện dòng lệnh Heroku [CLI]. Bạn sử dụng CLI để quản lý và mở rộng ứng dụng của mình, cung cấp các tiện ích bổ sung, xem nhật ký ứng dụng và chạy ứng dụng của bạn cục bộ
Tải xuống và chạy trình cài đặt cho nền tảng của bạn
$ brew tap heroku/brew && brew install heroku
Sau khi cài đặt, bạn có thể sử dụng lệnh
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
1 từ trình bao lệnh của mìnhTrên Windows, khởi động Command Prompt [cmd. exe] hoặc Powershell để truy cập shell lệnh
Sử dụng lệnh
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
2 để đăng nhập vào Heroku CLI$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
Lệnh này mở trình duyệt web của bạn đến trang đăng nhập Heroku. Nếu trình duyệt của bạn đã đăng nhập vào Heroku, chỉ cần nhấp vào nút
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
3 được hiển thị trên trangXác thực này là bắt buộc để cả lệnh
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
1 và $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
5 hoạt động chính xácChuẩn bị ứng dụng
Trong bước này, bạn sẽ chuẩn bị một ứng dụng mẫu sẵn sàng triển khai cho Heroku
Nếu bạn chưa quen với Heroku, bạn nên hoàn thành hướng dẫn này bằng ứng dụng mẫu do Heroku cung cấp
Tuy nhiên, nếu bạn có ứng dụng hiện tại của riêng mình mà bạn muốn triển khai thay vào đó, hãy xem bài viết này để tìm hiểu cách chuẩn bị cho việc triển khai Heroku
Sao chép ứng dụng mẫu để bạn có phiên bản mã cục bộ mà sau đó bạn có thể triển khai lên Heroku, thực thi các lệnh sau trong trình bao lệnh cục bộ hoặc thiết bị đầu cuối của bạn
$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
Bây giờ bạn có một kho lưu trữ git đang hoạt động có chứa một ứng dụng đơn giản cũng như tệp
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
6, được sử dụng bởi hệ thống phụ thuộc mô-đun của GoTriển khai ứng dụng
Trong bước này, bạn sẽ triển khai ứng dụng lên Heroku
Sử dụng dynos để hoàn thành hướng dẫn này được tính vào mức sử dụng của bạn. Xóa ứng dụng của bạn ngay khi bạn hoàn tất để kiểm soát chi phí
Theo mặc định, các ứng dụng sử dụng Eco dynos nếu bạn đã đăng ký Eco. Mặt khác, nó mặc định là Basic dynos. Gói Eco dynos được chia sẻ trên tất cả các Eco dynos trong tài khoản của bạn và được khuyến nghị nếu bạn có kế hoạch triển khai nhiều ứng dụng nhỏ cho Heroku. Tim hiểu thêm ở đây. Sinh viên đủ điều kiện có thể đăng ký tín dụng nền tảng thông qua chương trình Heroku cho sinh viên GitHub của chúng tôi
Tạo một ứng dụng trên Heroku, chuẩn bị cho Heroku nhận mã nguồn của bạn
$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
Khi bạn tạo một ứng dụng, một điều khiển từ xa git [được gọi là
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
1] cũng được tạo và liên kết với kho lưu trữ git cục bộ của bạnHeroku tạo một tên ngẫu nhiên [trong trường hợp này là
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
8] cho ứng dụng của bạn hoặc bạn có thể chuyển một tham số để chỉ định tên ứng dụng của riêng mìnhBây giờ triển khai mã của bạn
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
Ứng dụng hiện đã được triển khai
Truy cập ứng dụng tại URL được tạo bởi tên ứng dụng của nó
Là một phím tắt tiện dụng, bạn có thể mở trang web như sau
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
3Xem các bản ghi
Heroku coi nhật ký là luồng sự kiện theo thứ tự thời gian được tổng hợp từ luồng đầu ra của tất cả ứng dụng và thành phần Heroku của bạn, cung cấp một kênh duy nhất cho tất cả sự kiện
Xem thông tin về ứng dụng đang chạy của bạn bằng một trong các lệnh ghi nhật ký,
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
9$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
5Truy cập lại ứng dụng của bạn trong trình duyệt và bạn sẽ thấy một thông báo tường trình khác được tạo
Nhấn
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
30 để dừng phát nhật kýĐịnh nghĩa một Procfile
Sử dụng Procfile, một tệp văn bản trong thư mục gốc của ứng dụng của bạn, để khai báo rõ ràng lệnh nào sẽ được thực thi để khởi động ứng dụng của bạn
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
31 trong ứng dụng ví dụ mà bạn đã triển khai trông như thế này$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
8Điều này khai báo một loại quy trình duy nhất,
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
32 và lệnh cần thiết để chạy nó. Tên $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
32 rất quan trọng ở đây. Nó tuyên bố rằng loại quy trình này sẽ được đính kèm vào ngăn xếp định tuyến HTTP của Heroku và nhận lưu lượng truy cập web khi được triển khai. Lệnh được sử dụng ở đây, $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
34 là mã nhị phân được biên dịch của ứng dụng bắt đầu. Quá trình xây dựng sẽ cài đặt các tệp nhị phân đã biên dịch vào thư mục $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
35 của dynoProcfiles có thể chứa các loại quy trình bổ sung. Ví dụ: bạn có thể khai báo một cho quy trình công nhân nền xử lý các mục khỏi hàng đợi
Chia tỷ lệ ứng dụng
Ngay bây giờ, ứng dụng của bạn đang chạy trên một web dyno. Hãy coi dyno là một thùng chứa nhẹ chạy lệnh được chỉ định trong
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
31Bạn có thể kiểm tra có bao nhiêu dynos đang chạy bằng lệnh
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
37$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
5Theo mặc định, ứng dụng của bạn được triển khai trên eco dyno. Eco dynos sẽ ngủ sau nửa giờ không hoạt động [nếu chúng không nhận được bất kỳ lưu lượng truy cập nào]. Điều này gây ra sự chậm trễ vài giây cho yêu cầu đầu tiên khi thức dậy. Các yêu cầu tiếp theo sẽ thực hiện bình thường. Eco dynos cũng tiêu thụ từ hạn ngạch hàng tháng, cấp tài khoản của số giờ eco dyno - miễn là hạn ngạch chưa hết, tất cả các ứng dụng sinh thái có thể tiếp tục chạy
Để tránh ngủ dyno, bạn có thể nâng cấp lên loại dyno Cơ bản hoặc Chuyên nghiệp như được mô tả trong bài viết Các loại Dyno. Ví dụ: nếu bạn di chuyển ứng dụng của mình sang một dyno chuyên nghiệp, bạn có thể dễ dàng mở rộng ứng dụng đó bằng cách chạy một lệnh yêu cầu Heroku thực thi một số lượng dyno cụ thể, mỗi loại đang chạy loại quy trình web của bạn
Mở rộng quy mô ứng dụng trên Heroku tương đương với việc thay đổi số lượng dyno đang chạy. Quy mô số lượng web dynos về 0
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
6Truy cập lại ứng dụng bằng cách nhấn làm mới trên tab web hoặc
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
38 để mở ứng dụng trong tab web. Bạn sẽ nhận được thông báo lỗi vì bạn không còn có sẵn bất kỳ web dyno nào để phục vụ các yêu cầuMở rộng quy mô một lần nữa
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
0Khai báo phụ thuộc ứng dụng
Heroku nhận ra một ứng dụng đang được viết bằng Go bởi sự tồn tại của tệp
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
6 trong thư mục gốcỨng dụng demo mà bạn đã triển khai đã có tệp
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
6 và nó trông giống như thế này$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
1Trên Windows, trong Command Prompt, lệnh sẽ là `more go. mod` thay vì `mèo`
Tệp
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
6 được sử dụng bởi công cụ Go và chỉ định cả các phụ thuộc cần thiết để xây dựng ứng dụng của bạn và cấu hình bản dựng mà Heroku nên sử dụng để biên dịch ứng dụng. Ứng dụng Go này có một số phụ thuộc, chủ yếu vào Gin, một khung web HTTPKhi một ứng dụng được triển khai, Heroku sẽ đọc tệp này, cài đặt phiên bản Go thích hợp và biên dịch mã của bạn bằng cách sử dụng
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
52Chạy ứng dụng cục bộ
Chạy ứng dụng cục bộ trong môi trường nhà phát triển của riêng bạn đòi hỏi nhiều nỗ lực hơn một chút. Go là một ngôn ngữ được biên dịch và trước tiên bạn phải biên dịch ứng dụng
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
2Bây giờ hãy khởi động ứng dụng của bạn cục bộ bằng lệnh
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
53, được cài đặt như một phần của Heroku CLI$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
3Trên Windows, bạn sẽ cần thực hiện hai việc trước khi có thể chạy `heroku local`
- Chạy `go build -o bin/go-getting-started. exe -v` thay vì lệnh được liệt kê ở trên
- Thay đổi Procfile để nội dung của nó là. trang web. bin\go-bắt đầu. exe` thay vì những gì có trong thanh toán. Tuy nhiên, đừng cam kết thay đổi đối với Procfile, nếu không, quy trình web của ứng dụng của bạn sẽ không thể bắt đầu trên Heroku
Cũng giống như Heroku,
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
53 kiểm tra $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
31 để xác định cái gì sẽ chạymở http. //máy chủ cục bộ. 5000 với trình duyệt web của bạn. Bạn sẽ thấy ứng dụng của mình chạy cục bộ
Để ngăn ứng dụng chạy cục bộ, hãy quay lại cửa sổ đầu cuối của bạn và nhấn
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
56+$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
57 để thoátĐẩy các thay đổi cục bộ
Trong bước này, bạn sẽ tìm hiểu cách truyền bá thay đổi cục bộ cho ứng dụng thông qua Heroku. Ví dụ: bạn sẽ sửa đổi ứng dụng để thêm một phần phụ thuộc bổ sung và mã để sử dụng nó
Các phụ thuộc được quản lý bằng công cụ Go
Hãy sửa đổi ứng dụng để sử dụng trình phân tích cú pháp đánh dấu Blackfriday. Vì phần phụ thuộc này chưa được ứng dụng của bạn sử dụng nên chúng tôi cần yêu cầu tìm nạp một bản sao của phần phụ thuộc
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
4Điều này làm 3 điều
- Tải xuống ________ 158 của mô-đun Thứ Sáu Đen và bất kỳ phụ thuộc nào của mô-đun vào bộ đệm mô-đun
- Ghi lại phần phụ thuộc Blackfriday và các phần phụ thuộc của nó trong
6$ git push heroku main Enumerating objects: 521, done. Counting objects: 100% [521/521], done. Delta compression using up to 8 threads Compressing objects: 100% [309/309], done. Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done. Total 521 [delta 141], reused 501 [delta 134] remote: Compressing source files.. done. remote: Building source: remote: remote: -----> Go app detected remote: -----> Fetching jq.. done remote: remote: -----> Detected go modules - go.mod remote: remote: -----> Installing go1.17.2 remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done remote: !! Installing package '.' [default] remote: !! remote: !! To install a different package spec add a comment in the following form to your `go.mod` file: remote: !! // +heroku install ./cmd/... remote: !! remote: -----> Running: go install -v -tags heroku -mod=vendor . remote: gopkg.in/bluesuncorp/validator.v5 remote: github.com/gin-gonic/gin/render remote: github.com/manucorporat/sse remote: github.com/mattn/go-colorable remote: golang.org/x/net/context remote: github.com/heroku/x/hmetrics remote: github.com/heroku/x/hmetrics/onload remote: github.com/gin-gonic/gin/binding remote: github.com/gin-gonic/gin remote: github.com/heroku/go-getting-started remote: remote: Compiled the following binaries: remote: ./bin/go-getting-started remote: remote: -----> Discovering process types remote: Procfile declares types -> web remote: remote: -----> Compressing... remote: Done: 5.5M remote: -----> Launching... remote: Released v3 remote: //go-on-heroku.herokuapp.com/ deployed to Heroku remote: remote: Verifying deploy.. done. To //git.heroku.com/go-on-heroku.git * [new branch] main -> main
- Ghi lại tổng số mật mã của Blackfriday và các phần phụ thuộc của nó trong
80$ git push heroku main Enumerating objects: 521, done. Counting objects: 100% [521/521], done. Delta compression using up to 8 threads Compressing objects: 100% [309/309], done. Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done. Total 521 [delta 141], reused 501 [delta 134] remote: Compressing source files.. done. remote: Building source: remote: remote: -----> Go app detected remote: -----> Fetching jq.. done remote: remote: -----> Detected go modules - go.mod remote: remote: -----> Installing go1.17.2 remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done remote: !! Installing package '.' [default] remote: !! remote: !! To install a different package spec add a comment in the following form to your `go.mod` file: remote: !! // +heroku install ./cmd/... remote: !! remote: -----> Running: go install -v -tags heroku -mod=vendor . remote: gopkg.in/bluesuncorp/validator.v5 remote: github.com/gin-gonic/gin/render remote: github.com/manucorporat/sse remote: github.com/mattn/go-colorable remote: golang.org/x/net/context remote: github.com/heroku/x/hmetrics remote: github.com/heroku/x/hmetrics/onload remote: github.com/gin-gonic/gin/binding remote: github.com/gin-gonic/gin remote: github.com/heroku/go-getting-started remote: remote: Compiled the following binaries: remote: ./bin/go-getting-started remote: remote: -----> Discovering process types remote: Procfile declares types -> web remote: remote: -----> Compressing... remote: Done: 5.5M remote: -----> Launching... remote: Released v3 remote: //go-on-heroku.herokuapp.com/ deployed to Heroku remote: remote: Verifying deploy.. done. To //git.heroku.com/go-on-heroku.git * [new branch] main -> main
Sau đó, hãy giới thiệu một lộ trình mới,
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
81, sẽ hiển thị HTML do trình phân tích cú pháp kết xuất. Sửa đổi $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
82 để nó sử dụng Blackfriday bằng cách thêm $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
83 vào danh sách nhập, để nó trông giống như thế này$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
5Tiếp theo, sửa đổi hàm
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
84 để giới thiệu tuyến đường mới sử dụng blackfriday. Thêm phần sau sau cuộc gọi $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
85 hiện có$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
6Cuối cùng, hãy biên dịch lại và khởi động chương trình cục bộ để kiểm tra điểm cuối mới theo cách thủ công
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
7Truy cập ứng dụng của bạn tại tuyến đường
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
81 mới. http. //máy chủ cục bộ. 5000/điểm. Bây giờ bạn sẽ thấy bản trình bày văn bản của HTML được tạo từ Markdown$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
87.Để kết thúc, hãy triển khai các thay đổi cục bộ cho Heroku
Hầu hết mọi triển khai ứng dụng Go cho Heroku đều theo cùng một mẫu
Trước tiên, hãy đảm bảo rằng mọi mô-đun không sử dụng đã bị xóa khỏi ứng dụng của bạn
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
8Sau đó, đảm bảo rằng bản dựng của bạn có thể lặp lại và chống xói mòn bằng cách cung cấp bất kỳ phần phụ thuộc mới nào
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
9Tiếp theo, thêm bất kỳ tệp mới hoặc sửa đổi nào vào kho git và cam kết chúng
$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
0Triển khai giống như bạn đã làm trước đây
$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
1Và cuối cùng, hãy kiểm tra xem mã mới của bạn có hoạt động không
$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
2Tiện ích cung cấp
Tiện ích bổ sung là các dịch vụ đám mây của bên thứ ba cung cấp các dịch vụ bổ sung sẵn dùng cho ứng dụng của bạn, từ tính bền bỉ thông qua ghi nhật ký đến giám sát, v.v.
Theo mặc định, Heroku lưu trữ 1500 dòng nhật ký từ ứng dụng của bạn. Tuy nhiên, nó cung cấp luồng nhật ký đầy đủ dưới dạng dịch vụ - và một số nhà cung cấp tiện ích bổ sung đã viết các dịch vụ ghi nhật ký cung cấp những thứ như lưu giữ nhật ký, tìm kiếm, cảnh báo qua email và SMS
Trong bước này, bạn sẽ cung cấp một trong những tiện ích ghi nhật ký này, Papertrail
Cung cấp tiện ích ghi nhật ký papertrail
$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
3Tiện ích bổ sung hiện đã được triển khai và định cấu hình cho ứng dụng của bạn. Bạn có thể liệt kê các tiện ích bổ sung cho ứng dụng của mình như thế này
$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
4Để xem tiện ích bổ sung cụ thể này đang hoạt động, hãy truy cập URL Heroku của ứng dụng của bạn một vài lần. Mỗi lượt truy cập sẽ tạo ra nhiều thông báo nhật ký hơn, giờ đây thông báo này sẽ được chuyển đến tiện ích bổ sung Papertrail. Truy cập bảng điều khiển Papertrail để xem thông báo tường trình
$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
5Bạn có thể phải đợi vài phút để nhật ký hiển thị trong Giao diện người dùng của Papertrail
Trình duyệt của bạn sẽ mở bảng điều khiển web Papertrail, hiển thị các sự kiện nhật ký mới nhất. Giao diện cho phép bạn tìm kiếm và thiết lập cảnh báo
Bắt đầu một dyno
Bạn có thể chạy một lệnh, điển hình là các tập lệnh và ứng dụng là một phần của ứng dụng của bạn, trong một dyno một lần bằng cách sử dụng lệnh
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
88. Để có cảm nhận thực sự về cách thức hoạt động của dyno, hãy tạo một dyno chạy một lần chạy lệnh $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
89, lệnh này mở ra một trình bao trên dyno đó. Sau đó, bạn có thể thực hiện các lệnh ở đó. Mỗi dyno có không gian tệp tạm thời của riêng nó, được điền bằng ứng dụng của bạn và các phần phụ thuộc của nó - sau khi lệnh hoàn thành [trong trường hợp này là $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
89], dyno sẽ bị xóa$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
6Đừng quên gõ
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
51 để thoát khỏi trình bao và chấm dứt dynoNếu bạn gặp lỗi,
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
52, thì bạn có thể cần định cấu hình tường lửa của mìnhXác định vars cấu hình
Heroku cho phép bạn cấu hình bên ngoài, lưu trữ dữ liệu như khóa mã hóa hoặc địa chỉ tài nguyên bên ngoài trong các lọ cấu hình
Khi chạy, các vars cấu hình được hiển thị dưới dạng các biến môi trường cho ứng dụng. Ứng dụng của bạn đã đọc một biến cấu hình, biến cấu hình
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
53. $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
53 được Heroku tự động đặt trên $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
32 dynos. Hãy cùng khám phá cách sử dụng các vars cấu hình do người dùng thiết lập trong ứng dụng Go của bạnSửa đổi
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
82 và thêm hàm $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
57 trả về $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
58 số lần được chỉ định bởi giá trị của biến môi trường $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
59. Thay đổi tập tin để nó đọc như thế này$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
7$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
53 sẽ tự động thiết lập môi trường dựa trên nội dung của tệp $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
61 trong thư mục cục bộ của bạn. Trong thư mục cấp cao nhất của dự án của bạn đã có tệp $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
61 có nội dung sau$ git clone //github.com/heroku/go-getting-started.git
$ cd go-getting-started
8Biên dịch lại ứng dụng và chạy nó
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
7Khi bạn truy cập tuyến đường
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
63 trên ứng dụng tại http. //máy chủ cục bộ. 5000/lần lặp lại, bạn sẽ thấy “Xin chào từ Go. " mười lầnĐể đặt var cấu hình trên Heroku, hãy thực hiện như sau
$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
0Xem các lọ cấu hình được đặt bằng cách sử dụng
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
64$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
1Triển khai các thay đổi cho heroku bằng cách sử dụng những gì bạn đã học trong phần Đẩy các thay đổi cục bộ và dùng thử bằng cách truy cập trình xử lý
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
63 của ứng dụng của bạn$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
2Sử dụng cơ sở dữ liệu
Việc thêm cơ sở dữ liệu để hoàn thành hướng dẫn này sẽ được tính vào mức sử dụng của bạn. Xóa cơ sở dữ liệu của bạn ngay khi bạn hoàn tất để kiểm soát chi phí. Tìm hiểu về các gói chi phí thấp của chúng tôi. Sinh viên đủ điều kiện có thể đăng ký tín dụng nền tảng thông qua chương trình Heroku cho sinh viên GitHub của chúng tôi
Thị trường tiện ích bổ sung có một số lượng lớn kho lưu trữ dữ liệu, từ các nhà cung cấp Redis và MongoDB, đến Postgres và MySQL. Trong bước này, bạn sẽ thêm cơ sở dữ liệu nhà phát triển Heroku Mini Postgres Starter Tier vào ứng dụng của mình
Thêm cơ sở dữ liệu
$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
3Thao tác này tạo cơ sở dữ liệu và đặt biến môi trường
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
66. Liệt kê các vars cấu hình cho ứng dụng của bạn sẽ hiển thị giá trị của $ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
66$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
4Heroku cũng cung cấp lệnh
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
68 hiển thị nhiều hơn nữa$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
5Điều này chỉ ra rằng bạn có một cơ sở dữ liệu nhỏ, đang chạy Postgres 11. 2 không có bảng hoặc hàng dữ liệu
Hãy thêm một tuyến đến ứng dụng sẽ sử dụng cơ sở dữ liệu này
Giống như mô-đun blackfriday, chúng ta cần
$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
69 mô-đun postgresql của Go, $ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
00, trước khi có thể sử dụng nó$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
6Thêm chức năng
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
01 vào ứng dụng và đăng ký tuyến đường $ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
02$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
7Cập nhật các phụ thuộc của bạn, cam kết mã mới và triển khai các thay đổi của bạn cho Heroku
$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
8Tải lại trang một vài lần và bạn sẽ thấy một cái gì đó như thế này
$ heroku create
Creating polar-inlet-4930.. done, stack is heroku-18
//polar-inlet-4930.herokuapp.com/ | //git.heroku.com/polar-inlet-4930.git
Git remote heroku added
9Nếu bạn đã cài đặt Postgres cục bộ, bạn có thể sử dụng lệnh
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› //cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in.. done
Logged in as me@example.com
03 để kết nối với cơ sở dữ liệu từ xa và xem tất cả các hàng$ git push heroku main
Enumerating objects: 521, done.
Counting objects: 100% [521/521], done.
Delta compression using up to 8 threads
Compressing objects: 100% [309/309], done.
Writing objects: 100% [521/521], 226.26 KiB | 45.25 MiB/s, done.
Total 521 [delta 141], reused 501 [delta 134]
remote: Compressing source files.. done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq.. done
remote:
remote: -----> Detected go modules - go.mod
remote:
remote: -----> Installing go1.17.2
remote: -----> Fetching go1.17.2.linux-amd64.tar.gz.. done
remote: !! Installing package '.' [default]
remote: !!
remote: !! To install a different package spec add a comment in the following form to your `go.mod` file:
remote: !! // +heroku install ./cmd/...
remote: !!
remote: -----> Running: go install -v -tags heroku -mod=vendor .
remote: gopkg.in/bluesuncorp/validator.v5
remote: github.com/gin-gonic/gin/render
remote: github.com/manucorporat/sse
remote: github.com/mattn/go-colorable
remote: golang.org/x/net/context
remote: github.com/heroku/x/hmetrics
remote: github.com/heroku/x/hmetrics/onload
remote: github.com/gin-gonic/gin/binding
remote: github.com/gin-gonic/gin
remote: github.com/heroku/go-getting-started
remote:
remote: Compiled the following binaries:
remote: ./bin/go-getting-started
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 5.5M
remote: -----> Launching...
remote: Released v3
remote: //go-on-heroku.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.. done.
To //git.heroku.com/go-on-heroku.git
* [new branch] main -> main
0Đọc thêm về Heroku PostgreSQL
Một kỹ thuật tương tự có thể được sử dụng để cài đặt các tiện ích bổ sung MongoDB hoặc Redis
Bước tiếp theo
Bây giờ bạn đã biết cách triển khai ứng dụng Go, thay đổi cấu hình, xem nhật ký, chia tỷ lệ cũng như đính kèm và sử dụng tiện ích bổ sung