Closed zarino closed 12 months ago
I would advocate segregating from the local system with more than just a local virtualenv
- there are lots of different ways we might be managing Python versions and packages locally, so it makes sense to use portable and standardised way of specifying both the Python version and the packages in use.
I suppose providing a .python-version
and requirements.txt
achieves this and people could manage this all as they see fit, but I still think it would be also good to provide a simple Docker-based environment and this would make it easier to integrate any other requirements such as a database (see #2 for details of these, I assume).
Understood, and does make sense, but I don't want to use Docker (my fan is already on without it, sigh) just for development. So just as long as it works fine without, which should be fine, don't see anything particularly complex to begin with certainly.
I’m running a fairly old Mac and have been pleasantly surprised by the performance of some of our other Dockerised local development environments. Certainly no worse than running the equivalent VMs in VirtualBox/Vagrant. Sounds like Docker might already be winning over VMs anyway, as M1 Macs become more common.
I have no preference on the Docker vs native python+postgres question. Whatever’s easiest at first, I guess. The contained, reproducible nature of a Docker setup is attractive, but probably not worth it in the first few months, if it’s a pain to set up.
Shouldn't be a pain, apart from maintenance. https://docs.docker.com/samples/django/ would probably do, I imagine, will give it a go.
I have created initial things as follows:
@davea used this okay to set up, so I think this can be considered done initially at least.
Just to note that on my M1-based Mac the official PostGIS docker image doesn't work (https://github.com/docker/for-mac/issues/5122, https://github.com/postgis/docker-postgis/issues/216) so I had to make the following change to docker-compose.yml
:
services:
db:
- image: postgis/postgis:13-3.1
+ image: gangstead/postgis:13-3.1-arm
restart: always
volumes:
- pgdata:/var/lib/postgresql/data
For local dev it really needs to leave poetry installed for development, this is more assuming production and setting up a slimmer build. Need a way to do both preferably. mysociety/caps has development/production docker compose YAML, perhaps this was premature and it should just install poetry and be done with it for now. (Note it is usable as is, because the paths are all set up and things run without reference to poetry.)
Docker? Or just a virtualenv?