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!
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 :)
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
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 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?
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!
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!
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
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?
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?
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?
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.
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.
@@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.
@@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?
@@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 :)
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?
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.