Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to persist settings in Docker #451

Open
andybeak opened this issue Apr 8, 2019 · 3 comments
Open

No way to persist settings in Docker #451

andybeak opened this issue Apr 8, 2019 · 3 comments

Comments

@andybeak
Copy link

andybeak commented Apr 8, 2019

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
Copy link

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
Copy link
Author

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants