- Go version 1.13+.
- Be sure the local packages binaries path is in the system's
PATHenvironment variable:
$ export PATH=$PATH:<your_go_workspace>/binYou can set the ENV environment variable to development and update the internal/config/development.yaml when necessary. On the other way, you can use environment variables to configure your installation. In case you are running the published Docker image, you'll need to stick with the environment variables.
The configuration parameters are the following (the environment variable name is in parenthesis):
serverport(SERVER_PORT) Number Server port number. (Default: 80)
make toolsmake runYou can use the
make watchcommand to run the application on watching mode, allowing it to be restarted automatically when the code changes.
- Install docker engine (https://docs.docker.com/install/)
A container is specified at docker/Dockerfile. To use it, execute the following steps:
-
Build the image:
docker build . -f docker/Dockerfile -t cesarbr/knot-babeltower -
Create a file containing the configuration as environment variables.
-
Run the container:
docker run --env-file knot-babeltower.env -ti cesarbr/knot-babeltower
A development container is specified at docker/Dockerfile-dev. To use it, execute the following steps:
-
Build the image:
docker build . -f docker/Dockerfile-dev -t cesarbr/knot-babeltower:dev -
Create a file containing the configuration as environment variables.
-
Run the container:
docker run --env-file knot-babeltower.env -p 8080:80 -v `pwd`:/usr/src/app -ti cesarbr/knot-babeltower:dev
The first argument to -v must be the root of this repository, so if you are running from another folder, replace pwd with the corresponding path.
This will start the server with auto-reload.
curl http://<hostname>:<port>/healthcheckServer documentation is auto-generated by the swag tool (https://github.com/swaggo/swag) from annotations placed in the code and can be viewed on the browser: http://<address>:<port>/swagger/index.html.
If you want to generate the documentation just run the
make http-docscommand.