Cant find gcloud utility using MAMP - gcloud

After attempting to innitialize cluster/kube-up via php using the following code from my local virtual host:
$old_path = getcwd();
chdir('/Users/username/kubernetes');
$output = shell_exec('cluster/kube-up.sh');
chdir($old_path);
print_r("<pre>$output</pre>") ;
I received the following error:
Can't find gcloud in PATH. Do you wish to install the Google Cloud SDK? [Y/n]
I have gcloud available in my bash_profile. I am also running MAMP and included the path variable in /Applications/MAMP/Library/bin/envvars_* and envvars-std -
I am still getting this prompt. Any ideas?

I managed to bypass this by doing the following:
I created a script file in my local kubernetes directory.
In the script, I inserted the following code:
export PATH="/Users/username/google-cloud-sdk/bin:$PATH"
cluster/kube-up.sh
This then ran kube-up.sh creating a cluster with values I had set in kubernetes/cluster/gceconfig-default.sh using php.

Related

cloud_sql_proxy gives "error reading config"... how do I fix this?

I have gcloud working in power shell:
> gcloud version
Google Cloud SDK 375.0.0
bq 2.0.74
core 2022.02.25
gsutil 5.6
I've been trying to follow these directions to get my Sql Management Studio to connect to a Google SQL service:
https://cloud.google.com/sql/docs/sqlserver/connect-admin-proxy#start-proxy
But I get this error:
PS C:\gcloud_stuff> ./cloud_sql_proxy -instances=<my instance connection>=tcp:1433
2022/03/06 02:02:51 GcloudConfig: error reading config: exit status 1; stderr was:
The system cannot find the path specified.
The system cannot find the path specified.
2022/03/06 02:02:51 google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
Does anyone know how to fix this? (I am new to Google Cloud)
Looks like you don't have a local set of credentials.
You can either run gcloud auth login and try again. Or you can create a service account key and pass it to the proxy with the -credentials_file flag. See the Proxy docs for details.

gcloud SDK: Unable to write file

I installed gcloud SDK with brew cask install google-cloud-sdk
$ gcloud container clusters get-credentials my-gke-cluster --region europe-west4-c
Fetching cluster endpoint and auth data.
ERROR: (gcloud.container.clusters.get-credentials)
Unable to write file [/Users/xxxxx/my-repo]: [Errno 21] Is a directory: '/Users/xxxxx/my-repo'
Now all permissions of the folder and recursive files are restricted to 600 (drw-------). Tried to reinstall gcloud but with no effect on its behavior.
I assume you're using macOS and I'm unfamiliar with it.
The gcloud container clusters get-credentials command should write to a file called ${HOME}/.kube/config.
The error suggests that it's trying to write the credentials to /Users/xxxxx/my-repo and this is determined by the value of ${KUBECONFIG}. Have you changed either ${KUBECONFIG} or your ${HOME} environment variable? You should be able to printf "HOME=${HOME}\nKUBECONFIG=${KUBECONFIG}" to inspect these.
You may be able to choose a different destination by adjust the value of KUBECONFIG. Perhaps set this to /Users/xxxxx and try the command again.
Ultimately, this is some sugar to update the local configuration file. It should be possible to create this manually if needs be. If the above don't work, I can update this answer with more details.

Unable to run Grafana server on local system

I have to create a plugin for Grafana. For that i cloned the code from Github and followed this. I have managed to build the grafana but having issue in running the server. I am getting the error
Grafana-server Init Failed: Could not find config defaults, make sure homepath command line parameter is set or working directory is homepath
I did find this issue at issue. I have copied the "sample.ini" and re-named it to "custom.ini" and used the following commands in the bin folder made after building the grafana
.\grafana-server.exe --config D:\Go-UpdatedWorkSpace\grafana\conf\custom.ini
.\grafana-server.exe D:\Go-UpdatedWorkSpace\grafana\conf\custom.ini
.\grafana-server.exe -config D:\Go-UpdatedWorkSpace\grafana\conf\custom.ini
.\grafana-server.exe -config "D:\Go-UpdatedWorkSpace\grafana\conf\custom.ini"
.\grafana-server.exe --config "D:\Go-UpdatedWorkSpace\grafana\conf\custom.ini"
.\grafana-server.exe "D:\Go-UpdatedWorkSpace\grafana\conf\custom.ini"
But non of them worked. I am still getting the error
Grafana-server Init Failed: Could not find config defaults, make sure homepath command line parameter is set or working directory is homepath
What am i doing wrong ? I am new to Grafana development, any help would be much appreciated.
I have managed to resolve the issue. I ran the Grafana locally by using following command
./grafana-server.exe -config "D:\Go-UpdatedWorkSpace\grafana\conf\defaults.ini" -homepath "D:\Go-UpdatedWorkSpace\grafana".
I executed this command on the "bin" folder created after building the grafana with GoLang. (There is also a bin folder inside the homepath directory, i think we can use any of then "bin" folder). Issue was that i was not providing "homepath" in the command. "homepath" is the directory where grafana code is cloned.
In case someone looking for Mac, the below works. I tried with grafana version 8.x . For default install, No need to give -config as -homepath should take care. this could run from any location.
/grafana-install-path/bin/grafana-server -homepath /grafana-install-path web

gcloud compute scp error: All sources must be local files

I tried to copy file from my google cloud instance to local machine with the following command:
gcloud compute scp nlp-2:to_test.txt C:\Temp
And got back the following error message:
ERROR: (gcloud.compute.scp) All sources must be local files when destination is remote. Got sources: [nlp-2:to_test.txt], destination:
C:Temp
What is exactly wrong? I am confident that the same command worked like 2 days ago.
Update: I am connecting to Ubuntu 16.04 (google instance) from Win 7 (local machine)
In order to resolve copying files to the instance, I had to create a path in D: (in your case can be C:) the same as the one represented by ~ in the ubuntu instance (/home/example_name/) and put the files to copy in that windows directory:
sudo gcloud beta compute scp --project="projectname" --zone="zonename" ~/Filename.zip instancename:~/
The reason is because the console scp does not support :
I have just tried to replicate the issue running the following code on a Google Cloud SDK Shell from a machine with Windows Server 2008 R2:
gcloud compute scp instance-1:/home/username/file C:\Users\username\file2
where instance-1 is a Debian 4.9.51-1 and I have been able to copy the file.
Therefore I think you misspelled something writing the command (also because you wrote that it was working for you as well some days ago) or I didn't understand correctly your configuration.
If this is the case an you provide some information more editing the question?
EDIT
I tested as well to do SCP between Debian machine having "weird" names and I have been always able to copy the files both from a remote location and to a remote location:
gcloud compute scp instance-1:/paolo '/C:\\Temp'
and
gcloud compute scp instance-2:'/C:\\Temp' .
Note despite the weird notation that C:\Temp is a file stored in a Linux instance
You may like to use as it worked for me:
in my case every file was in the folder jupyter!
gcloud beta compute scp --project "project_name" --zone "zone_name" instance_name:~jupyter/file_name /home/Downloads

JasperReports Server Installation fails while executing initdb.exe of postgresql

JasperReports Server 5.6.0
I am able to successfully install JasperReports Server in unattended mode, when login to a specific machine as local Administrator. But I want to do the installation from a remote machine and am passing the same parameters as earlier(invoking the setup using CPAU for run as admin), but it fails while executing initdb.exe with the data folder creation.
I am getting the following error message as stated below.
"Executing initdb.exe -U postgres -E UTF8 -D C:/JASPER~1/JASPER~1.6/POSTGR~1/data
Script exit code: unknown signal
Script output:
Script stderr: child killed: unknown signal"
After googling and looking for a possible solution, I tried the following.
1) Created the data folder via cmd and provided full control permissions using cacls
2) Created the parent folder 'JasperServer' and provided inheritance permissions of OI, CI, Full Control.
But the issue appears to be the same. Though I am able to install JR Server with the same account by rdp in to the specific machine.
Can anyone help me out?
pls try this:
http://community.jaspersoft.com/wiki/bundled-installer-fails-error-running-initdbexe
Reason: You are using domain admin account.
Solution:
change to local admin user and restart install procedure,then it works:-)
By, Kosta