Skip to content

Commit

Permalink
Merge pull request #1853 from SEED-platform/meters
Browse files Browse the repository at this point in the history
Meters
  • Loading branch information
nllong committed May 6, 2019
2 parents 410f0ba + ea61ad1 commit af71f64
Show file tree
Hide file tree
Showing 81 changed files with 20,703 additions and 1,536 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"protractor": true,
"qq": true,
"saveAs": true,
"Spinner": true
"Spinner": true,
"Terraformer": true
},
"plugins": ["angular", "lodash", "protractor"],
"rules": {
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ htmlcov/
src/
node_modules/

# JetBrainz tends to suggest a venv directory in the project root for virtual environments
# JetBrains tends to suggest a venv directory in the project root for virtual environments
venv/

package-lock.json
dump.rdb
log/*.log
*.log
Expand Down
26 changes: 17 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
sudo: required
dist: trusty
group: deprecated-2017Q4
dist: xenial
cache:
directories:
- node_modules
Expand All @@ -10,37 +9,46 @@ cache:
- ".tox"
language: python
python:
- 3.6
- "3.6"
addons:
postgresql: '9.6'
chrome: stable
postgresql: "11.2"
apt:
packages:
- enchant
- google-chrome-stable
- gdal-bin
- postgresql-9.6-postgis-2.3
services:
- docker
- redis-server
- postgresql
- xvfb
before_install:
- sudo apt-get update
- sudo apt-get remove -y postgresql\*
- sudo apt-get install -y postgresql-11 postgresql-client-11
- sudo apt-get install -y postgis postgresql-11-postgis-2.5 postgresql-11-postgis-2.5-scripts
- sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf
- sudo service postgresql restart 11
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
install:
- pip install --upgrade pip
- pip install tox==2.7.0
- psql --version
- node --version
- npm --version
- nvm install stable
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start &
- sleep 3
- psql -c "DROP DATABASE IF EXISTS seeddb;" -U postgres
- psql -c "DROP DATABASE IF EXISTS test_seeddb;" -U postgres
- mv config/settings/test_local_untracked.py config/settings/local_untracked.py
- sudo add-apt-repository ppa:timescale/timescaledb-ppa -y
- sudo apt-get update -q
- sudo apt-get install -y timescaledb-postgresql-11 timescaledb-tools
- sudo timescaledb-tune -yes
- sudo service postgresql restart
- psql -c "CREATE DATABASE seeddb;" -U postgres
- psql -d seeddb -c "CREATE EXTENSION postgis;" -U postgres
env:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SEED Version 2.6.0

2.6.0-beta includes support for meters and time series data storage. In order to use this release, you must first install [timescaledb](https://docs.timescale.com/v1.2/getting-started). Note that this is a Beta release and should not be used on production datasets until we have completed testing.

# SEED Version 2.5.2

Date Range: 04/15/19 - 05/04/19
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = function (grunt) {
files: ['seed/static/seed/js/**/*.js', '!seed/static/seed/js/decorators/**/*.js', '!seed/static/seed/js/seed.js'],
options: {
lazy: true,
basePath: "protractorInstrumented"
basePath: 'protractorInstrumented'
}
},
copy: {
Expand Down
2 changes: 1 addition & 1 deletion bin/protractor_start_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# starts local server and create test user for protractor tests

echo "updating webdriver"
./node_modules/protractor/bin/webdriver-manager update
./node_modules/.bin/webdriver-manager update --gecko=false
echo "migrating"
./manage.py migrate &> tox_migrate.log
echo "creating default user"
Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ else
docker swarm init
fi

echo "Building lasest version of SEED"
echo "Building latest version of SEED"
# explicitly pull images from docker-compose. Note that you will need to keep the
# versions consistent between the compose file and what is below.
docker-compose pull
docker-compose build --pull

echo "Tagging local containers"
docker tag seedplatform/seed:latest 127.0.0.1:5000/seed
docker tag seedplatform/postgres-seed:11.1 127.0.0.1:5000/postgres-seed
docker tag seedplatform/postgres-seed:11.2 127.0.0.1:5000/postgres-seed
docker tag redis:5.0.1 127.0.0.1:5000/redis
docker tag seedplatform/oep:1.2 127.0.0.1:5000/oep

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
version: '3'
services:
db-postgres:
image: seedplatform/postgres-seed:11.1
image: seedplatform/postgres-seed:11.2
build:
context: ./docker/postgres
environment:
Expand Down
23 changes: 16 additions & 7 deletions docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
FROM postgres:11.1
FROM postgres: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 \
&& rm -rf /var/lib/apt/lists/*
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
COPY ./initdb-timescaledb.sh /docker-entrypoint-initdb.d/timescaledb.sh
COPY ./update-postgis.sh /usr/local/bin
6 changes: 3 additions & 3 deletions docker/postgres/initdb-postgis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ EOSQL

# Load PostGIS into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
EOSQL
done
6 changes: 6 additions & 0 deletions docker/postgres/initdb-timescaledb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e

timescaledb-tune -conf-path /var/lib/postgresql/data/postgresql.conf -quiet -yes
service postgresql restart
5 changes: 4 additions & 1 deletion docs/source/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ Install the following base packages to run SEED:

.. code-block:: console
sudo add-apt-repository ppa:timescale/timescaledb-ppa
sudo apt update
sudo apt upgrade
sudo apt install libpq-dev python3-dev python3-pip libatlas-base-dev \
gfortran build-essential nodejs npm libxml2-dev libxslt1-dev git \
libssl-dev libffi-dev curl uwsgi-core uwsgi-plugin-python mercurial
sudo apt install redis-server
sudo apt install postgresql postgresql-contrib
sudo apt install timescaledb-postgresql-10 postgresql-contrib
.. note:: postgresql ``>=9.3`` is required to support `JSON Type`_
Expand All @@ -43,6 +44,8 @@ default use password `seedpass` when prompted

.. code-block:: console
$ sudo timescaledb-tune
$ sudo service postgresql restart
$ sudo su - postgres
$ createuser -P "seeduser"
$ createdb "seeddb" --owner="seeduser"
Expand Down
38 changes: 36 additions & 2 deletions docs/source/migrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,41 @@ Migrations

Django handles the migration of the database very well; however, there are various changes to SEED that may require some custom (manual) migrations. The migration documenation includes the required changes based on deployment and development for each release.

Version 2.5.1
Version 2.6.0
------------------

Version 2.6.0 includes support for meters and time series data storage. In order to use this release
you must first install [timescaledb](https://docs.timescale.com/v1.2/getting-started).

Docker-based Deployment
^^^^^^^^^^^^^^^^^^^^^^^
Docker-based deployments shouldn't require running any additional commands for installation. The
timescaledb installation will happen automatically when updating the postgres container. Also,
the installation of the extension occurs in a Django migration.

Ubuntu
^^^^^^

.. code-block:: console
sudo add-apt-repository ppa:timescale/timescaledb-ppa
sudo apt update
sudo apt install timescaledb-postgresql-10
sudo timescaledb-tune
sudo service postgresql restart
Max OSX
^^^^^^^

.. code-block:: console
brew tap timescale/tap
brew install timescaledb
/usr/local/bin/timescaledb_move.sh
timescaledb-tune
brew services restart postgresql
Version 2.5.2
-------------

- There are no manual migratios that are needed. The `./manage.py migrate` command may take awhile
Expand All @@ -22,7 +56,7 @@ Docker-based Deployment
^^^^^^^^^^^^^^^^^^^^^^^

- Add the MapQuest API key to your organization.
- On deployment, the error below is indicative that you need to install the extensions in the postgres database. Run `docker exec <posgres_container_id> update-postgis.sh`.
- On deployment, the error below is indicative that you need to install the extensions in the postgres database. Run `docker exec <postgres_container_id> update-postgis.sh`.

django.db.utils.OperationalError: could not open extension control file "/usr/share/postgresql/11/extension/postgis.control": No such file or directory

Expand Down
2 changes: 0 additions & 2 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Modules
modules/seed.data
modules/seed.data_importer
modules/seed.features
modules/seed.green_button
modules/seed.landing
modules/seed.lib
modules/seed.mappings
Expand All @@ -22,4 +21,3 @@ Modules
modules/seed.urls
modules/seed.utils
modules/seed.views

29 changes: 0 additions & 29 deletions docs/source/modules/seed.green_button.rst

This file was deleted.

22 changes: 0 additions & 22 deletions docs/source/modules/seed.green_button.tests.rst

This file was deleted.

54 changes: 54 additions & 0 deletions docs/source/setup_osx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ready for general development. If this is not the case, skip to Prerequisites.

* install Postgres 11.1 and redis for cache and message broker
* install PostGIS 2.5 and enable it on the database using `CREATE EXTENSION postgis;`
* install TimescaleDB
* use a virtualenv (if desired)
* `git clone git@github.com:seed-platform/seed.git`
* create a `local_untracked.py` in the `config/settings` folder and add CACHE and DB config (example `local_untracked.py.dist`)
Expand Down Expand Up @@ -149,6 +150,59 @@ MapQuest API Key and set the database engine to 'ENGINE': 'django.contrib.gis.db
Now exit any root environments, becoming just yourself (even though it's not
that easy being green), for the remainder of these instructions.


TimescaleDB 1.2.2
-----------------

Homebrew::

# Add the tap
brew tap timescale/tap

# To install
brew install timescaledb

# Post-install to move files to appropriate place
/usr/local/bin/timescaledb_move.sh

# This involves prompts regarding 1 required setting change and several optional optimizations for PostgreSQL
timescaledb-tune

# Restart PostgreSQL instance
brew services restart postgresql


Downloading From Source::

# Note: Installing from source should only be done
# if you have a Postgres installation not maintained by Homebrew.
# This installation requires C compiler (e.g., gcc or clang) and CMake version 3.4 or greater.

git clone https://github.com/timescale/timescaledb.git
cd timescaledb
git checkout <release_tag> # e.g., git checkout 1.2.2

# Bootstrap the build system
./bootstrap

# If OpenSSL can't be found by cmake - run the following instead
# ./bootstrap -DOPENSSL_ROOT_DIR=<location of OpenSSL> # e.g., -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl

# To build the extension
cd build && make

# To install
make install

# Find postgresql.conf
# Then uncomment the shared_preload_libraries line changing it to the following
# shared_preload_libraries = 'timescaledb'
psql -d postgres -c "SHOW config_file;"

# Restart PostgreSQL instance



Python Packages
---------------

Expand Down

0 comments on commit af71f64

Please sign in to comment.