ci: run fat container docker inside perf tests and update setup-perf-test workflow to use localhost for accessing dev environment (#20280)
This commit is contained in:
parent
d51b12719c
commit
7c1ddfb17c
67
.github/workflows/perf-test.yml
vendored
67
.github/workflows/perf-test.yml
vendored
|
|
@ -143,34 +143,40 @@ jobs:
|
|||
name: build
|
||||
path: app/server/dist
|
||||
|
||||
# Start server
|
||||
- name: start server
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
working-directory: app/server
|
||||
env:
|
||||
APPSMITH_MONGODB_URI: "mongodb://localhost:27017/mobtools"
|
||||
APPSMITH_REDIS_URL: "redis://127.0.0.1:6379"
|
||||
APPSMITH_ENCRYPTION_PASSWORD: "password"
|
||||
APPSMITH_ENCRYPTION_SALT: "salt"
|
||||
APPSMITH_IS_SELF_HOSTED: false
|
||||
APPSMITH_CLOUD_SERVICES_BASE_URL: https://release-cs.appsmith.com
|
||||
APPSMITH_CLOUD_SERVICES_USERNAME: ""
|
||||
APPSMITH_CLOUD_SERVICES_PASSWORD: ""
|
||||
APPSMITH_GIT_ROOT: "./container-volumes/git-storage"
|
||||
APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }}
|
||||
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
|
||||
- name: Download the rts build artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: rts-dist
|
||||
path: app/rts/dist
|
||||
|
||||
- name: Un-tar the rts folder
|
||||
working-directory: "."
|
||||
run: |
|
||||
ls -l
|
||||
ls -l scripts/
|
||||
ls -l dist/
|
||||
# Run the server in the background and redirect logs to a log file
|
||||
./scripts/start-dev-server.sh &> server-logs.log &
|
||||
tar -xvf app/rts/dist/rts-dist.tar -C app/rts/
|
||||
echo "Cleaning up the tar files"
|
||||
rm app/rts/dist/rts-dist.tar
|
||||
|
||||
- name: Installing Yarn serve
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: |
|
||||
yarn global add serve
|
||||
echo "$(yarn global bin)" >> $GITHUB_PATH
|
||||
# We don't use Depot Docker builds because it's faster for local Docker images to be built locally.
|
||||
# It's slower and more expensive to build these Docker images on Depot and download it back to the CI node.
|
||||
- name: Build docker image
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
working-directory: "."
|
||||
run: |
|
||||
docker build -t cicontainer .
|
||||
|
||||
- name: Create folder
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
env:
|
||||
APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }}
|
||||
working-directory: "."
|
||||
run: |
|
||||
mkdir -p cicontainerlocal/stacks/configuration/
|
||||
|
||||
|
||||
- name: Load docker image
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
|
|
@ -183,7 +189,13 @@ jobs:
|
|||
docker run --name test-event-driver -d -p 2222:22 -p 5001:5001 -p 3306:3306 \
|
||||
-p 5432:5432 -p 28017:27017 -p 25:25 --privileged --pid=host --ipc=host --volume /:/host -v ~/git-server/keys:/git-server/keys \
|
||||
-v ~/git-server/repos:/git-server/repos appsmith/test-event-driver:latest
|
||||
|
||||
cd cicontainerlocal
|
||||
docker run -d --name appsmith -p 80:80 -p 9001:9001 \
|
||||
-v "$PWD/stacks:/appsmith-stacks" -e APPSMITH_LICENSE_KEY=$APPSMITH_LICENSE_KEY \
|
||||
-e APPSMITH_AUDITLOG_ENABLED=true \
|
||||
-e APPSMITH_CLOUD_SERVICES_BASE_URL=http://host.docker.internal:5001 \
|
||||
--add-host=host.docker.internal:host-gateway \
|
||||
cicontainer
|
||||
|
||||
# Start rts
|
||||
- name: Start RTS Server
|
||||
|
|
@ -244,17 +256,6 @@ jobs:
|
|||
shell: bash
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Exit if Server hasnt started
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: |
|
||||
if lsof -i :8080; then
|
||||
echo "Server Found"
|
||||
else
|
||||
echo "Server Not Started. Printing logs from server process"
|
||||
cat app/server/nohup.out
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Change test script permissions
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
working-directory: app/client/perf
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ echo "Checking if client and server have started"
|
|||
ps -ef |grep java 2>&1
|
||||
ps -ef |grep serve 2>&1
|
||||
|
||||
echo "status code: $status_code"
|
||||
|
||||
if [ "$status_code" -eq "502" ]; then
|
||||
echo "Unable to connect to server"
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -5,39 +5,21 @@
|
|||
|
||||
# Serve the react bundle on a specific port. Nginx will proxy to this port
|
||||
echo "Starting the setup the test framework"
|
||||
sudo echo "127.0.0.1 dev.appsmith.com" | sudo tee -a /etc/hosts
|
||||
sudo echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
|
||||
serve -s build -p 3000 &
|
||||
|
||||
# Substitute all the env variables in nginx
|
||||
vars_to_substitute=$(printf '\$%s,' $(env | grep -o "^APPSMITH_[A-Z0-9_]\+" | xargs))
|
||||
cat ./docker/templates/nginx-app.conf.template | sed -e "s|__APPSMITH_CLIENT_PROXY_PASS__|http://localhost:3000|g" | sed -e "s|__APPSMITH_SERVER_PROXY_PASS__|http://localhost:8080|g" | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf
|
||||
cat ./docker/templates/nginx-app.conf.template | sed -e "s|__APPSMITH_CLIENT_PROXY_PASS__|http://localhost:3000|g" | sed -e "s|__APPSMITH_SERVER_PROXY_PASS__|http://0.0.0.0|g" | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf
|
||||
cat ./docker/templates/nginx-root.conf.template | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx-root.conf
|
||||
|
||||
# Create the SSL files for Nginx. Required for service workers to work properly.
|
||||
touch ./docker/dev.appsmith.com.pem ./docker/dev.appsmith.com-key.pem
|
||||
echo "$APPSMITH_SSL_CERTIFICATE" > ./docker/dev.appsmith.com.pem
|
||||
echo "$APPSMITH_SSL_KEY" > ./docker/dev.appsmith.com-key.pem
|
||||
touch ./docker/localhost ./docker/localhost.pem
|
||||
echo "$APPSMITH_SSL_CERTIFICATE" > ./docker/localhost.pem
|
||||
echo "$APPSMITH_SSL_KEY" > ./docker/localhost.pem
|
||||
|
||||
# echo "Download & Start TED server"
|
||||
# sudo docker pull nginx:latest
|
||||
# sudo docker pull appsmith/test-event-driver:latest
|
||||
|
||||
# Setup UI environment from docker image for running UI tests and perf tests
|
||||
sudo docker run --network host --name wildcard-nginx -d -p 80:80 -p 443:443 \
|
||||
-v `pwd`/docker/nginx-root.conf:/etc/nginx/nginx.conf \
|
||||
-v `pwd`/docker/nginx.conf:/etc/nginx/conf.d/app.conf \
|
||||
-v `pwd`/docker/dev.appsmith.com.pem:/etc/certificate/dev.appsmith.com.pem \
|
||||
-v `pwd`/docker/dev.appsmith.com-key.pem:/etc/certificate/dev.appsmith.com-key.pem \
|
||||
nginx:latest
|
||||
# sudo mkdir -p git-server/keys
|
||||
# sudo mkdir -p git-server/repos
|
||||
|
||||
# sudo docker run --name TED -d -p 2222:22 -p 5001:5001 -p 3306:3306 \
|
||||
# -p 5432:5432 -p 28017:27017 -p 25:25 --privileged --pid=host --ipc=host --volume /:/host -v ~/git-server/keys:/git-server/keys \
|
||||
# -v ~/git-server/repos:/git-server/repos appsmith/test-event-driver:latest
|
||||
|
||||
# echo "Waiting for test event driver to start"
|
||||
# sleep 50
|
||||
sleep 10
|
||||
|
||||
echo "Checking if the containers have started"
|
||||
sudo docker ps -a
|
||||
|
|
@ -51,7 +33,7 @@ if sudo docker ps -a | grep -q Exited; then
|
|||
fi
|
||||
|
||||
echo "Checking if the server has started"
|
||||
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" https://dev.appsmith.com/api/v1/users)
|
||||
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost/api/v1/users)
|
||||
|
||||
retry_count=1
|
||||
|
||||
|
|
@ -59,13 +41,15 @@ while [ "$retry_count" -le "3" -a "$status_code" -eq "502" ]; do
|
|||
echo "Hit 502.Server not started retrying..."
|
||||
retry_count=$((1 + $retry_count))
|
||||
sleep 30
|
||||
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" https://dev.appsmith.com/api/v1/users)
|
||||
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost/api/v1/users)
|
||||
done
|
||||
|
||||
echo "Checking if client and server have started"
|
||||
ps -ef |grep java 2>&1
|
||||
ps -ef |grep serve 2>&1
|
||||
|
||||
echo "status code: $status_code"
|
||||
|
||||
if [ "$status_code" -eq "502" ]; then
|
||||
echo "Unable to connect to server"
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user