Skip to content

Commit

Permalink
Added update-deploy-app.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Lliillyy committed Dec 11, 2023
1 parent f6e26d8 commit e5b5565
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 30 deletions.
30 changes: 30 additions & 0 deletions src/app_deploy/update-deploy-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# exit immediately if a command exits with a non-zero status
#set -e

# Define some environment variables
export IMAGE_NAME="app_deployment"
export BASE_DIR=$(pwd)
export SECRETS_DIR=$(pwd)/../../../secrets/
export GCP_PROJECT="ac215project-398401" # Change to your GCP Project
export GCP_ZONE="us-west3-b"
export GOOGLE_APPLICATION_CREDENTIALS=/secrets/deployment.json

# Build the image based on the Dockerfile
#docker build -t $IMAGE_NAME -f Dockerfile .
docker build -t $IMAGE_NAME --platform=linux/amd64 -f Dockerfile .

# Run the container
docker run --rm --name $IMAGE_NAME \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$BASE_DIR":/app \
-v "$SECRETS_DIR":/secrets \
-v "$HOME/.ssh":/home/app/.ssh \
-v "$BASE_DIR/../api-service":/api-service \
-v "$BASE_DIR/../frontend":/frontend-react \
-e GOOGLE_APPLICATION_CREDENTIALS=$GOOGLE_APPLICATION_CREDENTIALS \
-e USE_GKE_GCLOUD_AUTH_PLUGIN=True \
-e GCP_PROJECT=$GCP_PROJECT \
-e GCP_ZONE=$GCP_ZONE \
$IMAGE_NAME sh deploy-app.sh
58 changes: 29 additions & 29 deletions src/app_deploy/update-k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,32 @@
protocol: TCP
restartPolicy: Always

# - name: "Update Deployment for API Service"
# k8s:
# state: present
# definition:
# apiVersion: v1
# kind: Deployment
# metadata:
# name: api
# namespace: "{{cluster_name}}-namespace"
# spec:
# selector:
# matchLabels:
# run: api
# template:
# metadata:
# labels:
# run: api
# spec:
# volumes:
# - name: persistent-vol
# emptyDir: {}
# - name: google-cloud-key
# secret:
# secretName: gcp-service-key
# containers:
# - image: gcr.io/{{ gcp_project }}/science-tutor-api-service:{{ tag.stdout}}
# imagePullPolicy: IfNotPresent
# name: api
# restartPolicy: Always
- name: "Update Deployment for API Service"
k8s:
state: present
definition:
apiVersion: v1
kind: Deployment
metadata:
name: api
namespace: "{{cluster_name}}-namespace"
spec:
selector:
matchLabels:
run: api
template:
metadata:
labels:
run: api
spec:
volumes:
- name: persistent-vol
emptyDir: {}
- name: google-cloud-key
secret:
secretName: gcp-service-key
containers:
- image: gcr.io/{{ gcp_project }}/science-tutor-api-service:{{ tag.stdout}}
imagePullPolicy: IfNotPresent
name: api
restartPolicy: Always
2 changes: 1 addition & 1 deletion src/frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import "./App.css";
import { Configuration, OpenAIApi } from "openai";

const APP_VERSION = "1.0";
const APP_VERSION = "1.1";

// Reference: https://github.com/EBEREGIT/react-chatgpt-tutorial

Expand Down

0 comments on commit e5b5565

Please sign in to comment.