0

From this answer I need to upgrade the psql in the Google Cloud Shell. But any upgrade I do there it shows a warning like this:

Note that your Cloud Shell machine is ephemeral and no system-wide change will persist beyond session end.

So how do I upgrade psql in the Google Cloud Shell and how to do it permanently?

Zenko
  • 101
  • 3
  • You don't. That's what the message already told you. – Michael Hampton Aug 27 '20 at 15:51
  • Is there any settings that we can set for this? Maybe it could be set to start with certain package versions? Because does it makes sense to have different versions between client and server within Google Cloud services itself and we cannot even set anywhere to match the version? Then some functionality won't work / incompatible. Shouldn't Google have thought about it? They did right? – Zenko Aug 28 '20 at 02:43
  • The Cloud Shell itself is just a convenience tool. It's not meant to replace your workstation. Most of what you do should not be in the Cloud Shell at all. – Michael Hampton Aug 28 '20 at 03:29
  • It's complicated for me. And I think for everyone who develop from China. Yes, I'm located in China now and I need to use some kind of VPN to connect to Google Services. But gcloud blocked my connection plenty of times even when I have whitelisted the ip address, probably due to some security precautions. The only reliable way is to use the cloud shell when on VPN. So for me Cloud Shell is not only for convenience, it is the only reliable way. Unless of course we found another way or Google would be so kind to make exceptions for developers in China. I'm here as a foreigner by the way. – Zenko Aug 28 '20 at 05:17
  • You're pretty screwed, then. Google certainly cannot override the Chinese government! – Michael Hampton Aug 28 '20 at 05:21
  • Don't get me wrong, this is not a block from China government but rather from Google. Because I can access the shell and others flawlessly with VPN. Only when I try to access the SQL server instance it blocks and it says the remote server is the one that drops the connection. Anyway this part is off topic. The point is so we found out that there is no way to write a pre-settings of which packages to install for the shell we use. – Zenko Aug 28 '20 at 05:26

1 Answers1

0

The short answer to this question unfortunately is that it is not possible to make it permanent update. However, I found a work-around and I hope this could be useful for anyone who develop from China.

  1. Get a server running outside China. (For my case I used Vultr. It is as cheap as $5 / month.) You can use whatever convenient for you.
  2. Install gcloud in that server. If you are using Ubuntu server like me, then you could follow this instruction
  3. Install psql. For Linux servers you can follow this instruction
  4. Then run gcloud init. Set the appropriate project and server location. Find the server location in your Google Cloud Console.
  5. If you have any SSH settings enabled, then you have to take care of this as well.
  6. Run gcloud sql connect <postgres-instance-name> --user=<username> --quiet

Then it works!

Now I can use GCLOUD without VPN because I connect firstly to that server I setup.

Zenko
  • 101
  • 3