kopia lustrzana https://github.com/OpenDroneMap/WebODM
Build postgres + postgis from source
rodzic
761652f14a
commit
00bda1f7eb
|
@ -76,7 +76,7 @@ class Migration(migrations.Migration):
|
|||
('options', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}, help_text='Options that are being used to process this task', validators=[app.models.validate_task_options])),
|
||||
('console_output', models.TextField(blank=True, default='', help_text="Console output of the OpenDroneMap's process")),
|
||||
('ground_control_points', models.FileField(blank=True, help_text='Optional Ground Control Points file to use for processing', null=True, upload_to=app.models.gcp_directory_path)),
|
||||
('orthophoto', models.CharField(blank=True, help_text='Orthophoto created by OpenDroneMap', null=True, max_length=1)),
|
||||
('orthophoto', django.contrib.gis.db.models.RasterField(blank=True, help_text='Orthophoto created by OpenDroneMap', null=True, srid=4326)),
|
||||
('created_at', models.DateTimeField(default=django.utils.timezone.now, help_text='Creation date')),
|
||||
('pending_action', models.IntegerField(blank=True, choices=[(1, 'CANCEL'), (2, 'REMOVE'), (3, 'RESTART')], db_index=True, help_text='A requested action to be performed on the task. The selected action will be performed by the scheduler at the next iteration.', null=True)),
|
||||
('processing_node', models.ForeignKey(blank=True, help_text='Processing node assigned to this task (or null if this task has not been associated yet)', null=True, on_delete=django.db.models.deletion.CASCADE, to='nodeodm.ProcessingNode')),
|
||||
|
|
111
db/Dockerfile
111
db/Dockerfile
|
@ -1,24 +1,101 @@
|
|||
FROM postgres:9.5
|
||||
FROM ubuntu:20.04
|
||||
MAINTAINER Piero Toffanin <pt@masseranolabs.com>
|
||||
|
||||
ENV POSTGRES_PASSWORD postgres
|
||||
|
||||
# Build PostGIS from source
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends wget gcc build-essential libproj-dev libgeos-dev libpq-dev libxml2-dev postgresql-server-dev-9.5 && \
|
||||
mkdir /staging && \
|
||||
cd /staging && \
|
||||
wget --no-check-certificate -q https://download.osgeo.org/postgis/source/postgis-2.3.0.tar.gz && \
|
||||
tar -zxvf postgis-2.3.0.tar.gz && \
|
||||
cd postgis-2.3.0 && \
|
||||
./configure --without-raster && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd / && \
|
||||
rm -fr /staging && \
|
||||
apt-get remove -y gcc build-essential postgresql-server-dev-9.5 wget && \
|
||||
apt-get clean
|
||||
# Setup system
|
||||
RUN apt-get update
|
||||
RUN set -eux; \
|
||||
groupadd -r postgres --gid=999; \
|
||||
useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
|
||||
mkdir -p /var/lib/postgresql; \
|
||||
chown -R postgres:postgres /var/lib/postgresql
|
||||
|
||||
# grab gosu for easy step-down from root
|
||||
# https://github.com/tianon/gosu/releases
|
||||
ENV GOSU_VERSION 1.12
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends wget; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
|
||||
wget --no-check-certificate -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
|
||||
chmod +x /usr/local/bin/gosu; \
|
||||
gosu --version; \
|
||||
gosu nobody true
|
||||
|
||||
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends locales; \
|
||||
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||
ENV LANG en_US.utf8
|
||||
|
||||
RUN mkdir /docker-entrypoint-initdb.d
|
||||
|
||||
ENV PG_MAJOR 9.5
|
||||
ENV PG_VERSION 9.5.25
|
||||
ENV POSTGIS_VERSION 2.3.0
|
||||
ENV PATH $PATH:/usr/local/pgsql/bin
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Build Postgres from source
|
||||
RUN set -ex; \
|
||||
mkdir /staging; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends wget gcc build-essential libproj-dev libgeos-dev libxml2-dev; \
|
||||
cd /staging; \
|
||||
wget --no-check-certificate -q https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.gz
|
||||
|
||||
RUN set -ex; \
|
||||
cd /staging; \
|
||||
tar -zxf postgresql-$PG_VERSION.tar.gz; \
|
||||
cd postgresql-$PG_VERSION; \
|
||||
./configure --without-readline --without-zlib; \
|
||||
make -j$(nproc); \
|
||||
make install; \
|
||||
postgres --version
|
||||
|
||||
RUN set -eux; \
|
||||
sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/pgsql/share/postgresql.conf.sample; \
|
||||
grep -F "listen_addresses = '*'" /usr/local/pgsql/share/postgresql.conf.sample
|
||||
|
||||
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||
|
||||
ENV PGDATA /var/lib/postgresql/data
|
||||
# this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
|
||||
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
|
||||
VOLUME /var/lib/postgresql/data
|
||||
|
||||
# Build PostGIS from source
|
||||
RUN set -ex; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends libgdal-dev libjson-c-dev; \
|
||||
cd /staging; \
|
||||
wget --no-check-certificate -q https://download.osgeo.org/postgis/source/postgis-$POSTGIS_VERSION.tar.gz; \
|
||||
wget --no-check-certificate -q -O /usr/include/json-c/json_object_private.h https://raw.githubusercontent.com/json-c/json-c/json-c-0.13/json_object_private.h; \
|
||||
tar -zxf postgis-$POSTGIS_VERSION.tar.gz; \
|
||||
sed -i 's/#error.*/#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1/' /usr/include/proj_api.h
|
||||
|
||||
RUN set -ex; \
|
||||
cd /staging/postgis-$POSTGIS_VERSION; \
|
||||
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config; \
|
||||
make -j$(nproc); \
|
||||
make install; \
|
||||
cd /; \
|
||||
rm -fr /staging; \
|
||||
apt-get remove -y gcc build-essential wget; \
|
||||
apt-get clean; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
STOPSIGNAL SIGINT
|
||||
|
||||
EXPOSE 5432
|
||||
COPY init.sql /docker-entrypoint-initdb.d/init-db.sql
|
||||
RUN chmod 644 /docker-entrypoint-initdb.d/init-db.sql
|
||||
|
||||
EXPOSE 5432
|
||||
CMD ["postgres"]
|
|
@ -1,3 +1,4 @@
|
|||
ALTER USER postgres PASSWORD 'postgres';
|
||||
CREATE DATABASE webodm_dev;
|
||||
CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
ALTER DATABASE webodm_dev SET postgis.gdal_enabled_drivers TO 'GTiff';
|
||||
ALTER DATABASE webodm_dev SET postgis.enable_outdb_rasters TO True;
|
||||
|
|
Ładowanie…
Reference in New Issue