-
Notifications
You must be signed in to change notification settings - Fork 40
Conversation
Needed to get around obscure Kombo errors when evaluating the settings file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker-compose up
threw errors for me that prevented me from moving further. Otherwise this looks fine (although I mainly stuck to reading the parts that looked hand-written and skimmed the rest of it).
django/publicmapping/Dockerfile
Outdated
COPY requirements.txt /usr/src/app/ | ||
RUN pip install --no-cache-dir \ | ||
numpy==$(grep "numpy" requirements.txt | cut -d= -f3) \ | ||
scipy==$(grep "scipy" requirements.txt | cut -d= -f3) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On docker-compose up
this is throwing an error:
Collecting numpy==1.6.2
Downloading numpy-1.6.2.tar.gz (2.6MB)
Collecting scipy==0.11.0
Downloading scipy-0.11.0.tar.gz (6.8MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-aIUO1B/scipy/setup.py", line 208, in <module>
setup_package()
File "/tmp/pip-build-aIUO1B/scipy/setup.py", line 145, in setup_package
from numpy.distutils.core import setup
ImportError: No module named numpy.distutils.core
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I did not seem to run into this after running:
$ docker-compose build
$ docker-compose up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I nuked every docker image on my machine and then rebuilt, and now it works. ¯_(ツ)_/¯
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = '1%a60e98ywm#$gl4mcm%s#uxoppc3)t%w+an*gzmujo-v-i07^' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to change this or deliberately leave it out so that it doesn't slip through the cracks as we work on this further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that we can pull it from the environment such that it leaves this setting unset if we forget to populate it:
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||
urlpatterns = [ | ||
url(r'^plan/$', redistricting_views.viewplan, { 'planid': 0 }), | ||
url(r'^plan/create/$', redistricting_views.createplan), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the name
parameters here may be the source of the confusion with reverse()
if we were relying on calling these views by name. In other words, this line may need to become url(r'^plan/create/$', redistricting_views.createplan, name='createplan')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried adding names to all of the url views including the login view with no change, though I may not have understood correctly what the names should have been
django/publicmapping/Dockerfile
Outdated
@@ -0,0 +1,32 @@ | |||
FROM python:2.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overlaps a good bit with what's in quay.io/azavea/django
. I think that it would be good to use that as the base, or at least split that out as a separate task for the future since this PR is already pretty big.
See: https://github.com/azavea/docker-django/blob/master/Dockerfile-slim.template
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = '1%a60e98ywm#$gl4mcm%s#uxoppc3)t%w+an*gzmujo-v-i07^' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that we can pull it from the environment such that it leaves this setting unset if we forget to populate it:
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
docker-compose.yml
Outdated
- POSTGRES_USER=district_builder | ||
- POSTGRES_PASSWORD=district_builder | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've seen instances of this failing when the service is up because of the missing -U
argument to pg_isready
. Error looks like the following in the logs:
FATAL: role "root" does not exist
FATAL: role "root" does not exist
FATAL: role "root" does not exist
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that I'm seeing this after doing docker-compose up
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw the error, but it didn't appear to affect anything -- I could still fire up a django shell and talk to the database so I thought of it as just an annoying thing. Fixing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appear to be resolved by including `"-U", "district_builder" in the healthcheck command, though it does show up every 15 seconds, matching the healthcheck interval
docker-compose.yml
Outdated
retries: 3 | ||
|
||
redis: | ||
image: redis:3.2.11-alpine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can shorten this to 3.2-alpine
, although, would be great to get rid of Redis in the future if we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to use redis here I think, I just did because the project used redis previously. Do you mean it would be good to switch to memcached, or it would be good not to have to depend on a cache at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're actually not using Redis as a cache, but rather as key/value storage for adjacency information, which is used in a single, and rarely used, calculator. If we can find an alternate efficient way to perform that calculation, then Redis can be eliminated as a dependency. At this stage, we can probably just ignore dealing with Redis completely if we just don't use that calculator in any testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment was mostly from the perspective of eliminating an architectural component. I'm cool with keeping it out for now based on Kenny's explanation.
This was a large set of changes, so possibly something to do as a follow-up task based on how many points were allocated, but I think that it would be good to get the STRTA setup going before other people start picking this up. This commit is a good place to start from. It has way more that necessary, so I'd focus on only the Vagrant, Ansible, |
A couple more things that I noticed once I got the docker containers building:
|
I think we talked about not doing the Vagrant + docker setup that we normally do to decrease friction with community contributors. Am I remembering that wrong? |
The warning about client/server version mismatches from |
re: Docker only vs. Vagrant + Docker -- there was some discussion, but I don't think there was ever a definitive decision. We'll need to talk it through. |
My vote would be to include the Vagrant based Docker setup with STRTA scripts for internal consistency. Others can choose to make use of that framework, or not. Even if they don't, I think it would be valuable to surface the steps we take to get a development environment going in code. I also think that including the scripts helps minimize the documentation burden (run |
Modern django makes a gitignore for you, but the application root gitignore didn't know about it, which is why there was so much in the original diff
Ok scripts are in a place where you can |
- { role: "district-builder.environment" } | ||
- { role: "azavea.python-security" } | ||
- { role: "district-builder.docker" } | ||
- { role: "district-builder.aws-cli" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption is that we're going to include AWS integration in the repo, but if that's not the case and we're just going to have containers and handle deployment of those containers separately, this can be removed. Currently the aws cli isn't being used for anything so it's a no-cost deletion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep it out for now.
Is STRTA some internal Azavea convention? Is there any major work left before this considered just about merge ready? I'm eyeing a good point to take another stab at contributing a habitat plan. I think y'all will loooove what it does, it can render all the other debates moot. |
It's not us, it's short for "scripts to rule them all": https://github.com/github/scripts-to-rule-them-all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good start. Merging this should help unblock others to see about upgrading the other components.
- { role: "district-builder.environment" } | ||
- { role: "azavea.python-security" } | ||
- { role: "district-builder.docker" } | ||
- { role: "district-builder.aws-cli" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep it out for now.
deployment/ansible/group_vars/all
Outdated
@@ -0,0 +1,7 @@ | |||
--- | |||
|
|||
aws_cli_version: "1.11.*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with the removal of these two.
scripts/update
Outdated
#!/bin/bash | ||
set -e | ||
|
||
if [[ -n "${RF_DEBUG}" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale variable name here.
scripts/test
Outdated
#!/bin/bash | ||
set -e | ||
|
||
if [[ -n "${RF_DEBUG}" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale variable name here too.
Overview
This PR takes steps toward having a working local instance of the application.
Its main actions are:
django.core.cache
and the{% static ... %}
interpolator)CACHES
section for the cache, e.g.)It's huge, and therefore pretty much impossible to test completely.
In the application's current state, you can hit the landing page and all of the links appear to work, but trying to do (basically) anything fails. Pretty much the only thing that works is that you can try to log in as a guest, and then the app will successfully tell you that you've failed to login (:fire:). This prevents exercising some of the application's features.
Notes
The "spread firefox support" button seems not to exist anywhere in mozilla anymore. I didn't remove it because I wasn't sure if we wanted to go hunting for a replacement.
There are a few things that I either haven't exercised or haven't fixed:
gettext
isn't working at all. That seems really bad! (Fix translations #459)No reverse lookup found
or believe they have syntax errors in the templates or who knows what else. Digging through template inheritance seemed like a possible black hole (Dig through template inheritance to fix lookups #460)Testing
docker-compose up
docker-compose exec django bash
./manage.py shell
./manage.py dbshell
\d
\d redistricting_district
localhost:8080
gettext
isCloses (or at least convincingly starts on) #455
Closes #458