https://github.com/siongui/go-kit-url-shortener-micro-service
URL shortener micro-service using Go kit
https://github.com/siongui/go-kit-url-shortener-micro-service
go go-kit golang microservice
Last synced: 6 months ago
JSON representation
URL shortener micro-service using Go kit
- Host: GitHub
- URL: https://github.com/siongui/go-kit-url-shortener-micro-service
- Owner: siongui
- License: unlicense
- Created: 2021-11-10T02:57:58.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-09T08:20:31.000Z (almost 4 years ago)
- Last Synced: 2025-02-10T00:50:05.901Z (8 months ago)
- Topics: go, go-kit, golang, microservice
- Language: Go
- Homepage:
- Size: 295 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
==========================
URL Shortener Microservice
==========================.. image:: https://img.shields.io/badge/Language-Go-blue.svg
:target: https://golang.org/.. image:: https://godoc.org/github.com/siongui/go-kit-url-shortener-micro-service?status.svg
:target: https://godoc.org/github.com/siongui/go-kit-url-shortener-micro-service.. image:: https://github.com/siongui/go-kit-url-shortener-micro-service/workflows/ci/badge.svg
:target: https://github.com/siongui/go-kit-url-shortener-micro-service/blob/master/.github/workflows/ci.yml.. image:: https://goreportcard.com/badge/github.com/siongui/go-kit-url-shortener-micro-service
:target: https://goreportcard.com/report/github.com/siongui/go-kit-url-shortener-micro-service.. image:: https://img.shields.io/badge/license-Unlicense-blue.svg
:target: https://github.com/siongui/go-kit-url-shortener-micro-service/blob/master/UNLICENSEURL shortener microservice using `Go kit`_, Docker_, and `Amazon EKS`_.
Development Environment:
- `Ubuntu 20.04`_
- `Go 1.17`_Description
+++++++++++See `Assignment `_.
Usage
+++++First install ``Docker Engine`` and `Docker Compose`_.
To run the micro-service in Docker_ environment:.. code-block:: bash
$ sudo docker-compose up --build
To create short URL:
.. code-block:: bash
$ curl -XPOST -d'{"url":"https://github.com/siongui/go-kit-url-shortener-micro-service"}' localhost:8080/create
{"short_url":"20wogJaCuRtH0U5p60LvjZoVwsz"}To recover the original URL:
.. code-block:: bash
$ curl -XGET localhost:8080/20wogJaCuRtH0U5p60LvjZoVwsz
{"url":"https://github.com/siongui/go-kit-url-shortener-micro-service"}If you HTTP GET some URL that does not exist, you will get:
.. code-block:: bash
$ curl -XGET localhost:8080/20wogJaCuRtH0U5p
{"url":"","err":"sql: no rows in result set"}To see metrics of the the micro-service:
.. code-block:: bash
$ curl -XGET localhost:8080/metrics
Database Configuration
++++++++++++++++++++++The application will determine which database to use according to environment
variables. The application first check if the following environment variables
are set:- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_HOST
- POSTGRES_PORT
- POSTGRES_DBIf they are set, The application will try to connect to PostgresSQL. If
connection failure, the application will panic. If the *POSTGRES* env are not
set, the application will then check the following environment variable:- SQLITE_DSN
If it is set, the application will try to connect to SQLite, panic if connection
failure.If all above environment variables are not set, the application will use SQLite
with ``file::memory:?cache=shared`` DSN. See `getds.go `_ for details.Deployment
++++++++++`Deploy to Amazon EKS `_
UNLICENSE
+++++++++Released in public domain. See UNLICENSE_.
References
++++++++++.. [1] | `golang microservice framework - Google search `_
| `golang microservice framework - DuckDuckGo search `_
| `golang microservice framework - Ecosia search `_
| `golang microservice framework - Qwant search `_
| `golang microservice framework - Bing search `_
| `golang microservice framework - Yahoo search `_
| `golang microservice framework - Baidu search `_
| `golang microservice framework - Yandex search `_.. [2] | `golang 微服务 - Google search `_
| `golang 微服务 - DuckDuckGo search `_
| `golang 微服务 - Ecosia search `_
| `golang 微服务 - Qwant search `_
| `golang 微服务 - Bing search `_
| `golang 微服务 - Yahoo search `_
| `golang 微服务 - Baidu search `_
| `golang 微服务 - Yandex search `_
| `如何使用 Go kit 工具包编写微服务 - Go语言中文网 - Golang中文社区 `_.. [3] `Microservices in Go `_
(`Chinese translation `__).. [4] | `GO-TAMBOON ไปทำบุญ `_
| `Go URL shortener `_
| `Go Employee Open API `_.. [5] | `golang generate unique id - Google search `_
| `golang generate unique id - DuckDuckGo search `_
| `golang generate unique id - Ecosia search `_
| `golang generate unique id - Qwant search `_
| `golang generate unique id - Bing search `_
| `golang generate unique id - Yahoo search `_
| `golang generate unique id - Baidu search `_
| `golang generate unique id - Yandex search `_
|
| `Generating good unique ids in Go `_.. [6] | `go kit + gin - Google search `_
| `Gin与go-kit如何搭配使用? - 知乎 `_
| `examples/stringsvc5 at feature-add-gin-example · xpzouying/examples `_.. [7] | `run golang on docker - Google search `_
| `run golang on docker - DuckDuckGo search `_
| `run golang on docker - Ecosia search `_
| `run golang on docker - Qwant search `_
| `run golang on docker - Bing search `_
| `run golang on docker - Yahoo search `_
| `run golang on docker - Baidu search `_
| `run golang on docker - Yandex search `_
|
| `Build your Go image | Docker Documentation `_.. [8] | `Overview of Docker Compose | Docker Documentation `_
| `用 Docker 玩轉 PostgreSQL | My.APOLLO `_
| `Docker - 第十二章 | 安裝PostgreSQL | J.J.'s Blogs `_
| `[Docker] 於 Windows 中運行 PostgreSQL Container 來提供本機 DB 開發環境 | 搞搞就懂 - 點部落 `_
| `Play PostgreSQL with Docker. Docker 就是你的實驗室,執行記錄 | by 古哥 | pgsql-tw | Medium `_
| `Docker筆記 - 進入Container,建立並操作 PostgreSQL Container | by Albert Hg | alberthg-docker-notes | Medium `_
| `docker compose postgres - Google search `_
| `docker compose postgres - DuckDuckGo search `_
| `docker compose postgres - Ecosia search `_
| `docker compose postgres - Qwant search `_
| `docker compose postgres - Bing search `_
| `docker compose postgres - Yahoo search `_
| `docker compose postgres - Baidu search `_
| `docker compose postgres - Yandex search `_
| `Creating and filling a Postgres DB with Docker compose | by José David Arévalo | Level Up Coding `_.. [9] | `run postgres on github actions - Google search `_
| `run postgres on github actions - DuckDuckGo search `_
| `run postgres on github actions - Ecosia search `_
| `run postgres on github actions - Qwant search `_
| `run postgres on github actions - Bing search `_
| `run postgres on github actions - Yahoo search `_
| `run postgres on github actions - Baidu search `_
| `run postgres on github actions - Yandex search `_
|
| `Creating PostgreSQL service containers - GitHub Docs `_.. [10] | `Microservices using Go, Docker, RabbitMQ, Redis, AWS, CI/CD : golang `_
| `GitHub - ebosas/microservices: A microservices example in Go `_.. [11] | `golang short uuid url friendly - Google search `_
| `golang short uuid url friendly - DuckDuckGo search `_
| `golang short uuid url friendly - Ecosia search `_
| `golang short uuid url friendly - Qwant search `_
| `golang short uuid url friendly - Bing search `_
| `golang short uuid url friendly - Yahoo search `_
| `golang short uuid url friendly - Baidu search `_
| `golang short uuid url friendly - Yandex search `_
|
| `GitHub - matoous/go-nanoid: Golang random IDs generator. `_.. [12] | `GitHub - regebro/hovercraft: Make dynamic impressive presentations from text files! `_
| `rst2html5slides - Presentations from restructuredtext files — rst2html5slides 1.0 documentation `_
| `List of markdown presentation tools · GitHub `_.. _Go: https://golang.org/
.. _Ubuntu 20.04: https://releases.ubuntu.com/20.04/
.. _Go 1.17: https://golang.org/dl/
.. _UNLICENSE: https://unlicense.org/
.. _Go kit: https://gokit.io/
.. _Docker: https://www.docker.com/
.. _Docker Compose: https://docs.docker.com/compose/
.. _Amazon EKS: https://aws.amazon.com/eks/
.. _Amazon RDS: https://aws.amazon.com/rds/