This is a sample project that showcases how to deploy a Clojure web application into Google App Engine.
For a Leiningen version of this project, see the lein
branch of this repository.
NOTE: See all the files in this repository for comments regarding the various fiddly bits (app.yaml
in particular).
You must have these command-line tools installed:
Additionally, before continuing, you must authorize Google Cloud SDK Tools.
These steps assume the project ID of your GCP project is foo-bar-123456
.
Replace the ID with your own project ID when running these commands.
There are other ways of specifying the project ID. See the gcloud CLI docs.
-
Create a new Google Cloud Platform project:
$ gcloud projects create foo-bar-123456
-
Create a new App Engine app:
$ gcloud app create --project=foo-bar-123456
In the prompt that appears, select the region where you want to deploy the app.
-
Create an uberjar:
$ clj -A:uberjar
-
Copy
app.yaml
into thetarget
directory:$ cp app.yaml target # This seems a bit inelegant, but I haven't figured out a better way. # # This is necessary because app.yaml and the deployable artifact need # to be in the same directory.
-
Deploy the application:
$ gcloud app deploy --project=foo-bar-123456 target
-
Open the app in your browser:
$ gcloud app browse --project=foo-bar-123456
The first request's gonna take a while.