vapor-community / vapor-aws-lambda-runtime

Run your Vapor api server on AWS Lambda using the official Swift Server runtime.
Apache License 2.0
104 stars 10 forks source link

Help with how to use it - Possibly a bit more info in the Readme #19

Closed skela closed 1 year ago

skela commented 1 year ago

Experimenting with this, and setting up a vapor service using pulumi scripts in aws. In terms of what's needed in the swift vapor code, is it enough to just do this here:

app.servers.use(.lambda)

Or is there anything else I would need to do per endpoint, to get this working?

0xTim commented 1 year ago

The README or DocC stuff could definitely do with being better but if you want a working example, check out https://github.com/vapor/release-bot

skela commented 1 year ago

Ill give it a look, thx so much. This stuff seems super promising 👍🏻

skela commented 1 year ago

Thanks yes, the release-bot stuff was super helpful. Before I saw that I was trying to upload a docker image, and have the aws setup to use that (using pulumi to set the API up instead of your yaml).

Have since copied yer scripts to package up a zip containing a bootstrap like yer doing and uploading that to an s3 bucket. (Although i was having some issues with the unzipped contents being a bit too large - fixed that by removing the file lib_InternalSwiftScan.so from the zip file, hopefully its not important).

I've got the same number of dependancies as your release-bot project, only I'm running Swift 5.7, so you might encounter the same issue when you upgrade.

Now I just need to figure out how to set up the API gateway so it works with this stuff.

0xTim commented 1 year ago

If you compile it with swift build -c release --static-swift-stdlib then you should be able to just copy the executable and nothing else.

Will close this issue, feel free to reopen it if you want!