2022-02-08 05:31:54 -05:00
|
|
|
#!/bin/bash
|
2022-02-11 06:45:03 -05:00
|
|
|
apt-get update -y
|
|
|
|
apt-get upgrade -y
|
|
|
|
|
|
|
|
apt-get install -y postgresql-contrib libpq-dev postgis
|
|
|
|
apt-get install -y postgresql-13-postgis-3
|
|
|
|
apt-get install -y gdal-bin libspatialindex-dev libgeos-dev libproj-dev
|
2022-02-08 09:05:12 -05:00
|
|
|
|
2022-02-11 06:57:48 -05:00
|
|
|
apt-get install -y python3 python3-pip python3-dev python3-venv
|
|
|
|
|
2022-02-11 06:45:03 -05:00
|
|
|
psql -d colouringlondon -U dockeruser -c "SELECT 1 FROM pg_user WHERE usename = 'dockeruser';" | grep -q 1 || psql -d colouringlondon -U dockeruser -c "CREATE ROLE dockeruser SUPERUSER LOGIN PASSWORD 'postgres';"
|
|
|
|
psql -d colouringlondon -U dockeruser -c "SELECT 1 FROM pg_database WHERE datname = 'colouringlondon';" | grep -q 1 || -u postgres createdb -E UTF8 -T template0 --locale=en_US.utf8 -O dockeruser colouringlondon
|
2022-02-08 05:31:54 -05:00
|
|
|
|
2022-02-11 10:41:25 -05:00
|
|
|
psql -d colouringlondon -U dockeruser -c "create extension postgis;"
|
|
|
|
psql -d colouringlondon -U dockeruser -c "create extension pgcrypto;"
|
|
|
|
psql -d colouringlondon -U dockeruser -c "create extension pg_trgm;"
|
2022-02-08 05:31:54 -05:00
|
|
|
|
2022-02-08 05:48:36 -05:00
|
|
|
ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d colouringlondon < $migration; done;
|
|
|
|
|
|
|
|
pyvenv colouringlondon
|
|
|
|
source colouringlondon/bin/activate
|
|
|
|
pip install --upgrade pip
|
|
|
|
pip install --upgrade setuptools wheel
|
|
|
|
pip install -r ./colouring-london/etl/requirements.txt
|
|
|
|
|
2022-02-11 06:55:46 -05:00
|
|
|
python ./colouring-london/etl/get_test_polygons.py
|
|
|
|
./colouring-london/etl/load_geometries_cl.sh ./
|
2022-02-11 10:41:25 -05:00
|
|
|
psql -d colouringlondon -U dockeruser < ./colouring-london/app/migrations/002.index-geometries.up.sql
|
2022-02-08 05:48:36 -05:00
|
|
|
./create_building_records_cl.sh
|
2022-02-11 10:41:25 -05:00
|
|
|
psql -d colouringlondon -U dockeruser < ./colouring-london/app/migrations/003.index-buildings.up.sql
|
2022-02-08 05:31:54 -05:00
|
|
|
ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d colouringlondon < $migration; done;
|