Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates on GH Actions and YAML #19

Merged
merged 2 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/package-makeline-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v2
with:
context: src/order-service
context: src/makeline-service
file: src/makeline-service/Dockerfile
push: true
tags: |
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/package-product-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: package-product-service

on:
workflow_dispatch:

jobs:
set-env:
name: Set Environment Variables
runs-on: ubuntu-latest
outputs:
version: ${{ steps.main.outputs.version }}
created: ${{ steps.main.outputs.created }}
project: ${{ steps.main.outputs.project }}
image: ${{ steps.main.outputs.image }}
repository: ${{ steps.main.outputs.repository }}
steps:
- id: main
run: |
echo ::set-output name=version::$(echo ${GITHUB_SHA} | cut -c1-7)
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=project::product-service
echo ::set-output name=image::product-service
echo ::set-output name=repository::ghcr.io/azure-samples/aks-store-demo

package-service:
name: Package Service
runs-on: ubuntu-latest
needs: set-env
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: src/product-service
file: src/product-service/Dockerfile
push: true
tags: |
${{ needs.set-env.outputs.repository }}/${{ needs.set-env.outputs.image }}:latest
${{ needs.set-env.outputs.repository }}/${{ needs.set-env.outputs.image }}:${{ needs.set-env.outputs.version }}
labels: |
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.created=${{ needs.set-env.outputs.created }}
org.opencontainers.image.revision=${{ needs.set-env.outputs.version }}
46 changes: 46 additions & 0 deletions ai-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ai-service
spec:
replicas: 1
selector:
matchLabels:
app: ai-service
template:
metadata:
labels:
app: ai-service
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: order-service
image: ghcr.io/azure-samples/aks-store-demo/ai-service:latest
ports:
- containerPort: 5001
env:
- name: USE_AZURE_OPENAI
value: ""
- name: AZURE_OPENAI_DEPLOYMENT_NAME
value: ""
- name: AZURE_OPENAI_ENDPOINT
value: ""
- name: OPENAI_API_KEY
value: ""
- name: OPENAI_ORG_ID
value: ""
resources: {}
---
apiVersion: v1
kind: Service
metadata:
name: ai-service
spec:
type: ClusterIP
ports:
- name: http
port: 5001
targetPort: 5001
selector:
app: ai-service
79 changes: 18 additions & 61 deletions aks-store-all-in-one.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- port: 27017
selector:
app: mongodb
type: LoadBalancer
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -78,54 +78,7 @@ spec:
- name: rabbitmq-http
port: 15672
targetPort: 15672
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ai-service
spec:
replicas: 1
selector:
matchLabels:
app: ai-service
template:
metadata:
labels:
app: ai-service
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: order-service
image: ghcr.io/azure-samples/aks-store-demo/ai-service:latest
ports:
- containerPort: 5001
env:
- name: USE_AZURE_OPENAI
value: ""
- name: AZURE_OPENAI_DEPLOYMENT_NAME
value: ""
- name: AZURE_OPENAI_ENDPOINT
value: ""
- name: OPENAI_API_KEY
value: ""
- name: OPENAI_ORG_ID
value: ""
resources: {}
---
apiVersion: v1
kind: Service
metadata:
name: ai-service
spec:
type: LoadBalancer
ports:
- name: http
port: 5001
targetPort: 5001
selector:
app: ai-service
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -168,7 +121,7 @@ kind: Service
metadata:
name: order-service
spec:
type: LoadBalancer
type: ClusterIP
ports:
- name: http
port: 3000
Expand Down Expand Up @@ -215,7 +168,7 @@ kind: Service
metadata:
name: makeline-service
spec:
type: LoadBalancer
type: ClusterIP
ports:
- name: http
port: 3001
Expand Down Expand Up @@ -247,7 +200,9 @@ spec:
name: store-front
env:
- name: ORDER_SERVICE_URL
value: "http://order-service:3000"
value: "http://order-service:3000/"
- name: PRODUCT_SERVICE_URL
value: "http://product-service:3000/"
resources: {}
---
apiVersion: v1
Expand Down Expand Up @@ -278,25 +233,27 @@ spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: store-front
image: ghcr.io/azure-samples/aks-store-demo/store-front:latest
- name: store-admin
image: ghcr.io/azure-samples/aks-store-demo/store-admin:latest
ports:
- containerPort: 8080
name: store-front
name: store-admin
env:
- name: ORDER_SERVICE_URL
value: "http://order-service:3000"
- name: PRODUCT_SERVICE_URL
value: "http://productservice:3002/"
- name: MAKELINE_SERVICE_URL
value: "http://makelineservice:3001/"
resources: {}
---
apiVersion: v1
kind: Service
metadata:
name: store-front
name: store-admin
spec:
ports:
- port: 8080
selector:
app: store-front
app: store-admin
type: LoadBalancer
---
apiVersion: apps/v1
Expand All @@ -322,7 +279,7 @@ spec:
- name: ORDER_SERVICE_URL
value: http://order-service:3000/
- name: ORDERS_PER_HOUR
value: "1"
value: "100"
resources: {}
---
apiVersion: apps/v1
Expand All @@ -348,5 +305,5 @@ spec:
- name: MAKELINE_SERVICE_URL
value: http://makeline-service:3001
- name: ORDERS_PER_HOUR
value: "1"
value: "100"
resources: {}