A sample Go application to deploy to Cloud Foundry using dep | Read-only mirror of https://github.com/swisscom/cf-sample-app-go-dep — Swisscom. Issues & pull requests at the source.
  • Go 88.5%
  • Makefile 11.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-10-16 17:16:13 +02:00
app/hello go dep example 2018-07-06 14:08:10 +02:00
.cfignore added .cfignore to avoid pushing vendor and README.md 2018-07-09 10:12:03 +02:00
.gitignore go dep example 2018-07-06 14:08:10 +02:00
CODE_OF_CONDUCT.md Compliance bulk update. Add CODE_OF_CONDUCT.md 2024-10-16 17:16:13 +02:00
CONTRIBUTING.md Compliance bulk update. Add CONTRIBUTING.md 2024-10-16 17:16:09 +02:00
Gopkg.lock go dep example 2018-07-06 14:08:10 +02:00
Gopkg.toml go dep example 2018-07-06 14:08:10 +02:00
health.go go dep example 2018-07-06 14:08:10 +02:00
LICENSE added licence 2018-07-06 14:38:49 +02:00
main.go go dep example 2018-07-06 14:08:10 +02:00
Makefile added .cfignore to avoid pushing vendor and README.md 2018-07-09 10:12:03 +02:00
manifest.yml added routes in manifest 2018-07-09 12:25:49 +02:00
README.md go dep example 2018-07-06 14:08:10 +02:00

cf-sample-app-go-dep

A sample Go application to deploy to Cloud Foundry using dep

This basic example uses a custom router and serves 2 endpoints /health and / it uses the environment var VERSION defined in the manifest.yml the one later is returned when querying the /health endpoint.

The application has the following structure:

|-- app
|     `--hello
|       `--hello.go
|-- health.go
|-- main.go
`-- manifest.yml

How to use it

Install and set your GO environment

For example using $HOME/go for your workspace

$ export GOPATH=$HOME/go

Create the directory:

$ mkdir -p $HOME/go/src/github.com/swisscom

Clone project into that directory:

$ git clone https://github.com/swisscom/cf-sample-app-go-dep.git $HOME/go/src/github.com/swisscom/cf-sample-app-go-dep

git is required to clone the repository.

To test the app locally before deploying it in to app-cloud, build it by just typing make:

$ cd $HOME/go/src/github.com/swisscom/cf-sample-app-go-dep
$ make

After make finishes you can run the app:

$ ./cf-sample-app-go-dep
2018/07/06 13:39:12 Adding path: /health [ALL]
2018/07/06 13:39:12 Adding path: / [ALL]

This steps requires dep

Visit http://localhost:8080

Deploying the app to app-cloud

If you tested locally, remove the vendor directory or simply use:

$ make clean

Then just use:

$ cf push