-
Notifications
You must be signed in to change notification settings - Fork 1
Docker
In the Dockerfile for ProtectedPlanet, initially certain packages have been installed from source. The following code block illustrates this:
WORKDIR /gdal
RUN wget http://download.osgeo.org/gdal/2.4.0/gdal-2.4.0.tar.gz
RUN tar -xvf gdal-2.4.0.tar.gz
RUN cd gdal-2.4.0 \
&& ./configure --prefix=/usr \
&& make \
&& make install
Here we download the gdal source code using wget. Then use tar to extract the source code. Then cd into the directory and use the normal build commands for configuring and making the software. Finally we make install the built application.
The reason for manually installing packages from source was due to packages in question not having predefined build scripts in the package managers for the various distros which were initially supported; Ubuntu, Gentoo.
Further to this, there was a technical issue affecting the emerge package on Gentoo Linux due to restrictions on processes running within Docker: https://blogs.gentoo.org/marecki/2017/03/17/gentoo-linux-in-a-docker-container/
There is a more elegant solution for this problem, which was not implemented so far: Kubler https://github.com/edannenberg/kubler
It appears that using Kubler would use the same Gentoo system but would be far superior and more elegant.
For persistence of data, Docker provides volumes. Volumes have many advantages over a simple bind mount, such as:
- backing up or migration
- management of volumes using Docker CLI
- does not increase the size of a Docker container*
*Please note that this is very important, as we don’t wish to increase the size of Docker containers and can store lots of large data inside a volume instead.
This is achieved in the docker-compose.yml like so:
volumes:
protectedplanet_pg_data:
driver: local
protectedplanet_redis_data:
driver: local
protectedplanet_import_data:
driver: local
protectedplanet_es_data:
driver: local
protectedplanet_bundler:
driver: local
So for example, the database docker container, which is using PostGIS, mounts the internal Linux path of /var/lib/postgresql
onto the Docker volume: protectedplanet_pg_data
this is how we do this:
db:
container_name: protectedplanet-db
image: kartoza/postgis
ports:
- "5432:5432"
env_file:
- '.env'
volumes:
- protectedplanet_pg_data:/var/lib/postgresql