Skip to content

Commit

Permalink
Merge pull request #2148 from SEED-platform/bricr-prod
Browse files Browse the repository at this point in the history
BRICR Prod into BRICR Dev
  • Loading branch information
nllong committed Mar 25, 2020
2 parents 4d8a529 + 3807974 commit 8a01627
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 84 deletions.
19 changes: 16 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sudo: required
dist: xenial
cache:
directories:
Expand All @@ -7,6 +6,7 @@ cache:
- "$HOME/.pip-cache/"
- "$HOME/.nvm"
- ".tox"
os: linux
language: python
python:
- "3.6"
Expand All @@ -19,7 +19,7 @@ addons:
- gdal-bin
services:
- docker
- redis-server
- redis
- postgresql
- xvfb
before_install:
Expand Down Expand Up @@ -64,7 +64,7 @@ env:
- TOX_ENV=python
- TOX_ENV=flake8
- TOX_ENV=docs
# - TOX_ENV=functional
# - TOX_ENV=functional # chrome is out of date, fix this eventually.
- TOX_ENV=apitest
script:
- tox -e $TOX_ENV
Expand All @@ -75,3 +75,16 @@ jobs:
before_script: skip
script: travis_wait 30 docker/travis_build_docker.sh
env: DJANGO_SETTINGS_MODULE=config.settings.docker
after_failure:
- echo "Job Failed... Maybe these logs will help?"
- free -tm
- ls -alt ~
- ls -alt /home/travis/build/SEED-platform/seed/
- echo "============================================ celery log ============================================"
- cat /home/travis/build/SEED-platform/seed/celery.log
- echo "============================================ celery console log ============================================"
- cat /home/travis/build/SEED-platform/seed/celery_console.log
- echo "============================================ server log ============================================"
- cat /home/travis/build/SEED-platform/seed/runserver.log
- echo "============================================ syslog ============================================"
- sudo cat /var/log/syslog
70 changes: 41 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,44 @@
# DESCRIPTION: Image with seed platform and dependencies running in development mode
# TO_BUILD_AND_RUN: docker-compose build && docker-compose up

FROM alpine:3.8
# This Dockerfile has been updated to pull from our last known good build of SEED (v2.6.1).
# Version 3.7.2-r2 of geos has introduced and incompatible library:
# https://pkgs.alpinelinux.org/package/edge/testing/x86_64/geos
#FROM alpine:3.8

RUN apk add --no-cache python \
python3-dev \
postgresql-dev \
alpine-sdk \
pcre \
pcre-dev \
libxslt-dev \
linux-headers \
libffi-dev \
bash \
bash-completion \
npm \
nginx && \
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main openssl && \
apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ geos gdal && \
ln -sf /usr/bin/python3 /usr/bin/python && \
python -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
ln -sf /usr/bin/pip3 /usr/bin/pip && \
pip install --upgrade pip setuptools && \
pip install git+https://github.com/Supervisor/supervisor@837c159ae51f3 && \
mkdir -p /var/log/supervisord/ && \
rm -r /root/.cache && \
addgroup -g 1000 uwsgi && \
adduser -G uwsgi -H -u 1000 -S uwsgi && \
mkdir -p /run/nginx && \
echo "daemon off;" >> /etc/nginx/nginx.conf && \
rm -f /etc/nginx/conf.d/default.conf
# Start with 2.6.0. note that the source code will be removed and re-copied to this container. The
# version of SEED here is used to load in the core system packages and dependencies.
FROM seedplatform/seed:2.6.0

# DO NOT UPGRADE until libgeos and shapely fix the connection.
#RUN apk add --no-cache python \
# python3-dev \
# postgresql-dev \
# alpine-sdk \
# pcre \
# pcre-dev \
# libxslt-dev \
# linux-headers \
# libffi-dev \
# bash \
# bash-completion \
# npm \
# nginx && \
# apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main openssl && \
# apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ geos gdal && \
# ln -sf /usr/bin/python3 /usr/bin/python && \
# python -m ensurepip && \
# rm -r /usr/lib/python*/ensurepip && \
# ln -sf /usr/bin/pip3 /usr/bin/pip && \
# pip install --upgrade pip setuptools && \
# pip install git+https://github.com/Supervisor/supervisor@837c159ae51f3 && \
# mkdir -p /var/log/supervisord/ && \
# rm -r /root/.cache && \
# addgroup -g 1000 uwsgi && \
# adduser -G uwsgi -H -u 1000 -S uwsgi && \
# mkdir -p /run/nginx && \
# echo "daemon off;" >> /etc/nginx/nginx.conf && \
# rm -f /etc/nginx/conf.d/default.conf

## Note on some of the commands above:
## - create the uwsgi user and group to have id of 1000
Expand All @@ -41,6 +49,10 @@ RUN apk add --no-cache python \
## - install supervisor that works with Python3.
## - enchant, python-gdbm, libssl-dev, libxml2-dev are no longer explicitly installed

## Remove this line after updating the base image to support the new dependency versions. The line ensures that the
# code is only this branch, not any remnants from the tagged container.
RUN rm -rf /seed/

### Install python requirements
WORKDIR /seed
COPY ./requirements.txt /seed/requirements.txt
Expand Down
60 changes: 39 additions & 21 deletions config/settings/travis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from config.settings.test import * # noqa

# Travis uses a passwordless database
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
Expand All @@ -19,27 +20,44 @@
}
}

# if 'test' in sys.argv:
# # Skip migrations to make testing faster
# MIGRATION_MODULES = {
# 'auth': None,
# 'contenttypes': None,
# 'default': None,
# 'sessions': None,
#
# 'core': None,
# 'profiles': None,
# 'snippets': None,
# 'scaffold_templates': None,
# }

TESTING_MAPQUEST_API_KEY = os.environ.get("TESTING_MAPQUEST_API_KEY")

CACHES = {
'default': {
'BACKEND': 'redis_cache.cache.RedisCache',
'LOCATION': "127.0.0.1:6379",
'OPTIONS': {'DB': 1},
'TIMEOUT': 300
}
# Setup the logging specific to Travis
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler'
},
'console-debug': {
'level': 'DEBUG',
'class': 'logging.StreamHandler'
},
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'runserver.log',
},
'celery': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'celery.log',
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
},
'django.db.backends': {
'level': 'INFO',
'handlers': ['file']
},
'celery': {
'handlers': ['celery'],
'level': 'DEBUG',
}
},
}
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ services:
options:
max-size: 50m
max-file: '5'
oep-city-1:
#oep-city-1:
# This is a placeholder. If needed, follow the instructions to enable: https://cloud.docker.com/u/seedplatform/repository/docker/seedplatform/oep
image: seedplatform/oep:1.2
depends_on:
- web
environment:
- OEP_DISABLED=true
logging:
options:
max-size: 50m
max-file: '5'
# image: seedplatform/oep:1.4
# depends_on:
# - web
# environment:
# - OEP_DISABLED=true
# logging:
# options:
# max-size: 50m
# max-file: '5'
volumes:
seed_pgdata:
external: true
Expand Down
37 changes: 19 additions & 18 deletions docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
FROM postgres:11.2
FROM seedplatform/postgres-seed:11.2

ENV POSTGIS_MAJOR 2.5
ENV POSTGIS_VERSION 2.5.2+dfsg-1~exp1.pgdg90+1

RUN apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION \
apt-transport-https ca-certificates wget && \
rm -rf /var/lib/apt/lists/*

RUN sh -c "echo 'deb https://packagecloud.io/timescale/timescaledb/debian/ `lsb_release -c -s` main' > /etc/apt/sources.list.d/timescaledb.list" && \
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add - && \
apt-get update && \
apt-get install -y timescaledb-postgresql-$PG_MAJOR && \
apt-get purge -y --auto-remove apt-transport-https ca-certificates wget && \
rm -rf /var/lib/apt/lists/*
# Use the old image that has been pushed until we update dependencies!
#ENV POSTGIS_MAJOR 2.5
#ENV POSTGIS_VERSION 2.5.2+dfsg-1~exp1.pgdg90+1
#
#RUN apt-get update && \
# apt-get install -y --no-install-recommends \
# postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
# postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
# postgis=$POSTGIS_VERSION \
# apt-transport-https ca-certificates wget && \
# rm -rf /var/lib/apt/lists/*
#
#RUN sh -c "echo 'deb https://packagecloud.io/timescale/timescaledb/debian/ `lsb_release -c -s` main' > /etc/apt/sources.list.d/timescaledb.list" && \
# wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add - && \
# apt-get update && \
# apt-get install -y timescaledb-postgresql-$PG_MAJOR && \
# apt-get purge -y --auto-remove apt-transport-https ca-certificates wget && \
# rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
Expand Down
4 changes: 1 addition & 3 deletions seed/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import time
from unittest import skip

from datetime import date

from django.core.urlresolvers import reverse_lazy, reverse
from django.test import TestCase
from django.utils import timezone
Expand Down Expand Up @@ -171,7 +169,7 @@ def test_organization(self):
self.assertEqual(r['organizations'][0]['owners'][0]['first_name'], 'Jaqen')
self.assertEqual(r['organizations'][0]['cycles'], [
{
'name': str(date.today().year - 1) + ' Calendar Year',
'name': '2019 Calendar Year',
'num_properties': 0,
'num_taxlots': 0,
'cycle_id': self.default_cycle.pk,
Expand Down

0 comments on commit 8a01627

Please sign in to comment.