Docker for the C# developers Crash Course

What are we going to learn? The goal is to help you achieve practical, working knowledge of Docker so you can build containerized micro-services in C# with relative ease. We are going to use .Net core as it is cross-platform and well supported on Linux-based Docker containers. Having said that, the Windows-based Docker containers exist too, but the haven’t got much traction. Source code The source code is available on github [Read More]
C#  Docker 

Pixies, part 12: Ship It!

Environment values in the browser So we want dynamically specify the api URL in the frontend application running in the container, preferably taken from the environment values. The thing is that the frontend application runs in the browser on the user’s machine. You wouldn’t want (and couldn’t) to hijack the user’s browser to set some environment value there, obviously. So what do we do? Remember, when we made our nginx to listen on the PORT specified with the environment variable - we essentially modified the nginx’s config in the boot. [Read More]

Pixies, part11: Connect the Frontend to the Backend

Where at are we now All right, at this point we have containerized the frontend, the backed and also, for the development purposes, we are using the Postgres container. Sadly, our frontend uses hardcoded data, not the data which the backend is happy to serve us. In this module we are going to fix that. But first, let’s makes sure we have our containers running. In the backend directory do: [Read More]

Pixies, part 10: Serving Static Files

collectstatic Django serves the static files only during the development, i.e. when you run python manage.py runserver. In the production, it is assumed that the static files are being served by something more suitable, like a regular Web server. Having said that, in interest of keeping our backend self-contained, there is a way to serve them by using the package called whitenoise Either way, the first step is to collect the static files from all Django apps we have (remember, our application is made of several Django apps, namely photos, admin and rest_framework). [Read More]

Pixies, part 9: Let's containerize the Backend

Remember when we create a neat compact Docker image for the frontend? Now we are going to do the same thing for the backend. Allowed Hosts Before we start working on the Dockerfile for the backend, we need to take care of one thing. Because we are not going to run the backend app in the Docker in the DEBUG mode, Django will require that the ALLOWED_HOSTS setting is set. This setting is a security measure which prevents certain types of the security attacks. [Read More]

Pixies, part 5: Easy PostgreSQL setup

Why Postgres? As our backend is going to be Django-based, we will need a relational database to store the data. Most Django tutorials assume sqlite which is a simple, one-file database which works just fine for the tutorials. The problem, however, begins when you want to deploy your application to production: because of its limitations, it might not be such a good idea. PostgreSQL (a.k.a. Postgres) is a production grade database, with a widespread use. [Read More]

Pixies, part 3: Go Live

Source control Now it is a good time to add everything to the git repository if you haven’t done that yet. Create a .gitignore file which contains the stuff you don’t want to check in. Her’s mine: node_modules build .vscode Now check in your project. You know the drill: git init git add -A git commit -m "initial commit" Heroku In this module we are going to deploy our frontend application so the whole world can admire our doing-nothing application. [Read More]

Pixies, part 2: What you wanted to know about Docker but were afraid to ask

Docker in a nutshell Docker allows you to create self-contained turnkey images which contain everything one needs to run your application. These can be copied, shared, uploaded and deleted, when not needed anymore. When I need to run PostgreSQL or, say, Redis on my box I do not bother anymore installing this software and pollute my hard-drive. I just pull corresponding image and run it on my box. When I don’t need the image anymore I simply delete it and my hard-disk is back to the state it was before. [Read More]