ncarlier / feedpushr

A simple feed aggregator daemon with sugar on top.
GNU General Public License v3.0
346 stars 26 forks source link

How to load the database file from host for Docker installation? #49

Closed windware-ono closed 2 years ago

windware-ono commented 2 years ago

I'm trying to run this via docker compose but I'm not sure how I can achieve this to bind mount the database file (and the .htpasswd file) from the host. Otherwise all the data gets wiped after down and up.

ncarlier commented 2 years ago

Hi, you can mount a volume on the host. Example:

feedpushr:
    image: "ncarlier/feedpushr:latest"
    restart: always
    working_dir: /var/opt/feedpushr
    environment:
      - FP_LOG_LEVEL=info
    volumes:
      - /var/opt/feedpushr:/var/opt/feedpushr

Regards

windware-ono commented 2 years ago

Sorry I was specifying the FP_DB environment variable in a wrong format without the boltdb:// prefix.

Now it's working with a custom path.

volumes:
  - /opt/feedpushr/data.db:/data.db
environment:
  - FP_DB=boltdb:///data.db

However, .htpasswd doesn't seem to work the same way by providing the following with filled in htpasswd file but no authentication is asked, but am I doing it wrong?

volumes:
  - /opt/feedpushr/htpasswd:/htpasswd
environment:
  - FP_AUTHN=/htpasswd
ncarlier commented 2 years ago

It should... You can declare only one volumes section in a compose file. To simplify things, I suggest that you simply mount your hosts directory (opt/feedpushr) and leave the default configuration :

feedpushr:
    image: "ncarlier/feedpushr:latest"
    restart: always
    working_dir: /var/opt/feedpushr
    environment:
      - FP_LOG_LEVEL=debug
    volumes:
      - /opt/feedpushr:/var/opt/feedpushr

If you do so, your password file should be located here on your host: /opt/feedpushr/.htpasswd

windware-ono commented 2 years ago

Thank you for quick replies.

That configuration seems to have loaded both the data.db as well as .htaccess but somehow the credential placed in the /opt/feedpushr/.htaccess doesn't work when asked in the browser.

I also wanted the whole site to be password protected instead of just the API calls, so I went onto put basic auth in the reverse proxy web server in front of feedpushr.

ncarlier commented 2 years ago

What do you mean by "does not work"? There is no prompt for basic authentication or the password does not work? If the password doesn't work, please make sure that you used htpasswd with BCRYPT parameter: -B:

# Example
$ htpasswd -B -c .htpasswd test
windware-ono commented 2 years ago

I meant as in the prompt does show up but the credential doesn't work. It worked by providing -B flag to htpasswd command. Thanks. However, as I've written in the last reply, since this feature doesn't password protect the page but API calls, I've resorted to using reverse proxy basic auth.