Context
I am building up on the following two discussions:
- Deploy to Azure Static Web Apps - #14 by talk2MeGooseman by @talk2MeGooseman
- Deploying to Microsoft Azure by @tomdickson
Goal
I want to deploy my redwood app similar to the serverless deployment for AWS to the matching services on Azure. This would be Lambda → Azure function app and S3/Cloudfront → Azure static web app
What did I manage to do
I set up an example repo here: GitHub - tilmann/rw-deploy-to-azure
It deploys the frontend to the static web app : https://yellow-meadow-0ef970b03.2.azurestaticapps.net
And the backend via the azure cli to https://sls-weur-dev-simpletest.azurewebsites.net/api/
There you can find 3 endpoints:
- For testing: https://sls-weur-dev-simpletest.azurewebsites.net/api/goodbye?name=test
(code: rw-deploy-to-azure/goodbye.ts at main · tilmann/rw-deploy-to-azure · GitHub) - Showing that yoga works https://sls-weur-dev-simpletest.azurewebsites.net/api/yoga
(code: rw-deploy-to-azure/yoga.ts at main · tilmann/rw-deploy-to-azure · GitHub) - The actual graphql endpoint: https://sls-weur-dev-simpletest.azurewebsites.net/api/graphql
(code: rw-deploy-to-azure/api/src/functions/wrapTest at main · tilmann/rw-deploy-to-azure · GitHub)
You can find the files that are deployed in directory api/deployment.
What is the idea and what is missing
My idea was to write a wrapper function that takes the request that is send to /api/graphql
and convert it to a Lambda structure. Currently this lambda structure is used inside redwood (redwood/graphql.ts at 97c36e1de6ed3579056aedaf6c0076fdff550c4a · redwoodjs/redwood · GitHub).
How to deploy
This is done in a manual way in the moment:
- To build it I am running
yarn redwood deploy serverless --pack-only
to get the packaged code. - Then I copy the
wrapTest.zip
fromapi/dist/zipballs
and extract it into the folderdeployment
. - There I overwrite the content in
api/deployment/graphql
with the extract fromwrapTest
. - The I zip in
deployment
the foldersyoga, goodbye and graphql
and deploy the zipped fileArchive.zip
.
Conclusion
I made good progress but it seems like in the end the packaging of the request is not working. Therefore the error message that can be seen here: https://yellow-meadow-0ef970b03.2.azurestaticapps.net/
I have the feeling it is not a lot missing to get this running. The example yoga functions shows that it should work like charm.
What would be next steps
It would be super helpful if someone who has the knowledge to build a prototype version of redwood that can run on azure based on the functions mentioned above or if someone could fix my wrapTest function so it would work with the existing graphql structure. Then we could solve it via the build.
I hope someone can build up on this and together we can figure this out. I am happy to provide more information if anything is missing or invest more time to try out ideas.