How to Distribute a Vapor Project?

I am a Xcode developer. I know I can archive an app when it is built for macOS or iOS. Now I am trying Vapor. I created a Ubuntu Linux Server with VMWare Fusion and created a Vapor project in it. After testing, I will put all work in another Linux server, which is a VPS.

My problem is how I transfer the work from my local machine to the remote server? Any best practices?

For cross-platform distribution, the best practice is to use a Docker image. See Vapor doc for guidance.

As an alternative, you can build the project inside Docker (with the same distribution as your server) and then extract the products and its dependencies. For reference, SwiftAWSLambdaRuntime has a set of example scripts1 2 which can be easily adapted to any Swift server project.

2 Likes

I set up Docker too, and if I may add, I usually set up a simple CI/CD with Github Actions to build the images. Usually it takes a while to build a Docker image on a Mac since it requires virtualization, furthermore, it takes even more time on Apple Silicon Macs because it cannot use hardware-accelerated virtualization for building x86 images. In my case, Intel Macbook Pro with an i7 processor took about 6-8 minutes to complete a build for a production server, and it took about 25 mins to build the same project on M1 Max Macbook Pro. It takes about 8 mins on Github Actions too, but it is much less hassle since you can just let it run and do something else.

Terms of Service

Privacy Policy

Cookie Policy