NOTE: this README is a work in progress
This repository provides some examples of web microservices built in Golang.
- Multi-arch docker image build
- Services
- Task webhook service
- Auth stub service
Using docker-compose.yaml
:
docker-compose up -d --build --force-recreate
Using go
:
- Create and export
.env
to prevent port conflict
cp .env.example .env
sed -i 's/# AUTH_API_HOST=.*/AUTH_API_HOST=127.0.0.1/' .env
sed -i 's/# AUTH_API_PORT=.*/AUTH_API_PORT=8081/' .env
export $(cat .env | xargs)
- Run services
nohup go run cmd/auth/main.go &> auth.log &
nohup go run cmd/task-webhook/main.go &> task-webhook.log &
- Cleanup
kill $(jobs -p)
curl localhost:8080 -X POST -H "Authorization: 12" -d '{"name": "restart auth api"}'
- When task-webhook is run in a container it can not restart itself. This would require external orchestration to work properly.
- Potential workaround would be to set
DOCKER_HOST
, but if it results in restarting itself it will remain stopped.
- Potential workaround would be to set
- Currently all the microservices are bundled together into one image, these should be separated out.
- Logging needs improvement/translation layer implemented.