About to start on a brand new site, so I can start with a clean slate. That’s good. I’m back to Python after an 8 year absence, which is bad. The site will be built using web2py, which requires no special configuration. Back end will be postsgresql, web server will be ngnix. Am trying to understand best practices. I want it to be:
I think the right approach is as follows, but please correct me if I’m wrong.
Questions:
Thanks much. Sorry for the treatise-length question but I’d like to start out with good habits and not harm the person who follows me.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Thanks, for your perspective, asb. I am having trouble getting my arms around the concept of how postgres and Python can talk to each other in separate containers. I now see your suggestion is the “right” one. Just trying to come to terms with it.
This sounds like a great approach. Besides isolating processes, one of the big wins with Docker is that it makes your application portable. One thing to note, you should really think of each container as providing a separate service. For instance, don’t install postgres and your web2py in the same containers. Use a separate one for each. This will also help with future scalability concerns.
As for telling programmatically if Docker failed to install something, building the image will error out in that case. Take the Dockerfile:
You won’t be able to produce an image as the RUN command will return a returned a non-zero exit code:
For automating deployment, there are many different options that you could use. As you’re already working in Python, Fabric might be a good choice. It allows you to do tasks like upload files and run remote commands. Checkout this article for more information:
If you wanted to incorporate creating droplets into the same scripts, you could use our API via
python-digitalocean
.Love to hear other’s thoughts, and what you end finalizing on!