-
Notifications
You must be signed in to change notification settings - Fork 21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nits regarding static linking :)
Co-authored-by: Fabian Fett <fabianfett@apple.com>
@fabianfett Thanks for the review. Addressed all the issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PatrickHeneise thanks for this, it's great! I'm doing a full run through at the moment and have never used GCP before so make a great guinea pig! I've added some small tweaks to make it easier to follow but am currently stuck. I can successfully compile the app and have pushed the container but then get the following error
Starting Step #3
Step #3: Already have image (with digest): gcr.io/cloud-builders/gcloud
Step #3: ERROR: (gcloud.run.deploy) PERMISSION_DENIED: Permission 'run.services.get' denied on resource 'namespaces/banded-pager-334823/services/swift-service' (or resource may not exist).
Finished Step #3
ERROR
ERROR: build step 3 "gcr.io/cloud-builders/gcloud" failed: step exited with non-zero status: 1
Any idea?
Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>
Wow, thanks a lot for the review! Sorry you got stuck, I tried this several times and it worked :/ I'll check about the error. As for , etc. I hardcoded the values for simplicity; I'll replace those with build substitution variables, that'll be easier. |
@0xTim I forgot the Cloud Build settings. Added a screenshot and description in the article. Go to "Settings" in the Cloud Build overview, then Enable the permissions for "Cloud Run". This should give Cloud Build the necessary permission to deploy your service. |
7a8d8ca
to
cd26734
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great that fixed it! Couple of last things then good to go
Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>
Vapor takes about 25 minutes on the standard/small build machines, which are | ||
fairly slow. "Jordane" from the Vapor Discord community | ||
[recommends using `machineType: E2_HIGHCPU_8`](https://discord.com/channels/431917998102675485/447893851374616576/915819735738888222) | ||
in the `cloudbuild.yaml` to speed up deployments: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we know if the slowness is about dependency resolution or build / CPU? Is there a way to configure dependencies cache location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was on my todo list to figure out. Caching is definitely supported on both GCP and AWS, should be possible with a multi-stage build to separate the dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The majority of the time is build time. Both the default build machine and high CPU build machine were about a couple of minutes for resolution (high CPU was about 30s faster) but actual build time for default was 20 mins and about 5 mins on the high CPU machine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
Closes #55
Tested this with a simple Hummingbird server (https://github.com/zentered/swift-hummingbird-demo), everything works as described. Screenshots attached as well.