-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
1 addition
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,4 @@ | ||
Go platform | ||
=========== | ||
|
||
The Go platform supports two kinds of deployment: binary deployment and code | ||
deployment, where tsuru will build your application in the target. | ||
|
||
Binary deployment | ||
----------------- | ||
|
||
For binary deployment, ensure your binary is named "tsuru-app" (``go build -o | ||
tsuru-app`` should do the trick) and matches the target platform (usually | ||
linux_amd64), you can have a customized name if you also deploy a Procfile, | ||
something like: | ||
|
||
% ls | ||
Procfile main.go | ||
% GOOS=linux GOARCH=amd64 go build -o myapp main.go | ||
% cat Procfile | ||
web: ./myapp | ||
% tsuru app deploy -a [app-name] myapp Procfile | ||
|
||
Code deployment | ||
--------------- | ||
|
||
If you just run a ``tsuru app deploy`` of your code, tsuru will try to download all of | ||
your dependencies using ``go get`` and build your application. You can | ||
customize this behavior, see the next section for more details. | ||
|
||
Suppose that you have this code structure: | ||
|
||
% ls | ||
main.go | ||
% cat main.go | ||
# some code that starts a "hello world" webserver | ||
% tsuru app deploy -a [app-name] . | ||
|
||
After invoking ``tsuru app deploy``, tsuru will receive your code and tell the platform | ||
to follow the setup process, that will: | ||
|
||
- download all the dependencies using ``go get`` | ||
- build the application, expecting the root of your project to be a main | ||
package | ||
|
||
Code deployment with customized compilation step | ||
------------------------------------------------ | ||
|
||
You can also use tsuru hooks to customize the compilation and a Procfile to | ||
customize the execution of your application, here's an example: | ||
|
||
% tree | ||
. | ||
├── Procfile | ||
├── src | ||
│ └── main.go | ||
└── tsuru.yaml | ||
|
||
1 directory, 3 files | ||
% cat tsuru.yaml | ||
hooks: | ||
build: | ||
- go get github.com/bmizerany/pat | ||
- go build -o $HOME/myapp src/main.go | ||
% cat Procfile | ||
web: $HOME/myapp -host 0.0.0.0 -port $PORT | ||
% tsuru app deploy -a [app-name] . | ||
|
||
At this point, tsuru will parse the tsuru.yaml file and invoke the build hooks | ||
to build your application, and then use the command specified in the Procfile | ||
to start it. | ||
Official guide: https://tsuru.github.io/docs/user_guides/deploy_go_apps/ |