-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
eks release workflow #405
eks release workflow #405
Changes from 31 commits
dc57b2c
6ff4ab2
f299bb9
61a1d3a
a747489
b892d82
5c163d8
fc9fd96
10d1565
29a34ff
299368c
a7f5939
36c7d99
30d42e5
fe147d4
0b2a48b
b59a040
6ee5d8c
a1bcb98
a5578a1
b0fd527
86d3f6b
5e85dfb
a2978de
e756687
d2ec53f
93ecfaf
6f6b37f
15ac246
081d422
01879be
ab76e41
dd17915
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Deploy to EKS | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-central-1 | ||
|
||
- name: Setup kubectl | ||
uses: azure/setup-kubectl@v3 | ||
with: | ||
version: latest | ||
|
||
- name: Authenticate kubectl with EKS | ||
run: | | ||
aws eks update-kubeconfig --region eu-central-1 --name mpm | ||
|
||
- name: Deploy to EKS | ||
run: | | ||
if kubectl get deployment mpm-backend; then | ||
kubectl rollout restart deployment/mpm-backend | ||
else | ||
echo "mpm-backend deployment does not exist, applying initial deployment..." | ||
kubectl apply -f k8s/deployments/mpm-backend.yaml | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need the
|
||
|
||
if kubectl get deployment mpm-frontend; then | ||
kubectl rollout restart deployment/mpm-frontend | ||
else | ||
echo "mpm-frontend deployment does not exist, applying initial deployment..." | ||
kubectl apply -f k8s/deployments/mpm-frontend.yaml | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also add a step that runs |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,31 +3,34 @@ kind: Deployment | |
metadata: | ||
name: mpm-backend | ||
spec: | ||
progressDeadlineSeconds: 600 | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, please do not change this file. |
||
app: mpm-backend | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
app: mpm-backend | ||
spec: | ||
containers: | ||
- name: mpm-backend | ||
image: enaccess/micropowermanager-backend:latest | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 80 | ||
env: | ||
- env: | ||
- name: APP_NAME | ||
value: MicroPowerManager | ||
- name: APP_ENV | ||
value: demo | ||
- name: APP_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: mpm-secrets | ||
key: APP_KEY | ||
name: mpm-secrets | ||
- name: APP_DEBUG | ||
value: "false" | ||
- name: MPM_LOAD_DEMO_DATA | ||
|
@@ -37,32 +40,65 @@ spec: | |
- name: DB_HOST | ||
valueFrom: | ||
secretKeyRef: | ||
name: mpm-secrets | ||
key: DB_HOST | ||
name: mpm-secrets | ||
- name: DB_PORT | ||
value: "3306" | ||
- name: DB_DATABASE | ||
value: micro_power_manager | ||
- name: DB_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: mpm-secrets | ||
key: DB_USERNAME | ||
name: mpm-secrets | ||
- name: DB_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: mpm-secrets | ||
key: DB_PASSWORD | ||
name: mpm-secrets | ||
- name: REDIS_HOST | ||
value: redis-db-service | ||
- name: REDIS_PORT | ||
value: "6379" | ||
- name: JWT_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: mpm-secrets | ||
key: JWT_SECRET | ||
name: mpm-secrets | ||
- name: CACHE_DRIVER | ||
value: redis | ||
- name: QUEUE_DRIVER | ||
value: database | ||
image: enaccess/micropowermanager-backend:latest | ||
imagePullPolicy: Always | ||
name: mpm-backend | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
resources: {} | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 | ||
status: | ||
availableReplicas: 1 | ||
conditions: | ||
- lastTransitionTime: "2024-12-13T05:47:18Z" | ||
lastUpdateTime: "2024-12-13T05:47:18Z" | ||
message: Deployment has minimum availability. | ||
reason: MinimumReplicasAvailable | ||
status: "True" | ||
type: Available | ||
- lastTransitionTime: "2024-12-13T05:46:55Z" | ||
lastUpdateTime: "2024-12-13T05:47:18Z" | ||
message: ReplicaSet "mpm-backend-7b59564f89" has successfully progressed. | ||
reason: NewReplicaSetAvailable | ||
status: "True" | ||
type: Progressing | ||
observedGeneration: 1 | ||
readyReplicas: 1 | ||
replicas: 1 | ||
updatedReplicas: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this as a separate workflow won't work. If a new release gets created this will run immediately. However, the deploy to DockerHub job takes around 1h usually. So, we Pull the Docker image before the new one is even available.
Could you instead, move the
deploy
job into the already existingrelease-publish-dockerhub.yaml
, also rename it todeploy-demo
. Then please add aneed
(see here) to depend on therelease-publish