Service implementing the task for IT RALLY 2020 HighLoad Cup (runs on All Cups platform).
Table of Contents
- Go 1.15
- Docker 19.03+
- Docker Compose 1.25+
- Tools used to build/test project (feel free to install these tools using your OS package manager or any other way, but please ensure they've required versions):
GO111MODULE=off go get -u github.com/myitcv/gobin
curl -sSfL https://github.com/hadolint/hadolint/releases/download/v1.19.0/hadolint-$(uname)-x86_64 | sudo install /dev/stdin /usr/local/bin/hadolint
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.$(uname).x86_64.tar.xz | sudo tar xJf - -C /usr/local/bin --strip-components=1 shellcheck-v0.7.1/shellcheck
- After cloning the repo copy
env.sh.dist
toenv.sh
. - Review
env.sh
and update for your system as needed. - It's recommended to add shell alias
alias dc="if test -f env.sh; then source env.sh; fi && docker-compose"
and then rundc
instead ofdocker-compose
- this way you won't have to runsource env.sh
after changing it.
To develop this project you'll need only standard tools: go generate
,
go test
, go build
, docker build
. Provided scripts are for
convenience only.
- Always load
env.sh
in every terminal used to run any project-related commands (includinggo test
):source env.sh
.- When
env.sh.dist
change (e.g. bygit pull
) next run ofsource env.sh
will fail and remind you to manually updateenv.sh
to match currentenv.sh.dist
.
- When
go generate ./...
- do not forget to run after making changes related to auto-generated codego test ./...
- test project (excluding integration tests), fast./scripts/test
- thoroughly test project, slow./scripts/test-ci-circle
- run tests locally like CircleCI will do./scripts/cover
- analyse and show coverage./scripts/build
- build docker image and binaries inbin/
- Then use mentioned above
dc
(ordocker-compose
) to run and control the project. - Access project at host/port(s) defined in
env.sh
.
- Then use mentioned above
As this project isn't a real service but a one-shot task which is
supposed to handle single user for a fixed period of time and then finish,
if you'll use dc up
to start it while development then you should use
dc up --force-recreate
to ensure each time it'll start with clean state.
An alternative is to just run bin/task
or use docker run
.
docker run --name=hlcup2020_task -i -t --rm \
-e HLCUP2020_DIFFICULTY=normal \
-v hlcup2020-task:/home/app/var/data \
ghcr.io/djarvur/allcups-itrally-2020-task:1.1.0