Skip to content

Commit

Permalink
Merge pull request #41 from alice890308/feat/ingress
Browse files Browse the repository at this point in the history
Feat/ingress
  • Loading branch information
Ivan Ou authored Jun 14, 2022
2 parents 2be7b93 + a94284b commit ad93e4b
Show file tree
Hide file tree
Showing 16 changed files with 326 additions and 57 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ jobs:
- name: build
run: make build

- name: login ghcr
- name: login to docker hub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PAT_TOKEN }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: setup docker buildx
uses: docker/setup-buildx-action@v1

- name: set image name
run: |
echo "IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> ${{ github.env }}
echo "IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> ${{ github.env }}
- name: docker build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ github.sha }}
6 changes: 3 additions & 3 deletions cmd/file/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func runFile(_ *cobra.Command, _ []string) error {

router.Use(middleware.CORS())

router.StaticFS("/file/static", gin.Dir("/static", false))
router.StaticFS("/static", gin.Dir("/static", false))

router.GET("/file/status", func(c *gin.Context) {
router.GET("/", func(c *gin.Context) {
svc.Status(c)
})

router.POST("/file/upload", func(c *gin.Context) {
router.POST("/upload", func(c *gin.Context) {
svc.Upload(c)
})

Expand Down
26 changes: 13 additions & 13 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ services:
depends_on:
- mongo
- api
# ports:
# - 8008:8080
ports:
- 8001:8080

file:
image: tsw303005/blog-server:latest
Expand All @@ -87,15 +87,15 @@ services:
command:
- /cmd
- file
# ports:
# - 8080:8080

nginx:
image: nginx:stable
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
ports:
- 8008:8008
depends_on:
- file
- gateway
- 8082:8080

# nginx:
# image: nginx:stable
# volumes:
# - ./nginx.conf:/etc/nginx/nginx.conf
# ports:
# - 8008:8008
# depends_on:
# - file
# - gateway
2 changes: 1 addition & 1 deletion helm/api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: tsw303005/blog-server
repository: alice890308/blog-server
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: latest
Expand Down
2 changes: 1 addition & 1 deletion helm/file/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: tsw303005/blog-server
repository: alice890308/blog-server
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: latest
Expand Down
4 changes: 2 additions & 2 deletions helm/gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: tsw303005/blog-server
repository: alice890308/blog-server
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: latest
Expand Down Expand Up @@ -39,7 +39,7 @@ securityContext: {}
service:
type: ClusterIP
port: 80
target: 8080
targetPort: 8080

ingress:
enabled: false
Expand Down
27 changes: 27 additions & 0 deletions k8s/ingress/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: blog-server
spec:
rules:
- host: file.ivanouo.one
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: file
port:
number: 80

- host: gateway.ivanouo.one
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gateway
port:
number: 80
160 changes: 137 additions & 23 deletions modules/api/pb/session_message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ad93e4b

Please sign in to comment.