diff --git a/.dockerignore b/.dockerignore index 59d7c58..67bf222 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,10 +12,10 @@ client/dist \*/.env.example -app/.gitignore -app/Dockerfile -app/fly.toml -app/.dockerignore +api/.gitignore +api/Dockerfile +api/fly.toml +api/.dockerignore # Exclude version control system files @@ -30,5 +30,5 @@ docs # Exclude any other files or directories specific to your project .github - +.circleci nginx diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 68f2813..29a31bc 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,3 @@ -github: thuongtruong1009 -ko_fi: thuongtruong1009 +github: thuongtruong109 custom: ["https://paypal.me/thuongtruong1009", "https://nhantien.momo.vn/0917085937"] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bc0911..b3f1d46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: images: | - ${{ secrets.DOCKERHUB_USERNAME }}/short1url-api + ${{ secrets.DOCKERHUB_USERNAME }}/onelink-api ghcr.io/${{ github.repository }} - name: Build and push api image @@ -55,7 +55,7 @@ jobs: uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: images: | - ${{ secrets.DOCKERHUB_USERNAME }}/short1url-client + ${{ secrets.DOCKERHUB_USERNAME }}/onelink-client ghcr.io/${{ github.repository }} - name: Build and push client image diff --git a/README.md b/README.md index f9648e6..8e651da 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@
-

logo SHORT1URL

+

logo ONELINK

Build status Test status CircleCI status - Automated api build - Automated client build + Automated api build + Automated client build GitHub code size in bytes - License - + License +
## Description -This is a simple URL shortener service. It is written in Golang and uses Redis as database. Other hand, it also provides some services such as QR code generator, barcode generator, etc. +This is a simple URL shortener service, which helps you shorten your long URL to share repidly to external. It is written in Golang and uses Redis as database. Other hand, it also provides some services such as QR code generator, barcode generator, etc. ## Preview @@ -24,66 +24,21 @@ This is a simple URL shortener service. It is written in Golang and uses Redis a - [x] Shorten URL - [x] Redirect to original URL -- [x] Expiration time +- [x] Expiration time (default 1 day) +- [x] QR code generator (custom color, download image, copy to clipboard) +- [x] Barcode generator - [x] Statistics - [x] Rate limit -- [x] QR code generator (custom color, download image) -- [x] Barcode generator -- [x] Microservices Dockerize -- [x] Auto build and deploy image - [x] Reverse proxy +- [x] Multi Dockerize layers +- [x] CI/CD build and deploy image +- [ ] Custom expiration time - [ ] Unit test - [ ] Caching ## Architecture -![](public/architecture.png) - -## Getting started - -1. Clone this repo - -```bash -git clone https://github.com/thuongtruong1009/short1url.git -``` - -2. Fill in environment variables - -```bash -# client -cd api && cp .env.example .env - -# server -cd client && cp .env.example .env -``` - -3. Run Docker container - -```bash -docker-compose up -d -``` - -4. Testing API - -```bash -# with browser -Open http://localhost:81/s -``` - -```bash -# with Postman or browser -POST http://localhost:81/s -body: { - "url": "" -} -``` - -```bash -# with curl -curl -X POST 'http://localhost:81/s' - -H 'Content-Type: application/json' - -d '{"url": ""}" -``` +![Image](public/architecture.png) ## Contributing diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 2a668be..5dbb8db 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -13,7 +13,7 @@ services: restart: always client: - container_name: short1url-client + container_name: onelink-client build: context: ./client dockerfile: Dockerfile.dev @@ -29,7 +29,7 @@ services: restart: always api: - container_name: short1url-api + container_name: onelink-api build: context: ./api dockerfile: Dockerfile.dev diff --git a/docker-compose.yml b/docker-compose.yml index 5386710..9fc0989 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,13 +14,13 @@ services: restart: always client: - image: thuongtruong1009/short1url-client + image: thuongtruong1009/onelink-client container_name: client build: context: ./client dockerfile: Dockerfile env_file: - - ./client/.env + - ./client/.env.dev ports: - "3000:3000" environment: @@ -32,13 +32,13 @@ services: restart: always api: - image: thuongtruong1009/short1url-api + image: thuongtruong1009/onelink-api container_name: api build: context: ./api dockerfile: Dockerfile env_file: - - ./api/.env + - ./api/.env.dev ports: - "8080:8080" environment: