URL Shortener using Key Generation Service (KGS)
- add cronjob to delete expired short url
- better logging
- repository tests
- e2e tests
- cache when not found
- Dockerfile
- docker-compose.yml
- CI/CD
- k8s config (maybe in other repo)
- download docker-compose.yml
wget https://raw.githubusercontent.com/txya900619/url-shortener/main/deployments/docker-compose.yml
- docker-compose up
docker-compose up
- Install gowatch
go install github.com/silenceper/gowatch@latest
- Install generate dependencies
go install github.com/google/wire/cmd/wire@latest \
&& go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest \
&& go install go install google.golang.org/protobuf/cmd/protoc-gen-go@latest \
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
- Generate needed files
go generate ./...
- Start PostgreSQL
docker run --name postgres-docker -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=123456 -d postgres
- Start Redis
docker run --name redis-docker -p 6379:6379 -d redis redis-server --requirepass "abc123"
- Start Cassandra
docker run --name cassandra-docker -p 9042:9042 bitnami/cassandra:latest
- Start kgs (if you want to use in production, change KEY_LENGTH to 6 or more)
cd cmd/kgs \
&& gowatch
- Start shorturl server
cd cmd/shorturl \
&& gowatch
See openapi doc
- PostgreSQL (TODO)
- Redis (TODO)
- Cassandra (TODO)