question

bettina.swynnerton avatar image
bettina.swynnerton asked stephaniesalvador1_162030 commented

How to upload the secure connection bundle via UI when using Python backend in Gitpod?

If you are having trouble uploading the Astra secure connection bundle through the Getting Started with Astra UI, using the Python backend API, please verify you followed the steps outlined in the answer below.

If you still face issues, comment with a screenshot showing the POST error in the browser developer tools.

If you are using the Java backend API, check this other post here:

https://community.datastax.com/questions/6805/

workshop-faq
1 comment
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

stephaniesalvador1_162030 avatar image stephaniesalvador1_162030 commented ·

For step 4 - do I add /api to the end like the workshop instructions? ie: echo 'BASE_ADDRESS=https://5000-e53a1111-b194-4865-9d39-03a1bad1eeb4.ws-us02.gitpod.io' > .env


For step 5 - after submiting python getting_started_with_astra.py - do I leave that terminal alone (don't ctrl C)? How do you open a new terminal in gitpod?

0 Likes 0 ·

1 Answer

bettina.swynnerton avatar image
bettina.swynnerton answered bettina.swynnerton edited

Hi,

thanks for attending week 4 of the Cassandra Cloud-Native Workshop Series.

If you followed along and have problems uploading the secure connection bundle through the UI while running on Gitpod and using the Python API, check that you followed the following steps.

There is another post for Java API, and if you are running locally, it is unlikely that you run into this issue.

Step 1:

Start Gitpod and then start the Python backend:

Important: Do not start a virtual environment on gitpod. (this is only needed when running on your local machine)

Navigate to the getting-started-with-astra-python folder, install your dependencies and run the app:

pip install Flask flask-cors cassandra-driver
python getting_started_with_astra.py

You should see this output:


Step 2:

Make port 5000 public, and open a browser:

You will see a page like this:

This is expected, as we are not serving a page, but the API is up:

Step 3:

Take a copy of the URL in the browser. You will need the URL to give the base address of the API to the UI.

It will look similar to this (this is uniquely generated for your gitpod workspace)

https://5000-aee20c95-8521-45ca-xxxx-e4270a6ad672.ws-eu01.gitpod.io

In contrast to Java, there is no Swagger, sorry.


Step 4:

Create a .env file for UI, in the root directory of getting-started-with-astra-ui

It needs to contain this text. Important: Since we made some changes the backend, please no longer use a localhost address for the BASE_ADDRESS.

BASE_ADDRESS = https://5000-aee20c95-8521-45ca-xxxx-e4270a6ad672.ws-eu01.gitpod.io


Step 5:

Open new terminal and navigate to the getting-started-with-astra-ui folder

run npm install

then start the UI with npm run start

Make port 3000 public and start a browser.


Step 6:

In your browser, populate the credentials and click Test

If the test is successful, you will see a green confirmation in the lower left hand corner of the browser screen.

That's it! You are good, you can now proceed to saving this connection and launch your spaceships.


Step 7, in case you run into connection issues like this:

Open your browser's development tool, and take a note of the POST and GET errors when testing the connection (you can ignore other errors about sock.js, sorry about those)

If you are seeing CORS policy issues in your browser, please follow this advice here:

https://community.datastax.com/questions/6959/why-is-my-connection-test-from-the-getting-started.html


PS. This post has been updated after we made more changes to the backend APIs, and a BASE_ADDRESS containing a localhost address is no longer a valid address.


1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

David Jones-Gilardi avatar image David Jones-Gilardi ♦ commented ·

Thank you for the nice writeup @bettina.swynnerton

0 Likes 0 ·