Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ludoch/a6ce901eea5fed20095b662a08110aa2 to your computer and use it in GitHub Desktop.
Save ludoch/a6ce901eea5fed20095b662a08110aa2 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Generate a linux binary (could be c,c++,rust, Graalvm native, whatever executable that is listening to port 8080
# or the $PORT env variable)
# Let say it is called ./my_executable
# Prepare AppEngine Deployment with the compiled binary and simple app.yaml with entrypoint. We pick a GAE Java11 runtime,
# but it will execute the entrypoint program given in the entrypoint which can be any linux executable:
mkdir stage
cp ./my_executable stage
echo -e "runtime: java11\nentrypoint: ./my_executable" >stage/app.yaml
# Deploy the stage directory to an existing App Engine project:
gcloud app deploy --quiet --version 1 --project MY_GAE_PROJECT_ID stage/
# Access your application via curl https://MY_GAE_PROJECT_ID.appspot.com
# If your application needs MYSQL or POSTGRES, Enable it in your MY_GAE_PROJECT_ID project.
# See https://cloud.google.com/sql/docs/mysql/connect-app-engine
# App Engine will scale your application from 0 (when not in used) to many many clones, based on the requests.
# See https://cloud.google.com/appengine/docs/standard/java11/how-instances-are-managed
# If you want more customization via Docker, you can also use Google Cloud Run https://cloud.google.com/run/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment