gcloud compute copy-file - no such file or directory - google-app-engine

for the following command
gcloud compute copy-files c:/localfile.js loggeduser#instance-name:/resources/js --zone us-central-1
pscp: unable to open /resources/js: no such file or directory
What should be the correct remote destination path to upload a file to vm on war relevent path /resources/js ?

You'll need to use the absolute path to the destination folder on the instance. For example
gcloud compute copy-files c:/localfile.js loggeduser#instance-name:/myAwesomeApp/src/main/webapp/resources/js --zone us-central-1
You can also use relative path to the loggeduser's home directory. Assuming the home directory is /home/loggeduser and the project is at the root directory, the command for the above example will be
gcloud compute copy-files c:/localfile.js loggeduser#instance-name:../../myAwesomeApp/src/main/webapp/resources/js --zone us-central-1
It's also important to make sure that 'loggeduser' has necessary permissions, otherwise you may receive 'permission denied' errors.

Related

Downloading many files at once in SSH from Google Cloud?

I just started working with google cloud on a project (using VM instances). I connected to SSH straight from the browser.
I will have thousands of .txt files in a few directories, and the "Download file" option only allows me to download 1 file at a time.
What's the easiest way to download all those files (or the whole directory) straight to my computer? Or, what method should I use/learn?
The easiest way will be to install the Cloud SDK on your local machine (see installation instructions here) and use the gcloud compute scp command to download your files or directories. For example:
gcloud compute scp --recurse vm-instance:~/remote-directory ~/local-directory
This will copy a remote directory, ~/remote-directory, from vm-instance to the ~/local-directory directory of your local host. You'll find more details about this command usage here.

Using appengine with arch and zsh unable to find goapp

I am new to appengine and have installed google-cloud-sdk from the AUR(arch user repository) and and the google-appengine-go extention at /opt/google-cloud-sdk
thanks to this I am able to run a dev server using
dev_appserver.py app.yaml
But when using goapp serve I found
goapp: command not found
After adding /opt/google-cloud-sdk/platform/google_appengine:$PATH to my $PATH variable in zshrc and running goapp serve i now get the error.
zsh: permission denied: goapp
if sudo goapp serve
sudo: goapp: command not found
Due to this I am unable to use the updated sdk to run tests using goapp test
Thank you in advance for your help.
I had the same problem and I think I figured out how it usually works.
You download the google cloud sdk (https://cloud.google.com/sdk/downloads)
After downloading and unzipping to the folder where you want to use it you have to executet the ./google-cloud-sdk/install.sh.
Appengine is not part of the download.
It can be chosen with that install.sh script.
it will download items like appengine.
Afterwards you have a folder called
platform/google_appengine
as you mentioned yourself.
You might have to change execution permissions like
chmod 755 platform/google_appengine/go*
Add folder platform/google_appengine to the PATH if not done already.
The command "which" will not show non-executable binaries.
If you did not change permissions it will not show the path, even being within the PATH variable.

Google AppEngine flex overwriting public folder permissions on deploy

I'm deploying a PHP app on the AppEngine Flexible environment. I have a command in my post-deploy-cmd scripts in my composer.json file to set permissions for the public/app folder (chmod -R 755 public\/app). However, when I deploy my app, the entire public folder's permissions get overwritten with 550.
I can see in the logs that the following command runs right after my deployment commands - + chmod -R 550 /app/public
How can I run my command after that or stop that command from running at all? Any workarounds?

Change gcloud remote user directory

How do I change the home directory to which gcloud copies files. I'm using the following command to copy a file from a local Windows account to Ubuntu which is hosted in a Google Compute Engine instance.
gcloud compute copy-files readme.md compute-engine-instance:readme.md
For some crazy reason the readme file will end up in a remote home directory with the same name as my local user account. I would like to specify which home directory on the compute engine to copy that file to.
gcloud compute copy-files and other SSH-related commands default to using the name of the local user as the username on the remote host (note that this is very similar to the behavior of plain ssh).
Try gcloud compute copy-files readme.md otheruser#compute-engine-instance: instead.
As you can see in gcloud compute copy-files --help, the command has the following specification:
gcloud compute copy-files [[USER#]INSTANCE:]SRC [[[USER#]INSTANCE:]SRC ...]
[[USER#]INSTANCE:]DEST [--dry-run] [--plain]
[--ssh-key-file SSH_KEY_FILE] [--zone ZONE] [GLOBAL-FLAG ...]
You can specify either a user, or a full path to do what you want.
gcloud compute copy-files readme.md user#compute-engine-instance:readme.md
or
gcloud compute copy-files readme.md compute-engine-instance:/home/user/readme.md
The destination can also be a directory. So these would work as well.
gcloud compute copy-files readme.md user#compute-engine-instance:~
or
gcloud compute copy-files readme.md compute-engine-instance:/home/user

ANDROID_HOME environment variable not set error

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.) (WARNING: The server did not provide any stacktrace information)
I have already set my ANDROID_HOME directory to sdk path .
echo $ANDROID_HOME=/Users/xyz/Library/Android/sdk
i still get this error by appium server.Using testNG framework..Running my first app
You need to export tools and platform-tools to access adb command.
If you using mac open then terminal and If you are in windows open .bash_profile
and execute as follows
export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
It looks like it can't find adb from your defined paths. Check if you've added the android platform-tools folder to the $PATH variable. It's the one that contains adb
In your .bash_profile, try adding this line:
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
In the above line, I added both the tools and platform-tools folder in the PATH variable.

Resources