Comments (7)
I just tried this on my own instance on Webtrees, and I got permission denied as expected. There should be an .htaccess
file in the data
folder that denies all access like in the screenshot below:
I'm currently on business travel, but I will try to remember to investigate this when I get back. A new(ish) version of Webtrees may not have the .htaccess
file in the release .zip or something, and it only works for me because I have the volume mounted.
from webtrees-docker.
Thanks for the reply. I have checked and that .htaccess file is missing. I've copied it across from the main webtrees repository, where it does seem to be in the latest release.
As a test, I created a new instance of webtrees using this docker image (latest tag) and when it generated the /data directory it again failed to create the .htaccess file, so I'm not sure what's wrong :(
It would be interesting if, when you get time, you (or someone else) could create a fresh install and see if you see the same problem.
from webtrees-docker.
I'm not sure what's going on. I started the ghcr.io/nathanvaughn/webtrees:latest
container with no environment variables set and attached a console to it, and I can see the .htaccess
file in the /var/www/webtrees/data
directory. I had not run the setup at all.
Even if you weren't mounting the /var/www/webtrees/data/
directory, that file should still be persisted as it's in the base container. My best guess is at some point you inadvertently deleted that file when the directory was persisted in a host bind/volume and Webtrees I guess never automatically re-creates it.
I do have a desire to re-create the init script in Python so I'll probably add some functionality to recreate that file if it does not exist.
from webtrees-docker.
Ok I've had a bit of a play, and I can reproduce the cause, even if I don't understand it.
Here's a slightly modified version of your example docker-compose.yml file:
version: "3"
services:
app:
depends_on:
- db
image: ghcr.io/nathanvaughn/webtrees:latest
ports:
- 8095:80
restart: unless-stopped
#volumes:
# - ./app_data:/var/www/webtrees/data/
# - ./app_media:/var/www/webtrees/media/
db:
command: "--default-authentication-plugin=mysql_native_password"
environment:
MYSQL_DATABASE: "webtrees"
MYSQL_USER: "webtrees"
MYSQL_ROOT_PASSWORD: "badpassword"
MYSQL_PASSWORD: "badpassword"
image: mariadb:latest
restart: unless-stopped
#volumes:
# - ./db_data:/var/lib/mysql
Running this works fine, the container runs, setup is available, and accessing webtrees.mydomain.com/data/config.ini.php results in the expected access denied error.
Now if I uncomment the above lines related to declaring volumes, this breaks it. If I recreate the container with these volume mappings, for some reason it does not create the .htaccess file. The mapped directories are not created ahead of time, I let docker create them to ensure correct ownership.
This is a bit confusing since the config.ini.php is created fine in the same directory. I'm not sure what could cause this?
This is a slightly different setup from your example file which has named volumes not mapped to the host (if that's the right terminology), but I want all my volumes mapped to a specific host directory for organisation and backup reasons.
Do you have any idea why mapping the volumes like this would cause the issue?
from webtrees-docker.
Oh man, that's a good catch. It's with how Docker treats volumes. If you do a named volume, I think Docker pre-populates it with anything already in the container. If you do a host bind mount however, then Docker replaces the contents of the container with whatever is on the host, it doesn't like sync the differences or anything.
A good fix for this will be to update the container entrypoint script to also check if that file does not exist and automatically re-create it. I started to do some work on that this weekend on the new-entrypoint
branch but have not finished it yet.
webtrees-docker/docker-entrypoint.py
Lines 278 to 289 in b94cbeb
from webtrees-docker.
There isn't anything on the host when first started (not even the mapped directories), so Docker wouldn't have to sync any differences. In other containers I haven't had issues doing it this way. Some even map the whole of the www directory to the host and it seems to work fine, so it's interesting that this doesn't like it - and only has an issue with this one file. My experience seems to be that if you don't create the directory then docker will create and populate it.
I have no idea what makes this situation different, but you do seem to have a solution to this specific problem. I do wonder if there's a more specific root cause that it could be narrowed down to but I think given you have a solution on your side (and it's outside of your recommended setup anyway), and given I have it fixed on my side, then there's probably not much point spending more time on it. Happy for this to be closed if you aren't intending on using it to track your changes against an issue.
from webtrees-docker.
This should be resolved now with the latest push of the :2.0.21
tag and new entrypoint script
from webtrees-docker.
Related Issues (20)
- After update fatal error HOT 1
- Can't get the application to run at all HOT 8
- Keep the plugins HOT 1
- Where are the webtree logs HOT 3
- Automatic log out HOT 2
- Allow max_execution_time adjustments HOT 2
- php.ini modifications HOT 2
- Can't start container HOT 6
- Run as a different user HOT 3
- docker-compose not working HOT 4
- SQLSTATE[HY000] [2002] No such file or directory (SQL: CREATE DATABASE IF NOT EXISTS HOT 7
- Issues with 2.1.16 (500 internal error) HOT 7
- media volume mounted incorrectely HOT 1
- database user and schema creation HOT 5
- Reverse proxy (i think) setup issue HOT 7
- Supplying user & password in variables does not work HOT 10
- Cant get this to run HOT 1
- Email not working after webtrees update 2.0.19 > 2.0.21 HOT 7
- Container restart resets config file permissions HOT 3
- Upgrade prompt is still shown
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webtrees-docker.