Тёмный

Python Web Application Deployment Tutorial - Docker Compose with Gunicorn, NGINX, Postgres - Part 2 

JimShapedCoding
Подписаться 29 тыс.
Просмотров 9 тыс.
50% 1

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 59   
@jimshapedcoding
@jimshapedcoding 3 года назад
GET READY FOR THIS! Docker Compose is one of the tools that I was super excited about when I started using it to deploy some services, or basically to test it with multiple containers connected! So this utility could allow you to save hours of manual installations on your production servers, and it is a wonderful idea to maintain such a thing with an easy YAML file. In this series, I won't cover Container Orchestration tools, but this is a good candidate for a series to publish in the future. Let me know if everything was clear!
@jupyter5k647
@jupyter5k647 2 года назад
this video saved me 1 full day of quickly learning configuration. Thanks a lot brother for the series
@jimshapedcoding
@jimshapedcoding 2 года назад
I am happy this helped you. Feel free to share with more people
@cursoderobotica
@cursoderobotica Год назад
Amazing tutorial!! Thank you!! I wasn't clear about why we need nginx and gunicorn with Python apps.. now with this video is clear!! Also.. Docker and how important is the name of the services :)
@jimshapedcoding
@jimshapedcoding Год назад
Glad it helped you! Hope you'll keep watching more content on my channel!
@barrientoscardenaslinofern4717
@barrientoscardenaslinofern4717 2 года назад
I applying for a job thanks to your videos. You and your work are awesone
@jimshapedcoding
@jimshapedcoding 2 года назад
Way to go bro! Feel free to update how's going!
@jellied_fungus
@jellied_fungus 2 года назад
Incredible tutorial. Exactly what I needed to learn and everything was explained perfectly. I gotta check out part 1 and 3 now, thanks for sharing the knowledge. You got yourself a new subscriber
@jimshapedcoding
@jimshapedcoding 2 года назад
Great to hear! Enjoy the other parts!
@angejoelziade6920
@angejoelziade6920 11 месяцев назад
You are the best. Thanks a lot.
@Maskof2005
@Maskof2005 3 года назад
My apology. Please ignore all my previous comments regarding the error I mentioned. I registered successfully. This tremendous video about container. I really learned a lot from this videos, please add more videos focusing on security and provide more about external service call like connect with MongoDB outside not within same image what we created here. This is excellent hands-on tutorial. HATS OF TO YOU.
@jimshapedcoding
@jimshapedcoding 3 года назад
Thanks a lot Karthik, I'll write your suggestion down :)
@Maskof2005
@Maskof2005 3 года назад
@@jimshapedcoding Seems your site link not working. This is the first video I followed and worked. I also interested know more about integration containers for example integrate with external sites like cloud database through DDNS as I'm using Synology NAS it has Docker UI integrated with its latest DSM 7.0 (Synology's own NAS OS). Is there any GitLab or GitHub Integration possible?
@סרחיויאני
@סרחיויאני 2 года назад
Thank you so much for this tutorial!
@jimshapedcoding
@jimshapedcoding 2 года назад
Glad it was helpful!
@bmillair
@bmillair Год назад
Great video! Thank you.
@jimshapedcoding
@jimshapedcoding Год назад
Glad you liked it!
@edsouza6029
@edsouza6029 3 года назад
Very interesting and well explained. Thank You Jim
@ljkfables7336
@ljkfables7336 Год назад
Good one bro! learned a lot.
@jimshapedcoding
@jimshapedcoding Год назад
Glad to hear it!
@rohitsrao
@rohitsrao 2 года назад
Thank you so much for this. It was epic.
@CodeWithTomi
@CodeWithTomi 3 года назад
Notification squad🔥
@jimshapedcoding
@jimshapedcoding 3 года назад
Hehe love to see it brother :) Even before my pinned comment lolll
@CodeWithTomi
@CodeWithTomi 3 года назад
@@jimshapedcoding 😁... Great series by the way
@jimshapedcoding
@jimshapedcoding 3 года назад
@@CodeWithTomi Thanks!!
@zhajili1991
@zhajili1991 2 года назад
very useful tutorial man ,thanks a lot for contribution to the community :)
@jimshapedcoding
@jimshapedcoding 2 года назад
Glad it was helpful! Please share with other people! :)
@user-qv7rw7dq1d
@user-qv7rw7dq1d 2 года назад
This is amazing! Thank you so much. By the way, where are you from? I have an ear for accents, but I can't place yours anywhere. If I had to guess, Italy or Israel? Thanks! Keep up videos like this! One more question... in the YML file, I see that you call the block "web", and then proceed to write "build:web" within that block. Is the first web a variable? Can I name the block anything I want, and still reference "build:web" within that block? or do you need to write web both at the block level and the build line? Thanks!
@jimshapedcoding
@jimshapedcoding 2 года назад
Hey Paul, well, you are not too far ;) You can find the location of our channel in the about section of the channel hehe :) And about the question, build is a mandatory section to write, besides web, you can use any other different name, unless you keep the same convention, it should work!
@abdulkadirhassan851
@abdulkadirhassan851 2 года назад
Great tutorial with a great lecturer. thanks.
@jimshapedcoding
@jimshapedcoding 2 года назад
Thanks a lot!
@abdulkadirhassan851
@abdulkadirhassan851 2 года назад
You're welcome Jim.
@tobenary
@tobenary 3 года назад
As usual. Great tutorial
@jimshapedcoding
@jimshapedcoding 3 года назад
Thanks again!
@ankitameher6142
@ankitameher6142 Год назад
can you show how we can connect two Microservices in python which will be interact with each other using same technology like Docker Compose with Gunicorn, NGINX, Postgres
@tomprice2517
@tomprice2517 2 года назад
Great video, thanks Jim! I have a postgresql database hosted on the Heroku cloud that I connect to with my Plotly Dash app. Do I still need to create a docker container for postgresql or can I just create a flask container pull the data into there?
@braindev-birgadasturlaymiz4403
@braindev-birgadasturlaymiz4403 2 года назад
thank you Bro
@movies_explainedhindi5332
@movies_explainedhindi5332 3 года назад
Nice content bro ☺️👍👍👍🔥🔥❤️❤️❤️
@jimshapedcoding
@jimshapedcoding 3 года назад
Thanks a lot! feel free to share :)
@סרחיויאני
@סרחיויאני 2 года назад
Again, thank you for the tutorial. However, there is a question I can't resolve: when I run the image in development mode (with the Flask server) the return send_file() works ok. However, in production mode (using gunicorn) the function returns a 500 server error. DId you see this problem elsewhere?
@jimshapedcoding
@jimshapedcoding 2 года назад
Hello, thanks for watching my tutorials! Actually, I did not face it. But maybe you can share how your docker-compose is declared and also the flask Dockerfile?
@PhilipSchmitt
@PhilipSchmitt 3 года назад
I ran through the entire video series and everything worked fine till I got to the last step to create the tables db.create_all() and I get the following error: File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: database "market" does not exist I tried copying your YAML and config files directly from your git just to check if I have any errors. The local db version works fine. Any ideas to check? Great set of videos! excited to post this to production if I can figure this last issue out.
@jimshapedcoding
@jimshapedcoding 3 года назад
Hey Philip.I am glad that you followed this entire series! :) Feel free to share it I am not sure why it complains about the database existance of market (NOT the Postgres service itself which is fine from what I see in this error) Can you try to run docker-compose down -v and then retry (This will remove the attached volumes and will recreate the volume for maintained data again) ? The postgres should create the databases itself according to the values you mention within POSTGRES_DB environment variable.
@PhilipSchmitt
@PhilipSchmitt 3 года назад
@@jimshapedcoding That worked! Must have had another error prior to that and I renamed the database while trying to debug which looks like my issue. Thanks! video series is great.
@PhilipSchmitt
@PhilipSchmitt 3 года назад
@@jimshapedcoding One more question - Is there an automated way to sync tables between production and development databases? Would be good to replicate the items database between the two? I figured out how to do it manually and can create a script once we setup the db to read from sqlite3 and write to postgres. Not sure if there is already a utility for this? Also, if we wanted to automate the db.create_all() is there a utility to check if the tables are setup and automatically create the tables in our python code?
@jimshapedcoding
@jimshapedcoding 3 года назад
@@PhilipSchmitt Wonderful. Hope you'll find some other useful videos
@jimshapedcoding
@jimshapedcoding 3 года назад
@@PhilipSchmitt I would go automating the database sync with automating backup and restore process. You can do it with the built-in command line of postgres which is pgdump. Also you can get idea how to perform back up and restore from pg admin by connecting to the POSTGRES DB ( you'll need to export the port outside ) Having database replicas is a total different thing than that btw. Not sure if this is what you meant anyway And also, it is great question about automating the tables. You can automate and verify that the container is up first. And then do a automation to the docker exec for that container. Checking if the tables are there? Tricky question and never tried to automate that. But just run always db.createall unless you do not change the models code :)
@nielshoogeveen3767
@nielshoogeveen3767 3 года назад
I am getting the following error: gunicorn.errors.HaltServer:
@nielshoogeveen3767
@nielshoogeveen3767 3 года назад
I am also getting this error: [11] [ERROR] Exception in worker process
@samucancld
@samucancld 2 года назад
with Django is the same?
@jimshapedcoding
@jimshapedcoding 2 года назад
Hey thanks for watching! Yes it is definitely very similar
@nielshoogeveen3767
@nielshoogeveen3767 3 года назад
I keep getting this error: OSError: [Errno 98] Address already in use I tried to kill it with kill -9 $(ps -A | grep python | awk '{print $1}') But without success. What am I doing wrong?
@jimshapedcoding
@jimshapedcoding 3 года назад
Hey Sorry for late reply. Can you check with top command what processes are started by yourself? Maybe it will give more indication what's going on
@nielshoogeveen3767
@nielshoogeveen3767 3 года назад
@@jimshapedcoding hi! I already solved it! I needed to use the flask server for my Dash server!
@ironF5
@ironF5 2 года назад
how to deploy this app on Amazon lightsail and sagemaker... please tell all steps....
@Just4Pro1
@Just4Pro1 Год назад
when i run db.create_all() i see this error. can anyone help? Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/extension.py", line 868, in create_all self._call_for_binds(bind_key, "create_all") File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/extension.py", line 839, in _call_for_binds engine = self.engines[key] ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/extension.py", line 628, in engines app = current_app._get_current_object() # type: ignore[attr-defined] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/werkzeug/local.py", line 513, in _get_current_object raise RuntimeError(unbound_message) from None RuntimeError: Working outside of application context. This typically means that you attempted to use functionality that needed the current application. To solve this, set up an application context with app.app_context(). See the documentation for more information.
@jimshapedcoding
@jimshapedcoding Год назад
There is a new rule that you need to run inside a context manager with app.app_context(): db.create_all()
Далее
DHH discusses SQLite (and Stoicism)
54:00
Просмотров 88 тыс.
Using docker in unusual ways
12:58
Просмотров 456 тыс.
Docker in 40 minutes (Includes Hands-on)
39:55
Просмотров 12 тыс.
How To Use Docker To Make Local Development A Breeze
21:53