»Creating an Example Application
Video tutorial below:
Create a new folder called example_app
in your $HOME
folder; there is no restriction on the location of Waypoint apps,
$HOME
is just used for the guide.
$ mkdir $HOME/example_app
If you look at the following example configuration, you will see that the use
block for the build
has a value
gobuilder
, which is the plugin's name to be loaded for the build component. Waypoint defines the convention that
plugins are always called waypoint-plugin-<name>
. When you run the waypoint build
command, Waypoint will search the
known plugin folders for a file called waypoint-plugin-gobuilder
it will then use that plugin for the build
component.
The configuration also has the values app
for the output_name
and the source as ./
, we can put our Go application
in the same location as the plugin config. First, create a file waypoint.hcl
in the folder $HOME/example_app/
with
the following contents.
project = "guides"
app "example" {
build {
use "gobuilder" {
output_name = "app"
source = "./"
}
}
deploy {
use "gobuilder" {}
}
}
Now you can create the source for the example application, let's make the most simple Go application possible. Create a
new file main.go
in your Waypoint application folder and copy the following to it.
package main
import "fmt"
func main() {
fmt.Println("Hello Waypoint")
}
You should now have two files in your application folder waypoint.hcl
and main.go
, let's test your new plugin.