Revert "update: migrate dp from sts to deployments (#25615)" (#25996)

This reverts commit 6762d2ce90.
This commit is contained in:
Goutham Pratapa 2023-08-03 23:40:06 +05:30 committed by GitHub
parent 57cf92e68d
commit bc24d03dbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 37 deletions

View File

@ -42,6 +42,5 @@ jobs:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_URL: ${{ secrets.DB_URL }} DB_URL: ${{ secrets.DB_URL }}
GH_TOKEN: ${{ secrets.APPSMITH_DEPLOY_PREVIEW_PAT }} GH_TOKEN: ${{ secrets.APPSMITH_DEPLOY_PREVIEW_PAT }}
DP_EFS_ID: ${{ secrets.APPSMITH_DP_EFS_ID }}
run: /bin/bash ./scripts/cleanup_dp.sh run: /bin/bash ./scripts/cleanup_dp.sh

View File

@ -237,8 +237,6 @@ jobs:
DB_USERNAME: ${{ secrets.DB_USERNAME }} DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_URL: ${{ secrets.DB_URL }} DB_URL: ${{ secrets.DB_URL }}
DP_EFS_ID: ${{ secrets.APPSMITH_DP_EFS_ID }}
REDIS_URL: ${{ secrets.APPSMITH_DP_REDIS_URL }}
run: | run: |
echo "environment variables set to deploy the image" $IMAGE_HASH echo "environment variables set to deploy the image" $IMAGE_HASH
/bin/bash ./scripts/deploy_preview.sh /bin/bash ./scripts/deploy_preview.sh

View File

@ -40,7 +40,5 @@ for i in $deployed_charts
helm uninstall $i -n $i helm uninstall $i -n $i
kubectl delete ns $i || true kubectl delete ns $i || true
mongosh "mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$i?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" --eval 'db.dropDatabase()' mongosh "mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$i?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" --eval 'db.dropDatabase()'
ACCESS_POINT_ID=$(aws efs describe-access-points --file-system-id "$DP_EFS_ID" | jq -r '.AccessPoints[] | select(.Name=="'"ce$pr"'") | .AccessPointId')
aws efs delete-access-point --access-point-id $ACCESS_POINT_ID
fi fi
done done

View File

@ -29,30 +29,14 @@ export AWS_ACCESS_KEY_ID=$(echo $sts_output | jq -r '.Credentials''.AccessKeyId'
export AWS_SECRET_ACCESS_KEY=$(echo $sts_output | jq -r '.Credentials''.SecretAccessKey');\ export AWS_SECRET_ACCESS_KEY=$(echo $sts_output | jq -r '.Credentials''.SecretAccessKey');\
export AWS_SESSION_TOKEN=$(echo $sts_output | jq -r '.Credentials''.SessionToken'); export AWS_SESSION_TOKEN=$(echo $sts_output | jq -r '.Credentials''.SessionToken');
# If recreate option is give first delete the existing resources and create them later.
if [[ -n "${RECREATE-}" ]]
then
kubectl delete ns $NAMESPACE || true
mongosh "mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$DBNAME?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" --eval 'db.dropDatabase()'
ACCESS_POINT_ID=$(aws efs describe-access-points --file-system-id "$DP_EFS_ID" | jq -r '.AccessPoints[] | select(.Name=="'"ce$PULL_REQUEST_NUMBER"'") | .AccessPointId')
aws efs delete-access-point --access-point-id $ACCESS_POINT_ID
fi
echo "Create Access Point and Access Point ID"
## Use DP-EFS and create ACCESS_POINT
ACCESS_POINT=$(aws efs create-access-point --file-system-id $DP_EFS_ID --tags Key=Name,Value=ce$PULL_REQUEST_NUMBER)
ACCESS_POINT_ID=$(echo $ACCESS_POINT | jq -r '.AccessPointId');
export NAMESPACE=ce"$PULL_REQUEST_NUMBER" export NAMESPACE=ce"$PULL_REQUEST_NUMBER"
export CHARTNAME=ce"$PULL_REQUEST_NUMBER" export CHARTNAME=ce"$PULL_REQUEST_NUMBER"
export SECRET=ce"$PULL_REQUEST_NUMBER" export SECRET=ce"$PULL_REQUEST_NUMBER"
export DBNAME=ce"$PULL_REQUEST_NUMBER" export DBNAME=ce"$PULL_REQUEST_NUMBER"
export DOMAINNAME=ce-"$PULL_REQUEST_NUMBER".dp.appsmith.com export DOMAINNAME=ce-"$PULL_REQUEST_NUMBER".dp.appsmith.com
export HELMCHART="appsmith" export HELMCHART="appsmith"
export HELMCHART_URL="https://helm-ee.appsmith.com" export HELMCHART_URL="http://helm.appsmith.com"
export HELMCHART_VERSION="3.0.4" export HELMCHART_VERSION="2.0.2"
aws eks update-kubeconfig --region $region --name $cluster_name --profile eksci aws eks update-kubeconfig --region $region --name $cluster_name --profile eksci
@ -62,7 +46,12 @@ kubectl config set-context --current --namespace=default
echo "Getting the pods" echo "Getting the pods"
kubectl get pods kubectl get pods
echo "Create Namespace and secret to isolate resources." if [[ -n "${RECREATE-}" ]]
then
kubectl delete ns $NAMESPACE || true
mongosh "mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$DBNAME?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" --eval 'db.dropDatabase()'
fi
echo "Use kubernetes secret to Pull Image" echo "Use kubernetes secret to Pull Image"
kubectl create ns $NAMESPACE || true kubectl create ns $NAMESPACE || true
@ -71,24 +60,18 @@ kubectl create secret docker-registry $SECRET \
--docker-username=$DOCKER_HUB_USERNAME \ --docker-username=$DOCKER_HUB_USERNAME \
--docker-password=$DOCKER_HUB_ACCESS_TOKEN -n $NAMESPACE --docker-password=$DOCKER_HUB_ACCESS_TOKEN -n $NAMESPACE
echo "Add appsmith-ee to helm repo" echo "Add appsmith-ce to helm repo"
AWS_REGION=us-east-2 helm repo add "$HELMCHART" "$HELMCHART_URL"; AWS_REGION=ap-south-1 helm repo add $HELMCHART $HELMCHART_URL
helm repo update;
echo "Deploy appsmith helm chart" echo "Deploy appsmith helm chart"
helm upgrade -i $CHARTNAME appsmith-ee/$HELMCHART -n $NAMESPACE --create-namespace --recreate-pods \ helm upgrade -i $CHARTNAME appsmith/appsmith -n $NAMESPACE \
--set _image.repository=$DOCKER_HUB_ORGANIZATION/appsmith-dp --set _image.tag=$IMAGE_HASH \ --create-namespace --recreate-pods --set image.repository=$DOCKER_HUB_ORGANIZATION/appsmith-dp --set image.tag=$IMAGE_HASH \
--set image.pullSecrets=$SECRET --set autoscaling.enabled=true --set autoscaling.minReplicas=1 \ --set image.pullSecrets=$SECRET --set redis.enabled=false --set mongodb.enabled=false --set ingress.enabled=true \
--set autoscaling.maxReplicas=1 --set redis.enabled=false --set postgresql.enabled=false --set mongodb.enabled=false --set ingress.enabled=true \
--set "ingress.annotations.service\.beta\.kubernetes\.io/aws-load-balancer-ssl-cert=$AWS_RELEASE_CERT" \ --set "ingress.annotations.service\.beta\.kubernetes\.io/aws-load-balancer-ssl-cert=$AWS_RELEASE_CERT" \
--set "ingress.hosts[0].host=$DOMAINNAME, ingress.hosts[0].paths[0].path=/, ingress.hosts[0].paths[0].pathType=Prefix" \ --set "ingress.hosts[0].host=$DOMAINNAME, ingress.hosts[0].paths[0].path=/, ingress.hosts[0].paths[0].pathType=Prefix" \
--set autoupdate.enabled=false --set persistence.efs.enabled=true --set ingress.className="nginx" \ --set ingress.className="nginx" --set applicationConfig.APPSMITH_CLOUD_SERVICES_BASE_URL="https://release-cs.appsmith.com" \
--set persistence.efs.driver=efs.csi.aws.com --set persistence.storageClass=efs-dp-appsmith \ --set image.pullPolicy="Always" --set autoupdate.enabled="true" --set persistence.size=2Gi \
--set persistence.efs.volumeHandle=$DP_EFS_ID::$ACCESS_POINT_ID \
--set applicationConfig.APPSMITH_SENTRY_DSN="https://abf15a075d1347969df44c746cca7eaa@o296332.ingest.sentry.io/1546547" \ --set applicationConfig.APPSMITH_SENTRY_DSN="https://abf15a075d1347969df44c746cca7eaa@o296332.ingest.sentry.io/1546547" \
--set applicationConfig.APPSMITH_SENTRY_ENVIRONMENT="$NAMESPACE" \ --set applicationConfig.APPSMITH_SENTRY_ENVIRONMENT="$NAMESPACE" \
--set applicationConfig.APPSMITH_MONGODB_URI="mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$DBNAME?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" \ --set applicationConfig.APPSMITH_MONGODB_URI="mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$DBNAME?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" \
--set applicationConfig.APPSMITH_REDIS_URL="$APPSMITH_DP_REDIS_URL:6379" \
--set applicationConfig.APPSMITH_DISABLE_EMBEDDED_KEYCLOAK=\"1\" \
--set applicationConfig.APPSMITH_ENABLE_EMBEDDED_DB=\"0\" \
--version $HELMCHART_VERSION --version $HELMCHART_VERSION