We use S3 to store files in the cloud for easy and secure access. We use some Vapor packages to integrate Vapor application with S3. The implementation is different for the Vapor versions.
Vapor 4 Integration
Package.swift
Add the S3 package to the dependencies and target.
dependencies: [
.package(name: "AWSSDKSwift", url: "https://github.com/swift-aws/aws-sdk-swift.git", from: "4.7.0"),
],
targets: [
.target(name: "App", dependencies: [
.product(name: "S3", package: "AWSSDKSwift"),
]),
]
Read More...
We have created a new model in Vapor with id as UUID and other fields.
// Property Wrapper
@ID(key: .id)
var id: UUID?
Now we got a requirment to add an autoincrement field which can be used to identify the object like model_number. Since the default id field is UUID we cannot use the exisitng id for this purpose. If we are creating a new model with this scenario, we could have used the id as an autoincrement identifier:
// Migration
.field("id", .int, .identifier(auto: true))
Read More...
SendGrid is a customer communication platform for transactional and marketing email. SendGrid provides a cloud-based service that assists businesses with email delivery. How can we integrate Sendgrid with our Web application (Vapor) to send emails?
Read More...
I was working on a software product with backend server implemented using Swift and Vapor. We were using Vapor 3 and wanted to migrate it to Vapor 4, since Vapor 4 released on Apr 2020. We followed the upgrading link from Vapor docs to start the upgrading process. In this blog post I will give some additional information about the issues we had faced while upgrading to Vapor 4.
Read More...
Introduction
In my previous blog post, I have shown you how to setup a Kubernetes cluster on AWS EC2 instances. I tried deploying a sample application with a public docker image from DockerHub and it is working fine. But when I tried to deploy an application with an image from the AWS ECR, we started getting permission errors. Even though I have given all the necessary permissions for the instance profile role, the pod couldn’t fetch the image from ECR and showing ImagePullBackOff error.
Then we found this documentation from Kubernetes where they are saying “Verify kubelet is running with –cloud-provider=aws” to make it work.
Read More...