Deploy Ruby on Rails app to App Engine using Cloud Build












0















I'm trying to automate the deployment of a Ruby on Rails app to App Engine using Cloud Build.



My app.yaml looked like this,



runtime: ruby
env: flex
entrypoint: bundle exec rails server


But I'm getting this error,




Step #1: ERROR: (gcloud.app.deploy) There is a cloudbuild.yaml in the current directory, and the runtime field in /workspace/app.yaml is currently set to [runtime: ruby]. To use your cloudbuild.yaml to build a custom runtime, set the runtime field to [runtime: custom]. To continue using the [ruby] runtime, please remove the cloudbuild.yaml from this directory.




Then I tried to change the runtime to custom and add a Dockerfile as custom runtime needs a Dockerfile.



But now I'm getting an error saying,




ERROR: (gcloud.app.deploy) A custom runtime must have exactly one of [Dockerfile] and [cloudbuild.yaml] in the source directory; [/home/milindu/Projects/ElePath-Ruby] contains both




Then I removed Dockerfile also. But now getting into this weird situation. You can see the 'Step #1:' is growing into several like stuck in a recursion.



Error console










share|improve this question



























    0















    I'm trying to automate the deployment of a Ruby on Rails app to App Engine using Cloud Build.



    My app.yaml looked like this,



    runtime: ruby
    env: flex
    entrypoint: bundle exec rails server


    But I'm getting this error,




    Step #1: ERROR: (gcloud.app.deploy) There is a cloudbuild.yaml in the current directory, and the runtime field in /workspace/app.yaml is currently set to [runtime: ruby]. To use your cloudbuild.yaml to build a custom runtime, set the runtime field to [runtime: custom]. To continue using the [ruby] runtime, please remove the cloudbuild.yaml from this directory.




    Then I tried to change the runtime to custom and add a Dockerfile as custom runtime needs a Dockerfile.



    But now I'm getting an error saying,




    ERROR: (gcloud.app.deploy) A custom runtime must have exactly one of [Dockerfile] and [cloudbuild.yaml] in the source directory; [/home/milindu/Projects/ElePath-Ruby] contains both




    Then I removed Dockerfile also. But now getting into this weird situation. You can see the 'Step #1:' is growing into several like stuck in a recursion.



    Error console










    share|improve this question

























      0












      0








      0








      I'm trying to automate the deployment of a Ruby on Rails app to App Engine using Cloud Build.



      My app.yaml looked like this,



      runtime: ruby
      env: flex
      entrypoint: bundle exec rails server


      But I'm getting this error,




      Step #1: ERROR: (gcloud.app.deploy) There is a cloudbuild.yaml in the current directory, and the runtime field in /workspace/app.yaml is currently set to [runtime: ruby]. To use your cloudbuild.yaml to build a custom runtime, set the runtime field to [runtime: custom]. To continue using the [ruby] runtime, please remove the cloudbuild.yaml from this directory.




      Then I tried to change the runtime to custom and add a Dockerfile as custom runtime needs a Dockerfile.



      But now I'm getting an error saying,




      ERROR: (gcloud.app.deploy) A custom runtime must have exactly one of [Dockerfile] and [cloudbuild.yaml] in the source directory; [/home/milindu/Projects/ElePath-Ruby] contains both




      Then I removed Dockerfile also. But now getting into this weird situation. You can see the 'Step #1:' is growing into several like stuck in a recursion.



      Error console










      share|improve this question














      I'm trying to automate the deployment of a Ruby on Rails app to App Engine using Cloud Build.



      My app.yaml looked like this,



      runtime: ruby
      env: flex
      entrypoint: bundle exec rails server


      But I'm getting this error,




      Step #1: ERROR: (gcloud.app.deploy) There is a cloudbuild.yaml in the current directory, and the runtime field in /workspace/app.yaml is currently set to [runtime: ruby]. To use your cloudbuild.yaml to build a custom runtime, set the runtime field to [runtime: custom]. To continue using the [ruby] runtime, please remove the cloudbuild.yaml from this directory.




      Then I tried to change the runtime to custom and add a Dockerfile as custom runtime needs a Dockerfile.



      But now I'm getting an error saying,




      ERROR: (gcloud.app.deploy) A custom runtime must have exactly one of [Dockerfile] and [cloudbuild.yaml] in the source directory; [/home/milindu/Projects/ElePath-Ruby] contains both




      Then I removed Dockerfile also. But now getting into this weird situation. You can see the 'Step #1:' is growing into several like stuck in a recursion.



      Error console







      ruby-on-rails google-app-engine google-cloud-platform google-cloud-build






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 14:03









      Milindu Sanoj KumarageMilindu Sanoj Kumarage

      1,47522039




      1,47522039
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Cloudbuild.yaml should work with App Engine Flexible without the need to use a custom runtime. As detailed in the first error message you received, you cannot have an app.yaml and the cloudbuild.yaml in the same directory if you are deploying in a non-custom runtime, to remedy the situation, follow these steps:




          1. Move your app.yaml and other ruby files into a subdirectory (use your
            original app.yaml, no need to use custom runtime)


          2. Under your cloudbuild.yaml steps, modify the argument for app deploy
            by adding a third one specifying your app.yaml's path.



          Below is an example:



          ==================FROM:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy']
          timeout: '1600s'
          ===================TO:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy', '[SUBDIRECTORY/app.yaml]']
          timeout: '1600s'





          share|improve this answer
























          • Thanks @David, I tried this and it worked. Now the problem is, this is an open source project and I can't move all the codes into a subdirectory just for Cloud Build. Is there a workaround you can think of? Is there a way to keep just app.yaml in a subdir and do it or any other trick?

            – Milindu Sanoj Kumarage
            Nov 24 '18 at 6:41











          • I do not have a workaround for you at this time. However, this might be possible by using custom run times and a Docker file but I understand this might not be ideal. If you believe this is something critical for you, you can create a feature request on Issue Tracker by giving some context and providing your use case.

            – David
            Nov 28 '18 at 19:31











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413816%2fdeploy-ruby-on-rails-app-to-app-engine-using-cloud-build%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Cloudbuild.yaml should work with App Engine Flexible without the need to use a custom runtime. As detailed in the first error message you received, you cannot have an app.yaml and the cloudbuild.yaml in the same directory if you are deploying in a non-custom runtime, to remedy the situation, follow these steps:




          1. Move your app.yaml and other ruby files into a subdirectory (use your
            original app.yaml, no need to use custom runtime)


          2. Under your cloudbuild.yaml steps, modify the argument for app deploy
            by adding a third one specifying your app.yaml's path.



          Below is an example:



          ==================FROM:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy']
          timeout: '1600s'
          ===================TO:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy', '[SUBDIRECTORY/app.yaml]']
          timeout: '1600s'





          share|improve this answer
























          • Thanks @David, I tried this and it worked. Now the problem is, this is an open source project and I can't move all the codes into a subdirectory just for Cloud Build. Is there a workaround you can think of? Is there a way to keep just app.yaml in a subdir and do it or any other trick?

            – Milindu Sanoj Kumarage
            Nov 24 '18 at 6:41











          • I do not have a workaround for you at this time. However, this might be possible by using custom run times and a Docker file but I understand this might not be ideal. If you believe this is something critical for you, you can create a feature request on Issue Tracker by giving some context and providing your use case.

            – David
            Nov 28 '18 at 19:31
















          1














          Cloudbuild.yaml should work with App Engine Flexible without the need to use a custom runtime. As detailed in the first error message you received, you cannot have an app.yaml and the cloudbuild.yaml in the same directory if you are deploying in a non-custom runtime, to remedy the situation, follow these steps:




          1. Move your app.yaml and other ruby files into a subdirectory (use your
            original app.yaml, no need to use custom runtime)


          2. Under your cloudbuild.yaml steps, modify the argument for app deploy
            by adding a third one specifying your app.yaml's path.



          Below is an example:



          ==================FROM:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy']
          timeout: '1600s'
          ===================TO:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy', '[SUBDIRECTORY/app.yaml]']
          timeout: '1600s'





          share|improve this answer
























          • Thanks @David, I tried this and it worked. Now the problem is, this is an open source project and I can't move all the codes into a subdirectory just for Cloud Build. Is there a workaround you can think of? Is there a way to keep just app.yaml in a subdir and do it or any other trick?

            – Milindu Sanoj Kumarage
            Nov 24 '18 at 6:41











          • I do not have a workaround for you at this time. However, this might be possible by using custom run times and a Docker file but I understand this might not be ideal. If you believe this is something critical for you, you can create a feature request on Issue Tracker by giving some context and providing your use case.

            – David
            Nov 28 '18 at 19:31














          1












          1








          1







          Cloudbuild.yaml should work with App Engine Flexible without the need to use a custom runtime. As detailed in the first error message you received, you cannot have an app.yaml and the cloudbuild.yaml in the same directory if you are deploying in a non-custom runtime, to remedy the situation, follow these steps:




          1. Move your app.yaml and other ruby files into a subdirectory (use your
            original app.yaml, no need to use custom runtime)


          2. Under your cloudbuild.yaml steps, modify the argument for app deploy
            by adding a third one specifying your app.yaml's path.



          Below is an example:



          ==================FROM:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy']
          timeout: '1600s'
          ===================TO:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy', '[SUBDIRECTORY/app.yaml]']
          timeout: '1600s'





          share|improve this answer













          Cloudbuild.yaml should work with App Engine Flexible without the need to use a custom runtime. As detailed in the first error message you received, you cannot have an app.yaml and the cloudbuild.yaml in the same directory if you are deploying in a non-custom runtime, to remedy the situation, follow these steps:




          1. Move your app.yaml and other ruby files into a subdirectory (use your
            original app.yaml, no need to use custom runtime)


          2. Under your cloudbuild.yaml steps, modify the argument for app deploy
            by adding a third one specifying your app.yaml's path.



          Below is an example:



          ==================FROM:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy']
          timeout: '1600s'
          ===================TO:

          steps:
          - name: 'gcr.io/cloud-builders/gcloud'
          args: ['app', 'deploy', '[SUBDIRECTORY/app.yaml]']
          timeout: '1600s'






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 16:07









          DavidDavid

          160112




          160112













          • Thanks @David, I tried this and it worked. Now the problem is, this is an open source project and I can't move all the codes into a subdirectory just for Cloud Build. Is there a workaround you can think of? Is there a way to keep just app.yaml in a subdir and do it or any other trick?

            – Milindu Sanoj Kumarage
            Nov 24 '18 at 6:41











          • I do not have a workaround for you at this time. However, this might be possible by using custom run times and a Docker file but I understand this might not be ideal. If you believe this is something critical for you, you can create a feature request on Issue Tracker by giving some context and providing your use case.

            – David
            Nov 28 '18 at 19:31



















          • Thanks @David, I tried this and it worked. Now the problem is, this is an open source project and I can't move all the codes into a subdirectory just for Cloud Build. Is there a workaround you can think of? Is there a way to keep just app.yaml in a subdir and do it or any other trick?

            – Milindu Sanoj Kumarage
            Nov 24 '18 at 6:41











          • I do not have a workaround for you at this time. However, this might be possible by using custom run times and a Docker file but I understand this might not be ideal. If you believe this is something critical for you, you can create a feature request on Issue Tracker by giving some context and providing your use case.

            – David
            Nov 28 '18 at 19:31

















          Thanks @David, I tried this and it worked. Now the problem is, this is an open source project and I can't move all the codes into a subdirectory just for Cloud Build. Is there a workaround you can think of? Is there a way to keep just app.yaml in a subdir and do it or any other trick?

          – Milindu Sanoj Kumarage
          Nov 24 '18 at 6:41





          Thanks @David, I tried this and it worked. Now the problem is, this is an open source project and I can't move all the codes into a subdirectory just for Cloud Build. Is there a workaround you can think of? Is there a way to keep just app.yaml in a subdir and do it or any other trick?

          – Milindu Sanoj Kumarage
          Nov 24 '18 at 6:41













          I do not have a workaround for you at this time. However, this might be possible by using custom run times and a Docker file but I understand this might not be ideal. If you believe this is something critical for you, you can create a feature request on Issue Tracker by giving some context and providing your use case.

          – David
          Nov 28 '18 at 19:31





          I do not have a workaround for you at this time. However, this might be possible by using custom run times and a Docker file but I understand this might not be ideal. If you believe this is something critical for you, you can create a feature request on Issue Tracker by giving some context and providing your use case.

          – David
          Nov 28 '18 at 19:31




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413816%2fdeploy-ruby-on-rails-app-to-app-engine-using-cloud-build%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          Npm cannot find a required file even through it is in the searched directory

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith