Gex - Go Example Project
This is a Golang "Hello World" example project.
You can install Gex using the following methods.
Run using the default docker daemon
- Set an environment variable to match your current environment (or any arbitrary text)
- Lint, Build, test and Run using docker with command:
Now that Gex is running and your environment variable is set. You will be able to see the following output from curl
See the current Gex webpage.
Using the API
curl -s localhost:8080/api/message | jq -r '.message'
An environment variable needs to be provided for the
- environment variable
Note that Golang is not required as building and unit tests are run from within a docker image.
Note that you do not have to have golang installed on your system as the binary is built using a docker container. Build using the following commands
Test using the following commands
Upload to the docker repository
- add a new annotated git tag using semver
git tag -a -m "description" v[major].[minor].[patch]if you have not done so already
- upload to your docker repository
List of make commands
make- lint, build, unittest, test and run
make lint- format and lint the code
make build- compile the go code in it's own docker container
make unittest- run the unit tests
make run- runs Gex in the runtime docker container.
make integrationtest- runs the integration tests
make uitest- runs the ui tests
make test- runs the integrationtest and uitest
make upload- upload the latest docker runtime to the docker registry
make docker-build- create the docker image used for Building
make docker-runtime- create the docker runtime image used for running Gex
Please note that there is no latest version to run a specific version must be selected.
- System with the docker daemon running
- Access to the docker repository (docker hub)
- Upload your docker image as per the process above
on the virtual machine which is currently running docker run the following command, selecting the correct version.
docker rm --force gex ; docker run -d --restart=always -p 8080:8080 -e GEXENV=prod --name gex jamie/gex:v[major].[minor].[patch]
I would suggest running under a clustering technology, such as kubernetes Installation would vary in this case, depending upon the technology chosen.