Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local development environment #6

Closed
zarino opened this issue May 10, 2021 · 8 comments
Closed

Local development environment #6

zarino opened this issue May 10, 2021 · 8 comments

Comments

@zarino
Copy link
Member

zarino commented May 10, 2021

Docker? Or just a virtualenv?

@sagepe
Copy link
Member

sagepe commented May 11, 2021

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).

@dracos
Copy link
Member

dracos commented May 24, 2021

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.

@zarino
Copy link
Member Author

zarino commented May 24, 2021

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.

@dracos
Copy link
Member

dracos commented May 24, 2021

Shouldn't be a pain, apart from maintenance. https://docs.docker.com/samples/django/ would probably do, I imagine, will give it a go.

@dracos
Copy link
Member

dracos commented May 26, 2021

I have created initial things as follows:

  • Poetry is used for package management - poetry add to add a new package, we commit the lock file for installation, etc.
  • Dockerfile - This builds the web container as multi-stage build, it installs poetry and runs poetry install; then installs geo stuff and copies across the built packages. Could perhaps do production in here as well potentially?
  • docker-compose.yml - this has the web container from the Dockerfile, and a database container, and that's it.

@dracos
Copy link
Member

dracos commented Jul 14, 2021

@davea used this okay to set up, so I think this can be considered done initially at least.

@dracos dracos closed this as completed Jul 14, 2021
@davea
Copy link
Member

davea commented Jul 19, 2021

Just to note that on my M1-based Mac the official PostGIS docker image doesn't work (docker/for-mac#5122, postgis/docker-postgis#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

@dracos
Copy link
Member

dracos commented Aug 16, 2021

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.)

@dracos dracos reopened this Aug 16, 2021
@dracos dracos closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants