Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 376211f

Browse files
committed
chore: update readme, change gh username
1 parent f0cfb8d commit 376211f

File tree

16 files changed

+65
-34
lines changed

16 files changed

+65
-34
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright © 2023 xxxibgdrgnmm nguyenduyphuong_t59@hus.edu.vn
3+
Copyright © 2023 nduyphuong nguyenduyphuong_t59@hus.edu.vn
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
11
# Reverse registry
22

3+
This is Chainguard reverse registry that redirect to Chainguard's `cgr.dev/chainguard/*` public registry. The public, free tier of Chainguard Images only serves `latest` tag. This could be of inconvenience so we wrote this reverse registry to continously watching Chainguard registry for digest changes and extract the package version via SBOM. We then tag the image according with the packaged software version and serve via this reverse registry.
34

4-
This is a simple registry redirect service that redirect our.domain.com/* to cgr.dev/chainguard/*. It also run a background process to periodically hash image index to sha256 checksum and save to a local database (default in-mem sqlite is used. For production purpose, mysql is the recommended choice)
5+
By default, in-mem sqlite is used but MySQL is recommended for production setup.
6+
## Usage
57

6-
Deploying
8+
To be update
9+
10+
How to run this locally/production.
11+
## How it works
12+
13+
Just an example. Need to update this accordingly.
14+
15+
```mermaid
16+
sequenceDiagram
17+
autonumber
18+
actor U as User
19+
participant RR as Reverse Registry
20+
participant DB as Local Digest Database
21+
participant CG as Chainguard Images
22+
U->>+RR: Pull command `nginx:1.0.0`
23+
RR->>+DB: Check if digest existed for `nginx:1.0.0`
24+
DB-->>-RR: Found digest for `nginx:1.0.0`
25+
RR-->>-U: Return digest if found
26+
27+
loop Every x Minutes
28+
RR->>CG: Periodically checking `latest` tag for digest change
29+
RR->>DB: Save digest for this tag to local db
30+
end
31+
32+
33+
RR->>CG: Proxied every other APIs
34+
35+
```
36+
37+
## Deploy with Cloud Run
738

839
[![Run on Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run)

app/app.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import (
55
"time"
66

77
"github.com/gin-gonic/gin"
8+
"github.com/nduyphuong/reverse-registry/config"
9+
"github.com/nduyphuong/reverse-registry/handler"
10+
"github.com/nduyphuong/reverse-registry/inject"
11+
digestfetcher "github.com/nduyphuong/reverse-registry/services/digest-fetcher"
12+
"github.com/nduyphuong/reverse-registry/utils"
813
"github.com/sirupsen/logrus"
9-
"github.com/xxxibgdrgnmm/reverse-registry/config"
10-
"github.com/xxxibgdrgnmm/reverse-registry/handler"
11-
"github.com/xxxibgdrgnmm/reverse-registry/inject"
12-
digestfetcher "github.com/xxxibgdrgnmm/reverse-registry/services/digest-fetcher"
13-
"github.com/xxxibgdrgnmm/reverse-registry/utils"
1414
)
1515

1616
func RunAPI(conf config.Config) error {

cmd/root.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2023 xxxibgdrgnmm nguyenduyphuong_t59@hus.edu.vn
2+
Copyright © 2023 nduyphuong nguyenduyphuong_t59@hus.edu.vn
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
@@ -25,10 +25,10 @@ import (
2525
"fmt"
2626
"os"
2727

28+
"github.com/nduyphuong/reverse-registry/config"
29+
"github.com/nduyphuong/reverse-registry/constant"
2830
"github.com/spf13/cobra"
2931
"github.com/spf13/viper"
30-
"github.com/xxxibgdrgnmm/reverse-registry/config"
31-
"github.com/xxxibgdrgnmm/reverse-registry/constant"
3232
)
3333

3434
var cfgFile string

cmd/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2023 xxxibgdrgnmm <nguyenduyphuong_t59@hus.edu.vn>
2+
Copyright © 2023 nduyphuong <nguyenduyphuong_t59@hus.edu.vn>
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
@@ -22,8 +22,8 @@ THE SOFTWARE.
2222
package cmd
2323

2424
import (
25+
"github.com/nduyphuong/reverse-registry/app"
2526
"github.com/spf13/cobra"
26-
"github.com/xxxibgdrgnmm/reverse-registry/app"
2727
"golang.org/x/sync/errgroup"
2828
)
2929

driver/mysql_driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package driver
33
import (
44
"fmt"
55

6-
"github.com/xxxibgdrgnmm/reverse-registry/model"
6+
"github.com/nduyphuong/reverse-registry/model"
77
"gorm.io/driver/mysql"
88
"gorm.io/gorm"
99
"gorm.io/gorm/logger"

driver/sqlte_driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package driver
22

33
import (
4-
"github.com/xxxibgdrgnmm/reverse-registry/model"
4+
"github.com/nduyphuong/reverse-registry/model"
55
"gorm.io/driver/sqlite"
66
"gorm.io/gorm"
77
"gorm.io/gorm/logger"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/xxxibgdrgnmm/reverse-registry
1+
module github.com/nduyphuong/reverse-registry
22

33
go 1.20
44

handler/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99

1010
"github.com/docker/distribution/reference"
1111
"github.com/gin-gonic/gin"
12+
"github.com/nduyphuong/reverse-registry/repository"
13+
containerregistry "github.com/nduyphuong/reverse-registry/services/container-registry"
14+
"github.com/nduyphuong/reverse-registry/utils"
1215
"github.com/sirupsen/logrus"
13-
"github.com/xxxibgdrgnmm/reverse-registry/repository"
14-
containerregistry "github.com/xxxibgdrgnmm/reverse-registry/services/container-registry"
15-
"github.com/xxxibgdrgnmm/reverse-registry/utils"
1616
)
1717

1818
type Interface interface {

inject/inject.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package inject
33
import (
44
"sync"
55

6-
"github.com/xxxibgdrgnmm/reverse-registry/config"
7-
"github.com/xxxibgdrgnmm/reverse-registry/driver"
8-
"github.com/xxxibgdrgnmm/reverse-registry/repository"
9-
containerregistry "github.com/xxxibgdrgnmm/reverse-registry/services/container-registry"
6+
"github.com/nduyphuong/reverse-registry/config"
7+
"github.com/nduyphuong/reverse-registry/driver"
8+
"github.com/nduyphuong/reverse-registry/repository"
9+
containerregistry "github.com/nduyphuong/reverse-registry/services/container-registry"
1010
)
1111

1212
var imageStorage *repository.Storage

0 commit comments

Comments
 (0)