This is a project for Python development with CDK. And you must have meet requirement before to start below.
First of all we will install Yarn to generate our frontend static resource, you can reference this guide to have more detail informaiton.
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarnCopy some modified the source frontend codes:
mkdir frontend \
&& cp -r ./spring-petclinic-graphql/frontend/* frontend/ \
&& cp createGraphQLClient.tsx ./frontend/src/ \
&& cp Footer.tsx ./frontend/src/app/ui/Layout/ \
&& cp AWS-AppSync.svg ./frontend/public/images/ \
&& cp webpack.config.js ./frontend/ \
&& cp AddPetPage.tsx ./frontend/src/app/domain/pet/AddPetPage \
&& cp UpdatePetPage.tsx ./frontend/src/app/domain/pet/UpdatePetPage \
&& cp DateInput.tsx ./frontend/src/app/components/form/FormElements/elementsNext we need create the Spring Petclinic Frontend static resource:
cd frontend && yarn install && yarn distWe also manually create a virtualenv on MacOS and Linux in this project root folder:
cd ../backend && python3 -m venv .envAfter the init process completes and the virtualenv is created, you can use the following step to activate your virtualenv.
source .env/bin/activateOnce the virtualenv is activated, you can install the required dependencies.
pip install -r requirements.txtAt this point you can now synthesize the CloudFormation template for this code.
cdk synthAfter review the CloudFormation template you can upload all the Lambda Function source codes, static files and deploy all the Infracture codes including GgraphQL definitions using:
cdk deployWhen the command run completed you can open the new deploy Web static page to login in the GrapshQL version Pet Clinic Application.
Finally you can clean up the whole stack by using:
cdk destroy