api-umbrella icon indicating copy to clipboard operation
api-umbrella copied to clipboard

No way to persist settings in Docker

Open andybeak opened this issue 6 years ago • 3 comments
trafficstars

I'm using docker-compose with the config as below.

There does not seem to be a way to persist the configuration of the container. When I use the volume mounting that the documentation gives at https://apiumbrella.io/install/ the mount is empty.

If I run bash on the container I can see that there is no /etc/api-umbrella directory, but there is an /opt/api-umbrella//etc directory.

Is this perhaps a mistake in the documentation? How is it possible to persist configuration like API backends and users between instances of the container?

version: '3'

services:
  umbrella:
    image: nrel/api-umbrella
    restart: always
    container_name: api-umbrella
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./config/:/etc/api-umbrella

networks:
  default:
    external:
      name: client_api

andybeak avatar Apr 08 '19 12:04 andybeak

I am also looking into this. We need to persist data during development or, is it suggested that we should install this in a "staging" env then the local dev will point into that?

jsdecena avatar Apr 16 '19 23:04 jsdecena

@jsdecena I took another look at this today.

Mounting the volumes that are in the docker file (https://github.com/NREL/api-umbrella/blob/master/docker/Dockerfile) with docker-compose seems to yield good results.

So far I've only tested that my admin user and an API user I create are persisted, but I'm hoping the backends will be too. I've confirmed that stopping the container and rebuilding the image from scratch keeps these settings.

I'm not going to bother trying to persist the frontend site because I use something else to document my API.

version: '3'

services:
  umbrella:
    image: nrel/api-umbrella
    restart: always
    container_name: api-umbrella
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./db:/opt/api-umbrella/var/db
      - ./log:/opt/api-umbrella/var/log

networks:
  default:
    external:
      name: client_api

andybeak avatar Apr 23 '19 16:04 andybeak

I've also tested this with named volumes and NFS volumes and works well.

vegasbrianc avatar May 29 '19 16:05 vegasbrianc