Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I exclude a file from deploy in gcloud?

I have built a Node.js app and what I do to deploy is cd into my project's directory and run gcloud preview app deploy. This works, but in the files I also have a JSON file which acts like the database for my application, which I do not want updated on the site when I deploy.

I cannot seem to find any way of doing this.

Any idea?

like image 683
iuliu.net Avatar asked Apr 20 '16 18:04

iuliu.net


People also ask

How do I get rid of gcloud app deploy?

Warning: You cannot undo this operation. If you want to delete a deployment, but keep all the underlying resources, you must use the Google Cloud CLI or the API. In the console, open the Deployments page.

How do I upload files to gcloud?

In the Google Cloud console, go to the Cloud Storage Browser page. In the list of buckets, click on the name of the bucket that you want to upload an object to. In the Objects tab for the bucket, either: Drag and drop the desired files from your desktop or file manager to the main pane in the console.

How does gcloud app deploy work?

App Engine provides the gcloud app deploy command, which builds an image with your source code and deploys that image on App Engine. You can use the cloud-sdk image as a build step in your config file to invoke gcloud commands within the image.


2 Answers

There is skip_files directive in your app.yaml to exclude paths or files you do not want deployed.

But If you are working on a node.js project you would have to use .gcloudignore file which will specify which directories to exclude.

This .gcloudignore would prevent the upload of the node_modules/ directory and any files ending in ~:

  node_modules/
  *~

Reference to documentation:
1. https://cloud.google.com/sdk/gcloud/reference/topic/gcloudignore
2. https://cloud.google.com/appengine/docs/standard/nodejs/config/appref (search 'skip_files')

like image 92
Chromonav Avatar answered Nov 03 '22 08:11

Chromonav


I believe you will want to use the skip_files directive in your app.yaml to exclude paths or files you do not want deployed.

Something like:

skip_files:
  - ^your_data_dir/.*\.json?
like image 41
Michael McCoy Avatar answered Nov 03 '22 08:11

Michael McCoy