There has been some confusion after we switched the Docker images to use
a non-root user. It's now fairly easy for permissions to be set
incorrectly.
This line in the example script should make things right.
By default, all Pelias images now have a user called `pelias` with UID
1000. However, running as a different UID may be best for different
people.
By setting the default in `.env` and using it in `docker-compose.yml`,
we can allow people running Pelias to use whatever non-root user is best
for them.
Connects https://github.com/pelias/baseimage/pull/2
Connects https://github.com/pelias/pelias/issues/745
NPM can cause issues when running in docker containers, such as:
- requiring write access to the root filesystem and printing a large
annoying warning if it doesn't have it
- not passing signals on to process it starts, making it take longer to
gracefully kill containers
Now that all our Docker images have their own `start` and `download`
scripts to serve as more reliable entrypoints, we can remove all calls
to `npm` by the `pelias` script.
Connects https://github.com/pelias/pelias/issues/745
This image, from [pelias/libpostal-service](https://github.com/pelias/libpostal-service)
gives us a bit more control and consistency over how the
libpostal-service is run.
Benefits include:
- smaller download footprint since it shares the
pelias/libpostal_baseimage download with the interpolation service
- non-root `pelias` user and other features common to pelias/baseimage
- default port number consistent with other Pelias services
The document service originally became part of this repository because
it was used in a Mapzen demo/workshop some time ago as a more convenient
way to index documents for custom importers.
While it could be useful, it isn't currently supported and is not used
in this repository. By removing it from all the docker-compose.yml
files, we can reduce the size of downloaded Docker images.
We have some settings hanging around our docker-compose.yml files that
are hanging around from when we did things quite differently.
Previously, we built the libpostal_baseimage image directly as part of
our Docker setup projects. This required setting it as a "dependency" of
other images. That's no longer required, and having that `dependency`
setting is causing an extra container to be launched, after which it
does nothing and shuts down.
Additionaly, we used to store libpostal training data in a separate
filesystem. It's now baked into the `libpostal_baseimage` image, so all
those settings are no longer required.
NPM creates an extra layer of processes in containers which [do not
properly forward signals](https://github.com/npm/npm/issues/4603). This
can cause problems starting/stopping containers quickly.
Additionally NPM tries to write to the filesystem as part of its
self-update check. We would like to move to read only root container
filesystems (using `read_only: true` in docker-compose.yml), so the
easiest way to work around this NPM "feature" is to avoid using NPM.