- Go version 1.13+.
- Be sure the local packages binaries path is in the system's
PATH
environment variable:
$ export PATH=$PATH:<your_go_workspace>/bin
You 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):
server
port
(SERVER_PORT
) Number Server port number. (Default: 80)
make tools
make run
You can use the
make watch
command 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>/healthcheck
Server 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-docs
command.