ckulka/baikal-docker

Exposing local directories for all directories within /var/www/baikal/

Closed this issue · 5 comments

As the title says, I've tried mapping ./www to /var/www and creaeting all the directories manually, and applying the same permissions that are in the example docker-compose.yml file to all the folders, but when I spin the container up it doesn't work.

The reason I need to do this is I need to edit the .htaaccess file (for remapping the default iPhone CardDAV value) within the html directory, but my container doesn't have vim, vi, nano, or any other text editor installed, installing them is on face value a PITA, and I would much rather map everything to a local directory for future config changes if required.

Hi @Sloshy1, just to make sure I understand your scenario correctly: you only need to modify the /var/www/baikal/html/.htaccess file?

First off, installing an editor inside the container is not only a PITA, editing the file won't work permanently. That's because every time you recreate the container, e.g. during upgrades, the change would be lost again. I can explain why in more detail, let me know if it's unclear.

I would recommend mounting just that modified file into the container and not the entire /var/www/baikal folder, for example based on examples/docker-compose.localvolumes.yaml:

version: '2'
services:
  baikal:
    image: ckulka/baikal:nginx
    restart: always
    ports:
      - "80:80"
    volumes:
      - ./config:/var/www/baikal/config
      - ./data:/var/www/baikal/Specific
      # Mount your modified .htaccess file
      - ./my.htaccess:/var/www/baikal/html/.htaccess

My main reason is that you then don't have to worry about all the other files in the /var/www/baikal folder, especially when later upgrading to a newer version.

If you really (for other reasons) want to mount everything of /var/www/baikal from a local directory, you'll have to

  1. Copy the Baikal files from the Docker image into your local directory
  2. Fix file permissions
  3. Add the mount in the Docker Compose file
  4. Repeat every time you upgrade to a newer version
# Step 1: create the local directory and get the Baikal files
mkdir /my/local/directory
docker run --rm -it -v /my/local/directory:/tmp ckulka/baikal cp -R /var/www/baikal /tmp

# Step 2: fix file permissions (Nginx)
chown -R 101:101 /my/local/directory

# Step 2: fix file permissions (Apache)
chown -R 33:33 /my/local/directory

Let me know if that helps 👍

That's because every time you recreate the container, e.g. during upgrades, the change would be lost again.

I hadn't even thought of that, good point! I would like to think I am well versed in how Docker works - However...

I would recommend mounting just that modified file into the container and not the entire /var/www/baikal folder, for example based on examples/docker-compose.localvolumes.yaml:

I did not know you could mount a single file! That is a much easier option, let me do that now.

@ckulka OK so I've done the above and it has worked a treat. I am now however having issues with the rewriting for iOS 14. I've found several different links all suggesting different formats, such as:

RewriteRule /carddav /card.php [R,L]
RewriteRule /caldav /cal.php [R,L]
RewriteRule /.well-known/carddav /card.php [R,L]
RewriteRule /.well-known/caldav /cal.php [R,L]
RedirectPermanent /.well-known/caldav http://servername.tld/cal.php
RedirectPermanent /.well-known/carddav http://servername.tld/card.php
rewrite ^/.well-known/caldav /dav.php redirect;
rewrite ^/.well-known/carddav /dav.php redirect;

And others that I can now not find.

I have also just stumbled across this. Much like the OP, I've tried many of those URIs too and none have worked. One comment mentions that from iOS 12 CardDAV will only work with HTTPs (which I have not configured because certificates), yet OP also mentions CardDAV working with HTTP. I cannot get an output from either of the log files in /var/log/nginx/, and I've seen my iPhone autoppulating the URI with dav.php rather than card.dav, so I honestly don't know what to believe any more!

I'm afraid I can't help you there, I don't have an iPhone - just one thing (and this is to some extend me accidentally misleading you): nginx doesn't use the .htacess file, I forgot to take that out when using the Docker Compose file example.

Can you please retry this with the Apache variant, e.g. just image: ckulka/baikal?

If that doesn't work either, I think your best bet now is to open an issue in the Baikal repository given this is related to how Baikal works with iOS 14 and Apache. They are maintaining the code + configuration and might have a working setup/example for iOS 14.

@ckulka OK I will try the apache variant and if that doesn't work I will look to raise it elsewhere. Thanks for your help.