deploy production environment
This commit is contained in:
+15
-20
@@ -8,13 +8,13 @@ generate:
|
|||||||
test:
|
test:
|
||||||
go test -json ./... | docker run -i ghcr.io/gotesttools/gotestfmt:latest
|
go test -json ./... | docker run -i ghcr.io/gotesttools/gotestfmt:latest
|
||||||
|
|
||||||
.PHONY: migrate-dev-db
|
.PHONY: migrate-dev
|
||||||
migrate-dev-db:
|
migrate-dev:
|
||||||
./migrate_dev.sh
|
./migrate_dev.sh
|
||||||
|
|
||||||
# .PHONY: migrate-prod-db
|
.PHONY: migrate-prod
|
||||||
# migrate-prod-db:
|
migrate-prod:
|
||||||
# ./migrate_prod.sh
|
./migrate_prod.sh
|
||||||
|
|
||||||
# ex: make create-migration ARG="create_users_table"
|
# ex: make create-migration ARG="create_users_table"
|
||||||
create-migration:
|
create-migration:
|
||||||
@@ -28,23 +28,18 @@ dev-database:
|
|||||||
--context dev \
|
--context dev \
|
||||||
--command -- /bin/bash -c "psql \$$LLINK_POSTGRES_CONNECTION_URL"
|
--command -- /bin/bash -c "psql \$$LLINK_POSTGRES_CONNECTION_URL"
|
||||||
|
|
||||||
# prod-database:
|
prod-database:
|
||||||
# kubectl run postgres-client \
|
kubectl run postgres-client \
|
||||||
# --rm -it --image=postgres:latest \
|
--rm -it --image=postgres:latest \
|
||||||
# --env="LLINK_POSTGRES_CONNECTION_URL=$$(kubectl get secret shared-secrets -o jsonpath='{.data.LLINK_POSTGRES_CONNECTION_URL}' --context prod | base64 --decode)" \
|
--env="LLINK_POSTGRES_CONNECTION_URL=$$(kubectl get secret shared-secrets -o jsonpath='{.data.LLINK_POSTGRES_CONNECTION_URL}' --context prod | base64 --decode)" \
|
||||||
# --context prod \
|
--context prod \
|
||||||
# --command -- /bin/bash -c "psql \$$LLINK_POSTGRES_CONNECTION_URL"
|
--command -- /bin/bash -c "psql \$$LLINK_POSTGRES_CONNECTION_URL"
|
||||||
|
|
||||||
.PHONY: deploy-dev
|
.PHONY: deploy-dev
|
||||||
deploy-dev: generate test
|
deploy-dev: generate test
|
||||||
./deploy_dev.sh
|
./deploy_dev.sh
|
||||||
|
|
||||||
# .PHONY: release
|
.PHONY: deploy-prod
|
||||||
# deploy-prod: generate test
|
deploy-prod: generate test
|
||||||
# # Check for any changes (both staged and unstaged)
|
./deploy_prod.sh
|
||||||
# @if [ -n "$(git status --porcelain)" ]; then \
|
|
||||||
# echo "Error: You have uncommitted changes in your Git repository."; \
|
|
||||||
# exit 1; \
|
|
||||||
# fi
|
|
||||||
# ./deploy_prod.sh
|
|
||||||
#
|
|
||||||
|
|||||||
+1
-1
@@ -4,4 +4,4 @@ set -e
|
|||||||
|
|
||||||
export KUBE_CONTEXT=dev
|
export KUBE_CONTEXT=dev
|
||||||
export SKAFFOLD_DEFAULT_REPO=us-west2-docker.pkg.dev/flowy-dev-440017/deployments
|
export SKAFFOLD_DEFAULT_REPO=us-west2-docker.pkg.dev/flowy-dev-440017/deployments
|
||||||
skaffold run -p dev --kube-context dev --port-forward --tail
|
skaffold run -p dev --kube-context $KUBE_CONTEXT --port-forward --tail
|
||||||
|
|||||||
Executable
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export KUBE_CONTEXT=prod
|
||||||
|
export SKAFFOLD_DEFAULT_REPO=us-west2-docker.pkg.dev/flowy-prod-440017/deployments
|
||||||
|
skaffold run -p prod --kube-context $KUBE_CONTEXT --port-forward --tail
|
||||||
@@ -40,8 +40,6 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: shared-secrets
|
name: shared-secrets
|
||||||
key: LLINK_POSTGRES_CONNECTION_URL
|
key: LLINK_POSTGRES_CONNECTION_URL
|
||||||
- name: "GCP_PROJECT"
|
|
||||||
value: "flowy-dev-440017"
|
|
||||||
- name: "GOOGLE_SERVICE_ACCOUNT_EMAIL"
|
- name: "GOOGLE_SERVICE_ACCOUNT_EMAIL"
|
||||||
value: "[email protected]"
|
value: "[email protected]"
|
||||||
- name: "REDIS_HOST"
|
- name: "REDIS_HOST"
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: orion
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: orion
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: orion
|
||||||
|
spec:
|
||||||
|
serviceAccountName: default-service-account
|
||||||
|
containers:
|
||||||
|
- name: orion
|
||||||
|
image: "orion"
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "52Mi"
|
||||||
|
cpu: 50m
|
||||||
|
limits:
|
||||||
|
memory: "52Mi"
|
||||||
|
cpu: 50m
|
||||||
|
env:
|
||||||
|
- name: "PORT"
|
||||||
|
value: "8080"
|
||||||
|
- name: "AERO_ADDR"
|
||||||
|
value: "aero:50051"
|
||||||
|
- name: "GCS_BUCKET"
|
||||||
|
value: "flowy-llink-prod-bucket"
|
||||||
|
- name: "LLINK_POSTGRES_CONNECTION_URL"
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: shared-secrets
|
||||||
|
key: LLINK_POSTGRES_CONNECTION_URL
|
||||||
|
- name: "GOOGLE_SERVICE_ACCOUNT_EMAIL"
|
||||||
|
value: "[email protected]"
|
||||||
|
- name: "REDIS_HOST"
|
||||||
|
value: "10.204.2.99"
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: orion
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: orion
|
||||||
|
ports:
|
||||||
|
- port: 8080
|
||||||
|
targetPort: 8080
|
||||||
|
protocol: TCP
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
kind: HTTPRoute
|
||||||
|
apiVersion: gateway.networking.k8s.io/v1beta1
|
||||||
|
metadata:
|
||||||
|
name: orion
|
||||||
|
spec:
|
||||||
|
parentRefs:
|
||||||
|
- kind: Gateway
|
||||||
|
name: external-gateway
|
||||||
|
hostnames:
|
||||||
|
- orion.flowy.live
|
||||||
|
rules:
|
||||||
|
- backendRefs:
|
||||||
|
- name: orion
|
||||||
|
port: 8080
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: networking.gke.io/v1
|
||||||
|
kind: HealthCheckPolicy
|
||||||
|
metadata:
|
||||||
|
name: orion-service-health-check
|
||||||
|
spec:
|
||||||
|
default:
|
||||||
|
checkIntervalSec: 15
|
||||||
|
timeoutSec: 15
|
||||||
|
healthyThreshold: 1
|
||||||
|
unhealthyThreshold: 2
|
||||||
|
logConfig:
|
||||||
|
enabled: true
|
||||||
|
config:
|
||||||
|
type: HTTP
|
||||||
|
httpHealthCheck:
|
||||||
|
portSpecification: USE_FIXED_PORT
|
||||||
|
port: 8080
|
||||||
|
requestPath: /health
|
||||||
|
targetRef:
|
||||||
|
group: ""
|
||||||
|
kind: Service
|
||||||
|
name: orion
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: particleprocessorworker
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: particleprocessorworker
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: particleprocessorworker
|
||||||
|
spec:
|
||||||
|
serviceAccountName: default-service-account
|
||||||
|
containers:
|
||||||
|
- name: particleprocessorworker
|
||||||
|
image: "particleprocessorworker"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "52Mi"
|
||||||
|
cpu: 50m
|
||||||
|
limits:
|
||||||
|
memory: "52Mi"
|
||||||
|
cpu: 50m
|
||||||
|
env:
|
||||||
|
- name: "GCP_PROJECT"
|
||||||
|
value: "flowy-prod-440017"
|
||||||
|
- name: "GCS_BUCKET"
|
||||||
|
value: "flowy-llink-bucket"
|
||||||
|
- name: "GOOGLE_SERVICE_ACCOUNT_EMAIL"
|
||||||
|
value: "[email protected]"
|
||||||
|
- name: "LLINK_POSTGRES_CONNECTION_URL"
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: shared-secrets
|
||||||
|
key: LLINK_POSTGRES_CONNECTION_URL
|
||||||
|
- name: "DEEPGRAM_API_KEY"
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: shared-secrets
|
||||||
|
key: DEEPGRAM_SECRET
|
||||||
+1
-1
@@ -7,5 +7,5 @@ echo "# NOTE: if you run into issues with 'dirty' migrations: https://github.com
|
|||||||
export KUBE_CONTEXT=dev
|
export KUBE_CONTEXT=dev
|
||||||
export SKAFFOLD_DEFAULT_REPO=us-west2-docker.pkg.dev/flowy-dev-440017/deployments
|
export SKAFFOLD_DEFAULT_REPO=us-west2-docker.pkg.dev/flowy-dev-440017/deployments
|
||||||
kubectl delete job migrations --ignore-not-found --context=$KUBE_CONTEXT
|
kubectl delete job migrations --ignore-not-found --context=$KUBE_CONTEXT
|
||||||
skaffold run -p migrations --kube-context dev
|
skaffold run -p migrations --kube-context $KUBE_CONTEXT
|
||||||
|
|
||||||
|
|||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "# NOTE: if you run into issues with 'dirty' migrations: https://github.com/golang-migrate/migrate/issues/282#issuecomment-530743258"
|
||||||
|
|
||||||
|
export KUBE_CONTEXT=prod
|
||||||
|
export SKAFFOLD_DEFAULT_REPO=us-west2-docker.pkg.dev/flowy-prod-440017/deployments
|
||||||
|
kubectl delete job migrations --ignore-not-found --context=$KUBE_CONTEXT
|
||||||
|
skaffold run -p migrations --kube-context $KUBE_CONTEXT
|
||||||
|
|
||||||
@@ -55,6 +55,10 @@ profiles:
|
|||||||
context: .
|
context: .
|
||||||
docker:
|
docker:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
- image: particleprocessorworker
|
||||||
|
context: .
|
||||||
|
docker:
|
||||||
|
dockerfile: Dockerfile.particleprocessorworker
|
||||||
manifests:
|
manifests:
|
||||||
rawYaml:
|
rawYaml:
|
||||||
- k8s/prod/*
|
- k8s/prod/*
|
||||||
|
|||||||
Reference in New Issue
Block a user