Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 2.1 KB

File metadata and controls

68 lines (49 loc) · 2.1 KB

Welcome to Spring Petclinic GgraphQL Serverless CDK Python project!

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 yarn

Copy 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/elements

Next we need create the Spring Petclinic Frontend static resource:

cd frontend && yarn install && yarn dist

We also manually create a virtualenv on MacOS and Linux in this project root folder:

cd ../backend && python3 -m venv .env

After the init process completes and the virtualenv is created, you can use the following step to activate your virtualenv.

source .env/bin/activate

Once the virtualenv is activated, you can install the required dependencies.

pip install -r requirements.txt

At this point you can now synthesize the CloudFormation template for this code.

cdk synth

After 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 deploy

When 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