NREL / api-umbrella

Open source API management platform
http://apiumbrella.io
MIT License
2.01k stars 324 forks source link

No way to persist settings in Docker #451

Open andybeak opened 5 years ago

andybeak commented 5 years ago

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
jsdecena commented 5 years ago

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?

andybeak commented 5 years ago

@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
vegasbrianc commented 5 years ago

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