Deploying Django with Github Actions and Docker
Cool stuff. But, unless you need to run tests, it is better to save yourself a lot of time and use a service that does it for you, for example I use Appliku.
And even if you run tests you can trigger deployment via webhook after tests finish or soemthing like that. Deployment is a bit more tricky then just clone and build the image with the app. For example what about SSL, management of env vars and all the rest?
More on reddit.comRunning Django in a Github Action so that it's accessible to React and E2E test suite
Test via Github actions?
Continuously Deploying Django to DigitalOcean with Docker and GitHub Actions
This is great. I have also read the previous article about Django and docker with postgresql, nginx and modified it to work with postgis for GeoDjango both on ubuntu and alpine. Since this article uses digital ocean managed database, if i remove the managed db and include the db part in Dockerfile (this article repo has no mention of db in Dockerfile) as discussed in previous article. Will it work in deployment as it works on my dev machine? In short I don't want to use managed db, instead I would like to use the one which is described in Dockerfile. Steps should be same? Or having database in containers will pose problems? All your articles are really great :) Thank you
More on reddit.comVideos
Hi everybody!
From time to time I see posts or comments by people asking how to deploy their Django app on their server. I thought I'd share my process here. If you have any questions or ideas for improvements, share them here or contact me on Twitter/X.
We've got a Django+React app we're trying to get running inside a Github Action so that we can run our test suite against it. (Everything builds and runs fine in a our local docker environment)
In the Github Action, we've got Postgres running as a service inside a service: block and Django can connect to it just fine. Our Django migrations and test suite run without issue.
Now, I'm trying to get Django reachable by our React app, inside the Github Action, and run our (Cypress) end-to-end tests.
I first tried running our custom docker container for Django, but Github Actions doesn't seem to support containers not built on their base images or those from Docker hub. (Though it's possible they do and I'm just not using the right syntax.)
I then tried invoking ./manage.py runserver and backgrounding it with../manage.py 0.0.0.0:8000 & inside the block for my job, but I don't seem to be able to reach it on that port in subsequent steps.
I also experimented with creating a service for Django inside the services: block. It lets me pull a python base image from docker hub, and declare the port, but I haven't been able to find an entry point so that I can install my requirements with pip, copy over my custom apps, run the migrations, and start the server.
In Github's docs for creating services, they show examples for Postgres and Redis with only simple config provided via env vars. I'm not sure if their implementation of services: is intended for more creating more complex services with additional run steps.
Anyone have Django running in a Github Action environment in a way that your front-end JS apps and E2E tests can run against it?
Or, other suggestions or experiences to get this working on Github Actions?
I'll post our yml config in a comment below.