No problem, I have been there done that before with the same issue its the concept is not explained in depth its important. On deployment is always issue too
Option 1. You have to ssh into the cloud run service container there should be some information in the google cloud dashboard heres a link I hope that helps. Then you edit the .env file but would have to restart the application for it to pick the .env file changes cloud.google.com/compute/docs/ssh-in-browser Option 2. is redeployment which is the more realistic thing DevOps does when we have to connect entire other software to your platform or new databases you will need to redeploy and do the whole build process again anyways. This is the unfortunate reality of the DevOps, they do build custom tools you build off the self to manage and automate .env files but this really out of scope for this video locally you can just edit the .env file and see the changes update locally to test stuff out first however I know you are talking about the deployment specifically here
Yes it's from google's docs this a default dockerfile used to make deployments its in the blog post the hyperlink should be there if its not just tell me and I will update it
Do you know what could cause this error? Revision ... is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.
Hi Leslie, Many thanks for your video. I'm trying to deploy a custom built flask app which also relies on html files inside the templates folder. After following your steps I'm getting a service unavailable error. It works perfectly when I run it on localhost, any ideas how to troubleshoot? I can't see errors in the log
@@martinmalic5411 Hi martin sorry for that late response I have been super busy lately I am getting my MBA right now its best to just set up a zoom call? lesliemwubbel.com/11-consulting/ 1. Best guess without seeing your code is that the template files were not copied from your local machine to the cloud instance when you deploy I would double check the the dockerignore file to see if html files are being ignore on deployment SSH into the Cloud instance to 2. Then I would check your endpoint @app.route('/upload', methods=['POST']) if your @app.route is not set to @app.route('/' ) that is your homepage on URL So I need to see code? is the template render function being called on the endpoint? Try to use paste bin? to share code with me Images of folder structure helps too Lot of different things could trigger this? - Check Server Logs - Verify Dependencies - File Permissions - Web Server Configuration - Application Errors - Network Configuration -Resource Limits
@@lesliewubbel9157 Leslie, many thanks for your response and congrats on your MBA. At the moment I have managed to host the web-app on pythonanywhere which seems to do the job just fine for my needs. Let's not waste your time at the moment, I appreciate you taking the time however. Perhaps in the future. Martin (I think I responded already, but I don't see it so here's another try)
I have another quesiton, could you upload a tutorial on deploying a flask application that utilises flask socket IO, or do you know of any good resources for this? Thank you
Truthfully I don't know, I have not been in that situation, but I would look into microservices, docker, and proxy engine nginx.org/en/ to handle high server loads it should work but there are ways to load balance. I would google load balancing
I got some error while following the step to deploy the url. And when checking log, it gives me this following error: "Default STARTUP TCP probe failed 1 time consecutively for container "project-name" on port 8080. The instance was not started." Any help on this please? :)
Can you double check the docker file? the last line should be CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 app:app also check check the yaml file was that create it should match runtime: python39 entrypoint: gunicorn -b :$PORT app:app if not I will have go through it again and make sure its all correct on my tutorial
@@lesliewubbel9157 Actually, I think I got it to work already. For some reason my docker does not recognize the environment variable (PORT) and also some of my api key (being used in the backend file that I had). So I went ahead and manually add the key (secret key) on the google cloud directly, and it works. Thanks for such a swift response. Appreciated!
I got the same issue. "...The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable." I have confirm: app.yaml -> entrypoint: gunicorn -b :$PORT app:app Dockerfile -> CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 app:app I tried changing .env to PORT=5000, but it still saying, PORT=8080 on gcloud deploy...
i am getting error at very last step of uploading on checking logs it says ERROR: Could not find a version that satisfies the requirement pywin32==306 (from versions: none) ERROR: No matching distribution found for pywin32==306
@@lesliewubbel9157 yeah! beautifulsoup4==4.12.2 blinker==1.7.0 certifi==2023.7.22 charset-normalizer==3.3.2 click==8.1.7 colorama==0.4.6 comtypes==1.2.0 dnspython==2.6.1 flask==3.0.0 Flask-PyMongo==2.3.0 idna==3.4 importlib-metadata==6.8.0 itsdangerous==2.1.2 Jinja2==3.1.2 MarkupSafe==2.1.3 MouseInfo==0.1.3 Pillow==10.1.0 PyAutoGUI==0.9.54 PyGetWindow==0.0.9 pyjokes==0.6.0 pymongo==4.7.2 PyMsgBox==1.0.9 pyperclip==1.8.2 pypiwin32==223 PyRect==0.2.0 PyScreeze==0.1.30 python-dotenv==1.0.1 pyttsx3==2.90 pytweening==1.0.7 pywhatkit==5.4 pywin32==306; platform_system == "Windows" requests==2.31.0 soupsieve==2.5 SpeechRecognition==3.10.0 urllib3==2.0.7 werkzeug==3.0.1 wikipedia==1.4.0 zipp==3.17.0 When I was searching for solution on stackoverflow, GPT etc they told me to comment out the line pywin32==306 or write pywin32==306; platform_system == "Windows" since it is not compatible with linux (thats what gpt said). I did all of that but still nothing worked.
@@lesliewubbel9157 Yeah beautifulsoup4==4.12.2 blinker==1.7.0 certifi==2023.7.22 charset-normalizer==3.3.2 click==8.1.7 colorama==0.4.6 comtypes==1.2.0 dnspython==2.6.1 flask==3.0.0 Flask-PyMongo==2.3.0 idna==3.4 importlib-metadata==6.8.0 itsdangerous==2.1.2 Jinja2==3.1.2 MarkupSafe==2.1.3 MouseInfo==0.1.3 Pillow==10.1.0 PyAutoGUI==0.9.54 PyGetWindow==0.0.9 pyjokes==0.6.0 pymongo==4.7.2 PyMsgBox==1.0.9 pyperclip==1.8.2 pypiwin32==223 PyRect==0.2.0 PyScreeze==0.1.30 python-dotenv==1.0.1 pyttsx3==2.90 pytweening==1.0.7 pywhatkit==5.4 pywin32==306; platform_system == "Windows" requests==2.31.0 soupsieve==2.5 SpeechRecognition==3.10.0 urllib3==2.0.7 werkzeug==3.0.1 wikipedia==1.4.0 zipp==3.17.0 when I searched the error on stackoverflow and gpt they said it might be because pywin is not compatible with linux and mac. and server we're using from GCP is linux hence specify it in .txt so i did that. Also i tried to comment out that line but nothing worked.
Yea I think he means a flask tutorial for building real life apps. I also feel a flask playlist would be really helpful, most flask tutorial on YT are old, a modern series of flask tutorial vids in 2024 would be nice. Then ofcourse, how to deploy the flask app over the cloud so that end users are able to use them.@@lesliewubbel9157
ive done all the process, but when i open the Service URL that given by the gcloud. the URL says service unavailable. any idea on this problem ? thank you!