Skip to content

Commit

Permalink
build: change remote target
Browse files Browse the repository at this point in the history
  • Loading branch information
thuongtruong109 committed Aug 11, 2024
1 parent 32324bb commit 59f65db
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 73 deletions.
10 changes: 5 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -30,5 +30,5 @@ docs
# Exclude any other files or directories specific to your project

.github

.circleci
nginx
3 changes: 1 addition & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
github: thuongtruong1009
ko_fi: thuongtruong1009
github: thuongtruong109
custom:
["https://paypal.me/thuongtruong1009", "https://nhantien.momo.vn/0917085937"]
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
71 changes: 13 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<div align="center">
<h1><img src="public/logo.png" alt="logo"> SHORT1URL</h1>
<h1><img src="public/logo.png" alt="logo"> ONELINK</h1>
<img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/thuongtruong1009/short1url/build.yml?logo=GitHub&label=build">
<img alt="Test status" src="https://img.shields.io/github/actions/workflow/status/thuongtruong1009/short1url/test.yml?logo=GitHub&label=test">
<img alt="CircleCI status" src="https://circleci.com/gh/circleci/circleci-docs.svg?style=svg">
<a href="https://github.com/thuongtruong1009/short1url/pkgs/container/short1url-api"><img alt="Automated api build" src="https://img.shields.io/docker/automated/thuongtruong1009/short1url-api?logo=Docker&label=server"></a>
<a href="https://github.com/thuongtruong1009/short1url/pkgs/container/short1url-client"><img alt="Automated client build" src="https://img.shields.io/docker/automated/thuongtruong1009/short1url-client?logo=Docker&label=client"></a>
<a href="https://github.com/thuongtruong109/onelink/pkgs/container/onelink-api"><img alt="Automated api build" src="https://img.shields.io/docker/automated/thuongtruong1009/onelink-api?logo=Docker&label=server"></a>
<a href="https://github.com/thuongtruong109/onelink/pkgs/container/onelink-client"><img alt="Automated client build" src="https://img.shields.io/docker/automated/thuongtruong1009/onelink-client?logo=Docker&label=client"></a>
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/thuongtruong1009/short1url">
<a href="https://github.com/thuongtruong1009/short1url/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/thuongtruong1009/short1url"></a>
<a href="https://paypal.me/thuongtruong1009" rel="nofollow"><img src="https://camo.githubusercontent.com/30c9a9ce3120b1eeb5cac34c303f02145c7f6997b4cd6d8faa049e98e1714ae0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d6666336635392e737667" data-canonical-src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" style="max-width: 100%;"></a>
<a href="https://github.com/thuongtruong109/onelink/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/thuongtruong1009/short1url"></a>
<a href="https://paypal.me/thuongtruong1009" rel="nofollow"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" style="max-width: 100%;"></a>
<!-- <img alt="api image size" src="https://img.shields.io/docker/image-size/thuongtruong1009/short1url-api/latest">
<img alt="client image size" src="https://img.shields.io/docker/image-size/thuongtruong1009/short1url-client/latest"> -->
</div>

## 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

Expand All @@ -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": "<your_original_url>"
}
```

```bash
# with curl
curl -X POST 'http://localhost:81/s'
-H 'Content-Type: application/json'
-d '{"url": "<your_original_url>"}"
```
![Image](public/architecture.png)

## Contributing

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
restart: always

client:
container_name: short1url-client
container_name: onelink-client
build:
context: ./client
dockerfile: Dockerfile.dev
Expand All @@ -29,7 +29,7 @@ services:
restart: always

api:
container_name: short1url-api
container_name: onelink-api
build:
context: ./api
dockerfile: Dockerfile.dev
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 59f65db

Please sign in to comment.