![]() ![]() $ sudo apt install postgresql postgresql-contribĪfter install, you can check the tool is working with e.g.: ![]() For example, on Ubuntu 16.04 LTS, this command was enough: You might need to google the easiest installation method (depending on what OS and version of OS you are using). Well, first you need to make sure you have the “postgres command line tool”, called “psql”, on your local machine. … (tested that this works on a Windows 10 machine)]. [macOS (High Sierra) equivalent command is: In the new terminal, the first task is to check that the port 60606 is listening – this command should work on Linux: Leave that terminal open, and open a new terminal. Don’t exit now from this shell, because when you exit from the ssh-session, you also close the tunnel that you created… whereas you still want to login to postgres via this tunnel: so, you keep the tunnel open for now. You will have noticed that on this terminal, you also have a shell open in your main app, where you have just ssh:ed in as user vcap. Ok, so now you have set up the ssh-tunnel from your local port to the postgres database via the main app. the local port 60606 is forwarded to the host 10.11.12.13 on the Cloud Foundry space’s network – and then the port of that host has to be the one specified in the postgres backing-service’s service-key, so: port 39890.Īt least, that is how I have explained this command to myself, if anyone has a better explanation please enlighten me also □ It’s worth just checking through this command, to see what it is doing… the “cf ssh” utility, is saying via the “-L” flag, that we want to forward the local (as in your local machine’s) port 60606 in such a way, that when a call comes in for port 60606, then we “cf ssh into/via the main app (bulletinboard-ads)”, where an ssh-tunnel has been just now defined, i.e. Now we are coming to one of those “magic spells” kind of commands… let’s say, that on your machine (the computer from which you are logging in to Cloud Foundry), you decide to use the local machine’s port number 60606, whenever you want to login to the postgres backing-service on Cloud Foundry… then, your cf CLI incantation would be: $ cf service-key postgres-bulletinboard-ads bee-key-pers ![]() Now you can check and maybe copy-paste onto gedit or notepad++ or wherever, the details of your service-key: $ cf create-service-key postgres-bulletinboard-ads bee-key-pers You can logout from your app container using this command:īack in your own machine’s shell, you need to create the service-key for your backing-service, like so – I call mine “bee-key-pers”, you can always choose your own name for the key: If this cf ssh login succeeds, your prompt should change to the hostname part after the is a long hexadecimal string. Test that ssh-ing into your main app works ok, by logging into the “default” instance: (If your app was running but not enabled till when you executed the above command, you will likely need to restart the app, for this ssh-enablement to be picked up (according to advice in the comments section, thanks Ivan)). ![]() If needed, you enable ssh for your main app: So, you start off by entering some commands to the terminal: I also assume you are using a bash-terminal, because that is what I prefer □ Now let’s also assume you have logged in to your Cloud Foundry account using the cf CLI. Like for example you just completed Exercise 10 from the openSAP course: We assume that app and database are running nicely (“cf push” worked and the manifest.yml bound the app to the backing-service correctly). Let’s say, your main app is named “bulletinboard-ads”, and your backing-service is named “postgres-bulletinboard-ads” (since those were the names suggested in the course exercises). So, in case anyone else gets stuck, here is the solution, in case (as in this openSAP course) we have a Postgres database as a backing-service on Cloud Foundry (and not a mysql database). So, I followed the instructions, they were quite clear… but… there’s always a catch… I got stuck for a little bit at the last step, where (in their tutorial example) you would use the mysql command line tool with its options, to connect to the backing-service via the SSH-tunnel created in the previous step with “cf ssh”-tool. … now in the Week 3 slides (slide 2), there is an optional exercise suggested: follow the tutorial from on how to access your backing-service (a database) on Cloud Foundry, using this link: So there is the openSAP course “Cloud-Native Development with SAP Cloud Platform” (iiz a good course yeh): ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |