Closed larafj closed 1 year ago
Hi @larafj,
You are totally correct. With the current docker image, you would need to map the docker directory that you wish to persist with a host directory or with a host docker volume.
For instance, if you want to persist the folder Web/uploads
, then your docker-compose.yml
file would contain the following lines (I am using a docker volume named librebooking_uploads here)
volumes:
- vol-app:/config
- vol-upl:/var/www/html/Web/uploads
volumes:
vol-app:
name: librebooking_conf
vol-upl:
name: librebooking_uploads
Since I did not need to persist such folder, I did not define a volume for it in the Dockerfile
. However, if you consider it is a must, then I could make the change. In such case, a docker volume would always be created even if not needed.
Thanks for your reply. Don't you have to define the volume in the dockerfile as well? The problem that I find is that you cannot customize the app with your own logo, I mean you can, but it will disappear after rebooting the docker compose.
Actually, you can map a single file with docker.
Your docker-compose.yml
file would contain the following line:
volumes:
- vol-app:/config
- full_path_to_your_logo_file_on_your_host.png:/var/www/html/Web/img/librebooking.png
Would it be possible to map the entire /var/www/html folder like previous versions? I have tried but it didn't work. I don't know if I did something wrong or it's just not possible. I used bind mount not docker volumes, not sure if that might be the reason.
The thing is that I also like to modify some files in the lang and presenters folders. So I think it's better to mount the entire app than individual folders or files. I'm aware that mounting just config.php makes the update process easier but to be honest this is not something that I do very often, and if I had to, I'd probably start from scratch with just a copy of the database.
Hi @larafj
With version-2, I decided to drop the mapping of the /var/www/html
folder and I believe this was the right thing to do. Henceforth, there is no turning back...
My understanding is that you are customizing the upstream project (librebooking/app). Did you consider contributing to upstream instead?
Finally, if none of the above meets your needs, then you can always fork the upstream project (it does include a Dockerfile) or fork this project.
Hi @colisee. Thanks again for your reply. I barely know anything about programming, I wouldn't know how to contribute to this project. Besides I don't think I have much to offer. I've just been using it for a couple of years, first as an app and now as a docker, and I like it. Anyway, thanks for your contribution!
Hi @larafj,
I am feeling bad to let you down.
If you tell me exactly which files you customized, I can try to find a workaround.
Hi @colisee. You are not letting me down in any way, quite the opposite. I understand that there are people who have needs other than mine. But, since you ask, I'll show you what files I customize besides the logo (Web/img/custom-logo.png) and the favicon (Web/custom-favicon.png) if that's of any help to other users.
lang/es.php line 159: $strings['UsernameOrEmail'] = 'Usuario DMSAS'; I think it should read 'Usuario o email' I don't know what DMSAS is, probably something from a particular project?
Presenters/RegistrationPresenter.php line 210 $homepageId = 1; I like to put here $homepageId = 2; Users typically don't change their default homepage and I think it is less confusing for them to land on the Schedule page than in the Dashboard page. I'm not sure why changing $conf['settings']['default.homepage'] = '1' in the config.php has no effect.
I also upload images of the resources to /Web/uploads/images/
As I said, I like the freedom of having access to folders and files, but perhaps most users will be happy with the default values.
Thanks again!
Hola @larafj, I think I can help you with the V2-image.
If you use a docker-compose.yml file, could you please share it here. Please xxxx any password you might use.
If you are not using a docker-compose.yml file, can you share the docker run command you are using? Again, xxxx any password you might use.
Saludos.
Hola @colisee, Yes, I use a docker-compose.yml file. I think it's pretty standard. I haven't updated the docker image, I'm still on version 2.8.5.5. You can find it below. ¡Muchas gracias! :smiley:
version: "3.7"
networks:
red:
name: dockernet
db:
image: linuxserver/mariadb
container_name: dbLibrebooking
restart: always
networks:
- red
volumes:
- /share/DockerVolumes/mariadb/dbLibrebooking:/config
- /var/run/docker.sock:/var/run/docker.sock
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Madrid
- MYSQL_DATABASE=librebooking
- MYSQL_ROOT_PASSWORD=XXXXXXXX
- MYSQL_USER=XXXXXXXXX
- MYSQL_PASSWORD=XXXXXXXXX
app:
image: colisee/librebooking
container_name: librebooking
restart: always
depends_on:
- db
networks:
- red
ports:
- "8088:80"
volumes:
- /share/DockerVolumes/librebooking:/var/www/html
environment:
- TZ=Europe/Madrid
- LB_DB_HOST=db
- LB_DB_NAME=librebooking
- LB_INSTALL_PWD=XXXXXXXXXXX
- LB_DB_USER=XXXXXXXXXX
- LB_DB_USER_PWD=XXXXXXXXX
Hola @larafj,
I think I have a solution for you. Please review and apply the following steps:
mkdir -p /share/DockerVolumes/librebookingV2/config
cp /share/DockerVolumes/librebooking/config/config.php /share/DockerVolumes/librebookingV2/config
mkdir -p /share/DockerVolumes/librebookingV2/custom cp /share/DockerVolumes/librebooking/Web/img/custom-logo.png /share/DockerVolumes/librebookingV2/custom cp /share/DockerVolumes/librebooking/Web/custom-favicon.png /share/DockerVolumes/librebookingV2/custom
mkdir -p /share/DockerVolumes/librebookingV2/uploads/images cp -r /share/DockerVolumes/librebooking/Web/uploads/images /share/DockerVolumes/librebookingV2/uploads/images
2. Stop your librebooking and dbLibrebooking containers
3. Restart your librebooking and dbLibrebooking containers with the following docker-compose.yml file
version: "3.7"
networks: red: name: dockernet
services: db: image: linuxserver/mariadb container_name: dbLibrebooking restart: always networks:
MYSQL_PASSWORD=XXXXXXXXX
app: image: librebooking/librebooking:2.8.5.5-2.3.2 container_name: librebooking restart: always depends_on:
I believe that it should work with the exception of lang/es.php
and Presenters/RegistrationPresenter.php
. I will tell you later how to cope with these.
Please, let me know if it worked.
Hasta luego.
Hola @colisee. I've been testing your solution and it works for the most part. After copying config.php I had to change the owner to www-data. The custom logo and custom favicon work perfectly, I just had to clear the web cache. The only thing that I couldn't figure out is how to upload a new image for a resource. The image is not saved in Web/uploads/images even though the owner is www-data.
Saludos
Hola @larafj,
I am putting @effgarces in copy, for I believe the issue you faced in your last comment could come from default application settings in the upstream project.
I made the same test as you and this is what I got:
/share/DockerVolumes/librebookingV2/uploads/images
[access_compat:error] [pid 82] [client 172.21.0.1:34212] AH01797: client denied by server configuration: /var/www/html/uploads/images, referer: http://192.168.0.95/Web/admin/manage_resources.php?
After several attempts, I realized that there was a "discrepancy" in the librebooking application settings default values, where:
image.upload.directory
= Web/uploads/imagesimage.upload.url
= uploads/imagesI changed the value of image.upload.url
to Web/uploads/images and it looks OK now.
Could you please change the application settings as well and try again?
Saludos.
Hola de nuevo,
I am now referring to the issue of the default.homepage
you mentioned in this comment
In order to apply the new setting (ie. default.homepage=2) you need to go to the application settings in the web interface and click on the link Aplicar a los usuarios actuales
located just below the default.homepage field.
This should work. Please let me know as well.
Hola @colisee, After doing what you said, the image is uploaded to Web/uploads/images. I can see that the file is there but unfortunately it is not displayed. This is what I get:
I have also tried with the app (2.8.6.1), not docker, and it works nicely with the default setting image.upload.url = uploads/images
Regarding the issue of the default.homepage
, what I want is to make the Schedule page the default homepage for new users, not just current ones. I could apply that setting every time a new user signs up but that is not ideal. I'd be happy if Schedule was selected by default in Register.php.
¡Gracias de nuevo!
Prior to changing the setting of image.upload.url
I experienced as well the image not being displayed.
Could you please run docker logs librebooking
and check if you have an Apache error?
I don't see any obvious error: https://pastebin.com/bAybb9G4
This is weird. I've just set image.upload.url
back to uploads/images and it's working now.
This is odd because in my case, when I run with the docker image librebooking/librebooking:2.8.5.5-2.3.2
the image is displayed only when image.upload.url=Web/uploads/images
...
The only difference between you and me is that I started the application from scratch, while you had an existing database and non-empty folders... If you can, could you create and start a new instance from scratch (ie. new empty database, new empty folders)? Normally, the beauty of using docker images is that the behaviour is always reproductible.
Finally, regarding the default.homepage
setting, once you set it to 2, any new user that you create afterward will inherit that setting. I just tried and it worked.
I think the difference is not in the database but in config.php, more precisely in the script.url
. I have Web included in that field. I can't remember where I saw that recommendation. By default is empty and then, you are right, you have to modify image.upload.url
to include Web for images to display correctly.
Regarding the default.homepage
setting, this is what I have in config.php $conf['settings']['default.homepage'] = '2';
but this is what new users get when they sign up:
By default, Dashboard is selected and that's what they get when they log in. I have tried it several times with the same result. $homepageId = 1
in RegistrationPresenter.php overrides $conf['settings']['default.homepage'] = '2';
in config.php. I don't know why is different in you case.
OK, I understood what's going on.
In my tests, I was adding a user as an administrator, through the menu Application Management/Users
then Add User
.
Here is my screenshot. You notice that the administrator cannot specify the homepage but the user's homepage will be the one defined in file config.php
But in your case, you are letting people register themselves. This is why they can specify which homepage they wish to have. I agree with you: the default value should come from file config.php
. Somehow, this is however not the case. **This is an issue that pertains to the upstream project not this one. I can have a look in the coming days and propose a pull request to @effgarces.
And to conclude on your previous comment, regarding the file lang/es-es.php
I checked other translations and indeed Spanish is the only language that mentions the acronym DMSAS in the string Usuario DMSAS
. I agree that having Usuario o email
would be more appropriate.
The only proper way to handle this is to fix the file in the upstream project
If you could take care of it, that would be a nice way to contribute back to the project...
Hola @larafj
Thank you very much for having submitted your PR. @effgarces will accept the PR when he has some time (unfortunately, I don't have the rights on the upstream project). Once accepted, your change will be available in the docker image librebooking/librebooking:develop. Later, when @effgarces create a new release (presumably 2.8.6.2) it will be available on a new docker image (presumably librebooking/librebooking:2.8.6.2)
At this stage:
librebooking/librebooking:2.8.6.1
. Don't forget to point your browser to Web/install/migrate.php
es_es.php
file to the docker container. In the latter case, you know now how to do itRegarding the default homepage for users who are self registering, I will propose a different change on line 210 of file Presenters/RegistrationPresenter.php
:
You From: $homepageId = 1 To : $homepageId = 2
Me From: $homepageId = 1 To: $homepageId = Configuration::Instance()->GetKey(ConfigKeys::DEFAULT_HOMEPAGE, new IntConverter())
If accepted, this change will be available in develop
then later in a new release.
Hola @colisee, Mystery solved! Thank you for this enriching conversation. I have learned something. Very much appreciate it. Saludos.
Let's say an resource image is uploaded. Should the upload folder not be persistent? I mean shouldn't be bound to a host folder by a volume?