Skip to content

Add GCP appengine support#207

Merged
theimowski merged 3 commits intoSAFE-Stack:masterfrom
mastoj:appengine_support
Jan 15, 2019
Merged

Add GCP appengine support#207
theimowski merged 3 commits intoSAFE-Stack:masterfrom
mastoj:appengine_support

Conversation

@mastoj
Copy link
Copy Markdown
Contributor

@mastoj mastoj commented Dec 28, 2018

Add support for google cloud appengine.

  • Add gcp-appengine deploy option
  • Add support to specify port with environment variables for suave, giraffe and saturn
  • Add basic app.yaml that is used for deploy to GCP appengine
  • Modify template.json to include Dockerfile and app.yaml for gcp-appengine deploy type
  • Add link to Google Cloud Appengine in readme
  • Add deploy target to build script

To really test you need a gcp project and gcloud installed. For now the same Dockerfile as for docker deploy is used, it might make sense to change to a dedicated one for gcp later for easier integration with other gcp services.

To do a test deploy run the following two commands:

dotnet new SAFE --deploy gcp-appengine
fake build --target deploy

Deploy of appengine flex apps is not super fast, but as long as there are no errors it should work.

@isaacabraham
Copy link
Copy Markdown
Member

@mastoj this is fantastic - thank you very much! Adding a new deployment option for another cloud platform will be an excellent addition. There's probably a bit of testing needed for this but I think it might well be possible to get this in for v1.

There's also the sibling repository which contains the docs for this - something that would need doing for this would be to also document the new option in the template and how it impacts the FAKE script etc.. I'm happy to help you out with some pointers if needed - just let me know.

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 1, 2019

@isaacabraham first draft of the documentation is done for appengine. I keep appengine and GKE separate, I guess there will be some conflicts between the branches, but I can resolve and rebase in the GKE branch to make it look pretty :).

@theimowski
Copy link
Copy Markdown
Member

theimowski commented Jan 2, 2019

thanks @mastoj this is really great. Let me take some time to review and try this out (I have no previous Google Cloud experience)

I'll focus on GCP appengine for now and leave kubernetes for later if that works for you

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 2, 2019 via email

@theimowski
Copy link
Copy Markdown
Member

I started playing with this, and it's really awesome!
I managed to deploy basic template to Google Cloud quite easily: https://safe-template-test.appspot.com/

I added a couple comments here and in the docs PR

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 4, 2019 via email

@theimowski
Copy link
Copy Markdown
Member

Docs LGTM now. Can you answer questions in this PR here?

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 8, 2019 via email

@theimowski
Copy link
Copy Markdown
Member

Just to be clear - I mean addressing the questions/comments I posted for this PR regarding "Docker" FAKE target, port 8080 etc.

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 9, 2019

@theimowski I'm a little bit confused. What questions/comments do you mean? Do you have a review not submitted? I can't see any comments/questions in this PR that I haven't addressed.

Comment thread Content/build.fsx Outdated
Comment thread Content/build.fsx
//#if (deploy == "docker")
//#if (deploy == "docker" || deploy == "gcp-appengine")
==> "Bundle"
==> "Docker"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we including Docker target only because one can run it separately from the Deploy chain?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for two reasons.

  1. So you can test the container locally
  2. You might want to create a more advanced setup where you build and publish the container image separately from the deploy.

Comment thread Content/app.yaml
Comment thread Content/app.yaml Outdated
@theimowski
Copy link
Copy Markdown
Member

Ha correct! Sorry it was dumb me not knowing how this GH feature works :) They should be visible now

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 9, 2019

@theimowski, haha, now you know :). Questions answered.

@theimowski
Copy link
Copy Markdown
Member

Let's just change env var SERVER_PROXY_PORT to SERVER_PORT - the "PROXY" might be misleading here. @isaacabraham want to review? Otherwise this is ready to be merged, docs are OK

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 10, 2019

@theimowski I used the SERVER_PROXY_PORT since that was already in use and nothing I added. Do you still want me to go over and change it to SERVER_PORT everywhere, or was it a good reason to why SERVER_PROXY_PORT was used in the first place?

@theimowski
Copy link
Copy Markdown
Member

Right, I forgot about SERVER_PROXY_PORT - but it's something different.

Please change the new variables to SERVER_PORT and leave old SERVER_PROXY_PORT as we're introducing a new concept here and that's actually an important difference between those two in development mode, you can read more on that here

Also since this is running in a docker container, I'm thinking whether there's a way to configure docker image to stick with exposing 8085, and then do some kind of port translation in Google Cloud configuration? The advantage would be getting rid of the additional environment variable.

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 11, 2019

I search for a way to do exactly that, but as stated here, https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#listening_to_port_8080, it says that it is port 8080 the container should listen to. I haven't figured out a way around that.

Changed it to SERVER_PORT.

@isaacabraham
Copy link
Copy Markdown
Member

@theimowski no, that's fine with me - I think it was more the use of the word "suave" was misleading - firstly it could (and most likely would) be Saturn or Giraffe, but secondly the old name didn't explain what it was doing. SERVER_PORT is fine as well IMHO.

Can you also check that the docs elsewhere on the docs site e.g. https://safe-stack.github.io/docs/faq-build/ don't need any updating? Ta!

@mastoj
Copy link
Copy Markdown
Contributor Author

mastoj commented Jan 13, 2019

@isaacabraham on that page you can read:

Both the Azure and Docker configuration options will do this automatically.

Maybe it could be changed to:

All deployments options do this automatically.

and also link https://safe-stack.github.io/docs/template-overview/#deploy instead which should have all deploy options available.

@theimowski theimowski merged commit ef63849 into SAFE-Stack:master Jan 15, 2019
@theimowski
Copy link
Copy Markdown
Member

Many thanks @mastoj for this! I'll release it in v0.43, afterwards we can have a closer look at the GKE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants