diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 52755a39..00000000 --- a/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM ubuntu:18.04 - -RUN apt-get update -y -RUN apt-get upgrade -y - -RUN apt-get install -y build-essential wget -RUN apt-get install parallel -y - -ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait -RUN chmod +x /wait - -RUN mkdir /colouring-london -COPY app /colouring-london/app -COPY migrations /colouring-london/migrations -COPY etl /colouring-london/etl - -ENV NODE_VERSION=16.13.2 -RUN apt-get install -y curl -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash -ENV NVM_DIR=/root/.nvm -RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} -RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} -RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} -ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" - -RUN npm install -g npm@latest - -WORKDIR ./colouring-london/app -RUN rm -rf node_modules -RUN npm install - -EXPOSE 8080 -CMD /wait && npm start \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index ecbe723b..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: "3" -services: - colouring-london: - container_name: colouring-london - build: - context: . - dockerfile: Dockerfile - depends_on: - - db - environment: - DATABASE_URL: postgres://dockeruser:postgres@postgres-colouring-london:5432/colouringlondon - NODE_ENV: development - PORT: 8080 - APP_COOKIE_SECRET: 123456 - ports: - - "8080:8080" - db: - container_name: postgres-colouring-london - image: ubuntu/postgres:13-21.10_beta - ports: - - "5432:5432" - volumes: - - ./postgresdata:/var/lib/postgresql/data - - ./colouring-london/migrations:/colouring-london/migrations - - ./colouring-london/etl:/colouring-london/etl - - ./colouring-london/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh - restart: always - environment: - POSTGRES_USER: dockeruser - POSTGRES_PASSWORD: postgres - POSTGRES_DB: colouringlondon \ No newline at end of file diff --git a/etl/create_building_records_cl.sh b/etl/create_building_records_cl.sh deleted file mode 100644 index 57464bb2..00000000 --- a/etl/create_building_records_cl.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# -# Create corresponding 'building' record with -# id: , -# doc: {}, -# geom_id: -# -psql -d colouringlondon -c "INSERT INTO buildings ( geometry_id, ref_toid ) SELECT geometry_id, source_id from geometries;" diff --git a/etl/load_geometries_cl.sh b/etl/load_geometries_cl.sh deleted file mode 100644 index 81f73ac2..00000000 --- a/etl/load_geometries_cl.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -# -# Load geometries from GeoJSON to Postgres -# - assume postgres connection details are set in the environment using PGUSER, PGHOST etc. -# -: ${1?"Usage: $0 ./path/to/mastermap/dir"} - -mastermap_dir=$1 - -# -# Create 'geometry' record with -# id: , -# source_id: , -# geom: -# -find $mastermap_dir -type f -name '*.3857.csv' \ --printf "$mastermap_dir/%f\n" | \ -parallel \ -cat {} '|' psql -d colouringlondon -c "\"COPY geometries ( geometry_geom, source_id ) FROM stdin WITH CSV HEADER;\"" - -# -# Delete any duplicated geometries (by TOID) -# -psql -d colouringlondon -c "DELETE FROM geometries a USING ( - SELECT MIN(ctid) as ctid, source_id - FROM geometries - GROUP BY source_id - HAVING COUNT(*) > 1 -) b -WHERE a.source_id = b.source_id -AND a.ctid <> b.ctid;" diff --git a/init-user-db.sh b/init-user-db.sh deleted file mode 100644 index 1fdc9417..00000000 --- a/init-user-db.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -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 - -apt-get install -y python3 python3-pip python3-dev - -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 - -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;" - -ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d colouringlondon < $migration; done; - -pip install --upgrade pip -pip install --upgrade setuptools wheel -pip install -r ./colouring-london/etl/requirements.txt - -python ./colouring-london/etl/get_test_polygons.py -./colouring-london/etl/load_geometries_cl.sh ./ -psql -d colouringlondon -U dockeruser < ./colouring-london/app/migrations/002.index-geometries.up.sql -./create_building_records_cl.sh -psql -d colouringlondon -U dockeruser < ./colouring-london/app/migrations/003.index-buildings.up.sql -ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d colouringlondon < $migration; done; \ No newline at end of file