0
votes

I'm trying to deploy a simple single endpoint quarkus app to Google Cloud -> App Engine flex environment. I managed to deploy an uber-jar to standard environment, according to documentation

But I'm struggling to deploy with flex environment, as my understating, from the same documentation link as above, is that GCP will create a docker container based on the Dockerfile; In the end, my intention is to deploy a native image to GCP App Engine.

I followed the steps in the link above:

  1. Copy the JVM Dockerfile to the root directory of your project: cp src/main/docker/Dockerfile.jvm Dockerfile

  2. Build your application using mvn clean package

  3. src/main/appengine/app.yaml has the following:

     runtime: custom
     env: flex
    
  4. gcloud app deploy

The gcloud log returns the same error, both for native and normal docker file, respectively:

starting build "502dd964-0abf-470e-a4c1-44c89a67a96e" FETCHSOURCE Fetching storage object: gs://staging.os-xxxx-quarkus.appspot.com/eu.gcr.io/os-xxxx-quarkus/appengine/default.20210322t183731:latest#1616431057582767 Copying gs://staging.os-xxxx-quarkus.appspot.com/eu.gcr.io/os-xxxx-quarkus/appengine/default.20210322t183731:latest#1616431057582767... / [0 files][ 0.0 B/ 230.0 B]
/ [1 files][ 230.0 B/ 230.0 B]
Operation completed over 1 objects/230.0 B.
BUILD Already have image (with digest): gcr.io/cloud-builders/docker unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /Users: no such file or directory ERROR ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

For brevity, I will include the dockerfile, but it is the default generated without any changes.

    FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 

    ARG JAVA_PACKAGE=java-11-openjdk-headless
    ARG RUN_JAVA_VERSION=1.3.8
    ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
    # Install java and the run-java script
    # Also set up permissions for user `1001`
    RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
        && microdnf update \
        && microdnf clean all \
        && mkdir /deployments \
        && chown 1001 /deployments \
        && chmod "g+rwX" /deployments \
        && chown 1001:root /deployments \
        && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
        && chown 1001 /deployments/run-java.sh \
        && chmod 540 /deployments/run-java.sh \
        && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security

    # Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
    ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
    # We make four distinct layers so if there are application changes the library layers can be re-used
    COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
    COPY --chown=1001 target/quarkus-app/*.jar /deployments/
    COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
    COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/

    EXPOSE 8080
    USER 1001

    ENTRYPOINT [ "/deployments/run-java.sh" ]

Thank you for your time

1

1 Answers

0
votes

It seems i polluted the space with an embarrassing mistake; for Google Cloud App Engine ,flex environment, the app.yaml file should be placed in the root folder; it is also documented

Moreover, for some reason, the max_num_instances should be explicitly set to a value of max 8, according to account quota google documentation otherwise a EXAHUSTED_RESOURCE exception is thrown.