mirror of
https://github.com/getlago/lago.git
synced 2025-01-18 16:29:25 +07:00
remove deployments from public repo
This commit is contained in:
parent
d07887ad7d
commit
42d40cd389
42
.github/workflows/delete-preview.yml
vendored
42
.github/workflows/delete-preview.yml
vendored
@ -1,42 +0,0 @@
|
||||
name: Delete Preview from Staging
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
preview_name:
|
||||
description: Preview Name (domain)
|
||||
required: true
|
||||
jobs:
|
||||
delete-preview:
|
||||
name: Delete Preview Branch
|
||||
if: github.event.inputs.preview_name != 'main'
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: getlago/deploy-staging
|
||||
env:
|
||||
PORTER_HOST: https://dashboard.getporter.dev
|
||||
PORTER_CLUSTER: ${{ secrets.PORTER_CLUSTER }}
|
||||
PORTER_PROJECT: ${{ secrets.PORTER_PROJECT }}
|
||||
PORTER_TOKEN: ${{ secrets.PORTER_TOKEN_2643 }}
|
||||
steps:
|
||||
- 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: us-east-1
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
- name: Configure kubectl
|
||||
run: echo "${{ secrets.KUBE_STAGING_CONFIG }}" | base64 -d > kubeconfig.yaml
|
||||
- name: Get Helm deployment
|
||||
id: helm_deployment
|
||||
run: echo "::set-output name=deployment::$(helm --kubeconfig ./kubeconfig.yaml list -f ${{ github.event.inputs.preview_name }}-app -o=json | jq '.[0].name')"
|
||||
- name: Delete Front Preview
|
||||
if: ${{ steps.helm_deployment.outputs.deployment != 'null' }}
|
||||
run: |
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-app
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-api
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-worker
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-clock
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-redis
|
231
.github/workflows/deploy-preview.yml
vendored
231
.github/workflows/deploy-preview.yml
vendored
@ -1,231 +0,0 @@
|
||||
name: Deploy Preview to Staging
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
preview_name:
|
||||
description: Preview Name (domain)
|
||||
required: true
|
||||
default: 'main'
|
||||
front_branch:
|
||||
description: Front Branch
|
||||
required: true
|
||||
default: 'main'
|
||||
api_branch:
|
||||
description: API Branch
|
||||
required: true
|
||||
default: 'main'
|
||||
jobs:
|
||||
build-front-image:
|
||||
name: Build Front Image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Front
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: getlago/lago-front
|
||||
ref: ${{ github.event.inputs.front_branch }}
|
||||
path: front
|
||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||
- 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: us-east-1
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
- name: Build, tag and push image to Amazon ECR
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: lago-front-staging
|
||||
IMAGE_TAG: ${{ github.event.inputs.front_branch }}
|
||||
API_URL: https://${{ github.event.inputs.preview_name }}-api.staging.getlago.com
|
||||
run: |
|
||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg API_URL=$API_URL ./front
|
||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||
front-deploy:
|
||||
name: Deploy Front
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: getlago/deploy-staging
|
||||
needs: [build-front-image]
|
||||
env:
|
||||
PORTER_HOST: https://dashboard.getporter.dev
|
||||
PORTER_CLUSTER: ${{ secrets.PORTER_CLUSTER }}
|
||||
PORTER_PROJECT: ${{ secrets.PORTER_PROJECT }}
|
||||
PORTER_TOKEN: ${{ secrets.PORTER_TOKEN_2643 }}
|
||||
steps:
|
||||
- name: Checkout Front
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: getlago/lago-front
|
||||
ref: ${{ github.event.inputs.front_branch }}
|
||||
path: front
|
||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||
- 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: us-east-1
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
- name: Replace Variables in values.yaml
|
||||
env:
|
||||
ECR_REPOSITORY: ${{ steps.login-ecr.outputs.registry }}/lago-front-staging
|
||||
BRANCH: ${{ github.event.inputs.front_branch }}
|
||||
DOMAIN: ${{ github.event.inputs.preview_name }}
|
||||
run: envsubst < ./front/porter/values.yaml > ./front/porter/env_values.yaml
|
||||
- name: Configure kubectl
|
||||
run: echo "${{ secrets.KUBE_STAGING_CONFIG }}" | base64 -d > kubeconfig.yaml
|
||||
- name: Get Helm deployment
|
||||
id: helm_deployment
|
||||
run: echo "::set-output name=deployment::$(helm --kubeconfig ./kubeconfig.yaml list -f ${{ github.event.inputs.preview_name }}-app -o=json | jq '.[0].name')"
|
||||
- name: Delete Porter app
|
||||
if: ${{ steps.helm_deployment.outputs.deployment != 'null' }}
|
||||
run: |
|
||||
echo "${{ steps.helm_deployment.outputs.deployment }}"
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-app
|
||||
- name: Create Porter app
|
||||
uses: porter-dev/porter-cli-action@v0.1.0
|
||||
with:
|
||||
command: create web --app ${{ github.event.inputs.preview_name }}-app --source registry --values ./front/porter/env_values.yaml --image ${{ steps.login-ecr.outputs.registry }}/lago-front-staging:${{ github.event.inputs.front_branch }}
|
||||
|
||||
build-api-image:
|
||||
name: Build API Image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout API
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: getlago/lago-api
|
||||
ref: ${{ github.event.inputs.api_branch }}
|
||||
path: api
|
||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||
- 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: us-east-1
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
- name: Docker tag
|
||||
id: docker_tag
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: lago-api-staging
|
||||
IMAGE_TAG: ${{ github.event.inputs.api_branch }}
|
||||
run: echo "##[set-output name=tag;]$(echo $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG)"
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
env:
|
||||
RAILS_ENV: staging
|
||||
API_URL: https://${{ github.event.inputs.preview_name }}-api.staging.getlago.com
|
||||
LAGO_FRONT_URL: https://${{ github.event.inputs.preview_name }}-app.staging.getlago.com
|
||||
with:
|
||||
context: ./api
|
||||
push: true
|
||||
tags: ${{ steps.docker_tag.outputs.tag }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
api-deploy:
|
||||
name: Deploy API
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-api-image]
|
||||
container:
|
||||
image: getlago/deploy-staging
|
||||
env:
|
||||
PORTER_HOST: https://dashboard.getporter.dev
|
||||
PORTER_CLUSTER: ${{ secrets.PORTER_CLUSTER }}
|
||||
PORTER_PROJECT: ${{ secrets.PORTER_PROJECT }}
|
||||
PORTER_TOKEN: ${{ secrets.PORTER_TOKEN_2643 }}
|
||||
steps:
|
||||
- name: Checkout API
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: getlago/lago-api
|
||||
ref: ${{ github.event.inputs.api_branch }}
|
||||
path: api
|
||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||
- 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: us-east-1
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
- name: Replace Variables
|
||||
env:
|
||||
ECR_REPOSITORY: ${{ steps.login-ecr.outputs.registry }}/lago-api-staging
|
||||
BRANCH: ${{ github.event.inputs.api_branch }}
|
||||
DATABASE_URL: postgres://lago:${{ secrets.DB_STAGING_PASSWORD }}@${{ secrets.DB_STAGING_HOST}}:5432/${{ github.event.inputs.preview_name }}
|
||||
DOMAIN: ${{ github.event.inputs.preview_name }}
|
||||
REDIS_URL: redis://${{ github.event.inputs.preview_name }}-redis-master.default.svc.cluster.local:6379
|
||||
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
run: |
|
||||
envsubst < ./api/porter/api.yaml > ./api/porter/env_api.yaml
|
||||
envsubst < ./api/porter/worker.yaml > ./api/porter/env_worker.yaml
|
||||
envsubst < ./api/porter/clock.yaml > ./api/porter/env_clock.yaml
|
||||
- name: Configure kubectl
|
||||
run: echo "${{ secrets.KUBE_STAGING_CONFIG }}" | base64 -d > kubeconfig.yaml
|
||||
- name: Get Helm Redis deployment
|
||||
id: helm_redis_deployment
|
||||
run: echo "::set-output name=deployment::$(helm --kubeconfig ./kubeconfig.yaml list -f ${{ github.event.inputs.preview_name }}-redis -o=json | jq '.[0].name')"
|
||||
- name: Create Redis deployment
|
||||
if: ${{ steps.helm_redis_deployment.outputs.deployment == 'null' }}
|
||||
run: |
|
||||
helm --kubeconfig ./kubeconfig.yaml repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm --kubeconfig ./kubeconfig.yaml install --set auth.enabled=false ${{ github.event.inputs.preview_name }}-redis bitnami/redis
|
||||
- name: Get Helm API deployment
|
||||
id: helm_deployment
|
||||
run: echo "::set-output name=deployment::$(helm --kubeconfig ./kubeconfig.yaml list -f ${{ github.event.inputs.preview_name }}-api -o=json | jq '.[0].name')"
|
||||
- name: Delete API app
|
||||
if: ${{ steps.helm_deployment.outputs.deployment != 'null' }}
|
||||
run: |
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-api
|
||||
- name: Create API app
|
||||
uses: porter-dev/porter-cli-action@v0.1.0
|
||||
with:
|
||||
command: create web --app ${{ github.event.inputs.preview_name }}-api --source registry --values ./api/porter/env_api.yaml --image ${{ steps.login-ecr.outputs.registry }}/lago-api-staging:${{ github.event.inputs.api_branch }}
|
||||
- name: Get Helm Worker deployment
|
||||
id: helm_worker_deployment
|
||||
run: echo "::set-output name=deployment::$(helm --kubeconfig ./kubeconfig.yaml list -f ${{ github.event.inputs.preview_name }}-worker -o=json | jq '.[0].name')"
|
||||
- name: Delete Worker app
|
||||
if: ${{ steps.helm_worker_deployment.outputs.deployment != 'null' }}
|
||||
run: |
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-worker
|
||||
- name: Create Worker app
|
||||
uses: porter-dev/porter-cli-action@v0.1.0
|
||||
with:
|
||||
command: create worker --app ${{ github.event.inputs.preview_name }}-worker --source registry --values ./api/porter/env_worker.yaml --image ${{ steps.login-ecr.outputs.registry }}/lago-api-staging:${{ github.event.inputs.api_branch }}
|
||||
- name: Get Helm Clock deployment
|
||||
id: helm_clock_deployment
|
||||
run: echo "::set-output name=deployment::$(helm --kubeconfig ./kubeconfig.yaml list -f ${{ github.event.inputs.preview_name }}-clock -o=json | jq '.[0].name')"
|
||||
- name: Delete Clock app
|
||||
if: ${{ steps.helm_clock_deployment.outputs.deployment != 'null' }}
|
||||
run: |
|
||||
helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-clock
|
||||
- name: Create Clock app
|
||||
uses: porter-dev/porter-cli-action@v0.1.0
|
||||
with:
|
||||
command: create worker --app ${{ github.event.inputs.preview_name }}-clock --source registry --values ./api/porter/env_clock.yaml --image ${{ steps.login-ecr.outputs.registry }}/lago-api-staging:${{ github.event.inputs.api_branch }}
|
2
api
2
api
@ -1 +1 @@
|
||||
Subproject commit 86b8f175c387eae9cf2430ef040049d563c860eb
|
||||
Subproject commit fa0eea55a10f4eb7a9748f6ef2ef8abf96f7e619
|
2
front
2
front
@ -1 +1 @@
|
||||
Subproject commit ea30979b24a6d0a3b50674070505918f894044d8
|
||||
Subproject commit 944aabe88d10530ca344f96a34643e09965051e1
|
Loading…
Reference in New Issue
Block a user