You need A GitHub account, and the lab project and environment from lesson 5.1.1.
Pushing to your repository doesn't deploy yet. You start every build yourself, from the console.
Fork the sample
On GitHub, fork
github.com/computesphere-samples/computesphere-python-flask-example. It's a small Flask app that serves one page on port 5000.You should seeYour own copy of computesphere-python-flask-example under your GitHub account.
Connect your fork
Follow lesson 5.3.1 and give the ComputeSphere app access to only your fork.
You should seeThe GitHub connection listed under Connections.
Create the service
In your lab project, choose New service, then Web Service. Name it
flask-weband choose Git repository as the source. Under Configuration, choose Private (Connections), your connection, your fork and themainbranch.You should seeThe Runtime step of the new service form.
Set the runtime
Choose Python, version 3.12. Set Build command to
pip install -r requirements.txtand Start command togunicorn --bind 0.0.0.0:5000 app:app. Replace the default start command: this app has nomain.py.0.0.0.0lets traffic from outside the app reach it.You should seePython 3.12 with your build and start commands filled in.
Set the port
Keep the Flex shape and 1 spherelet. Under Networking, change the port from 80 to
5000, where the app listens.You should seePort 5000 under Networking.
Deploy and watch the build
Choose Deploy, then open the service's Builds tab.
Check yourself
You should seeIn the Builds tab: Queued, Building, Deploying, then Running.
Open the URL
curl -I https://<your-flask-web-url>You should seeThe Flask page in your browser, and a 200 status from curl.
Check your work
If this doesn't pass
Build Failed: open it in the Builds tab and fix the first error (lesson 5.3.3), usually a typo in the build command. Built but the service Failed: check the start command, then run csph logs flask-web. An error about main.py means the default start command is still set.
If this doesn't pass
Running but no answer: the port is probably still 80. Set it to 5000 in the service's Networking settings and redeploy.
Changed the code? Ship it
Open the service, choose Redeploy, keep Build & deploy selected, and confirm. ComputeSphere builds the latest commit on your branch. Automatic deploys on push are on the way.