setup admidio behind traefik

If you aren't speaking german, you can ask for support or post your request here.
Antworten
crvio
Beiträge: 5
Registriert: 15. Jun 2021, 16:04

setup admidio behind traefik

Beitrag von crvio »

Hi there
I'm setting up admidio to use with some of my peepz! :)
It looks great at doing exactly what we need.
I hope it works well for us.

I'm having an issue though when using this awesome app with docker and behind traefik.
I've set everything up just as I've done for other apps in order to serve the site over HTTPS, yet the styles (css) and other resources do not load, since they are referenced with the HTTP scheme.
I'm guessing that the issue here is related to this, because I can see that only the resources queried through HTTP are not loaded, and every other one is loaded correctly.
It might be that PHP recognizes the site being requested by traefik through HTTP and therefore builds the URLs of resources using HTTP instead of HTTPS, which would suit better for this case.
I cannot explain though why traefik doesn't do its part in redirecting those queries to the HTTPS scheme, which it certainly does for the main php scripts (installation and overview).

I can also see that if I expose the 8080 port as documented in the examples I get it to work, but serving this one app with no HTTPS is no good, because of the sensitive nature of information handled by it.

Wouldn't it be simpler to just use relative URLs? Probably there's a reason for not doing that.
I've searched through the available docs yet with no success trying to find an option or environment variable that would be used for this case.
I even tried to use VIRTUAL_HOST and VIRTUAL_PROTO, which is used by the builder of some other docker image and a sample docker-compose to use together with an nginx reverse proxy, but I'm just getting the same results.

I think the easier way to get around the issue is to get php to build all URLs with the HTTPS scheme, but I'm no expert, so I wouldn't take this idea for a fact.

Any help around this issue would be most appreciated.

Thanks in advance.
MFG
Cristóbal
Benutzeravatar
fasse
Administrator
Beiträge: 6041
Registriert: 12. Nov 2005, 16:06

Re: setup admidio behind traefik

Beitrag von fasse »

Hi Christobal,

have you also set the https within the Parameter $g_root_path in the config.php?

Best regards
Fasse
crvio
Beiträge: 5
Registriert: 15. Jun 2021, 16:04

Re: setup admidio behind traefik

Beitrag von crvio »

I hadn't done that.
But now I have, and the result is the same.

To be sure, we're talking about this file, right?
/opt/app-root/src/adm_program/installation/config.php
I changed the line like so:

Code: Alles auswählen

$g_root_path = 'https://my.host.tld';
I didn't have it in a volume mount so I just edited it with sed from within the container and then restarted it.
Maybe I have to create the container with that file mounted from a volume?
I'll also try that later.

Thanks for your prompt reply.
crvio
Beiträge: 5
Registriert: 15. Jun 2021, 16:04

Re: setup admidio behind traefik

Beitrag von crvio »

Ok I tried that now with no success either T . T

I mean mounting that file as a volume (or bind mount to be more precise) and creating the container with that edited file in place.
Maybe it was a dumb test, but I had to be sure :p

I'll go a bit into the detail of what I observe.

Code: Alles auswählen

I make a query to ----------------------------------> http://my.host.tld
redirect with code 301 to --------------------------> https://my.host.tld
redirect with code 302 to --------------------------> https://my.host.tld/adm_program/installation/index.php
redirect with code 302 to --------------------------> https://my.host.tld/adm_program/installation/installation.php
loads with code 200 <-------------------------------- https://my.host.tld/adm_program/installation/installation.php
further query referred by php ----------------------> https://my.host.tld/adm_program/system/logo/admidio_writing_white_150.png
loads with code 200 <-------------------------------- https://my.host.tld/adm_program/system/logo/admidio_writing_white_150.png
further query referred by php ----------------------> http://my.host.tld/adm_program/libs/client/jquery/jquery.min.js
chrome reports 'Failed to load response data' ------> http://my.host.tld/adm_program/libs/client/jquery/jquery.min.js
Then my browser tries to load another bunch of files that end up the same way as that last one.

Weirdly enough there's one PNG resource that is queried through HTTPS and loads correctly, but all the rest fails.

Please ask for any further detail required.

Thanks in advance for your help.

Cristóbal
Benutzeravatar
fasse
Administrator
Beiträge: 6041
Registriert: 12. Nov 2005, 16:06

Re: setup admidio behind traefik

Beitrag von fasse »

I mean the file in adm_my_files/config.php
crvio
Beiträge: 5
Registriert: 15. Jun 2021, 16:04

Re: setup admidio behind traefik

Beitrag von crvio »

Ok
I had written a long reply for this, but my session was lost and so was my response when I pressed the Submit button.
The main thing is that I was testing it prior to performing the installation progress, so there was no config.php file in there.
But after performing the installation, the file was created according to the file I had edited and it started to work since the 'https://my.host.tld' was in place.

Thanks for your help.

I will rewrite the rest of the reply, hopefully tomorrow.

Best regards
Cristóbal
crvio
Beiträge: 5
Registriert: 15. Jun 2021, 16:04

Re: setup admidio behind traefik

Beitrag von crvio »

Hi again.

So I wanted to point out some other things I observed, in the hope it would help you in the best way to make this project even better.
  1. The environment variable ADMIDIO_ROOT_PATH passed in the docker file seems not to work, requiring the edition of the config.php file.
  2. The 3 volume mounts for admidio files, plugins and themes (according to the docker readme) seem to be created as empty folders in /var/www/ since the actual files seem to be in /opt/app-root/src/.
  3. Mounting those volumes in the described location as bind mounts results in an issue with the next message: "The folder adm_my_files has no write permissions. Without write permissions, no files or photos can be uploaded by users." However the new documentation shows named volumes in use (although mounted in '/var/www/'), which indeed do work flawlessly. Just a bit mysterious for us docker laymen. So this might be completely unrelated to the image.
  4. There seems to be an issue with the back.php script, since hitting the back button when in some element edition or creation page directs to an URL of this sort: "https://my.host.tld/my.host.tld/adm_pro ... rences.php". This also happens when submitting an edit or creation, which gives the impression of the submission not succeeding even when it does.
  5. The installation process seems to finish behind the scenes with no easy way to notice it after pressing the install button. It led me to wait for some time before hitting F5 and finding out the installation process had already completed. Maybe just a message like "reload after a couple minutes if the page doesn't refresh itself" would be useful for new users of admidio.
If you think any of these points is worthy of taking a look at and open a saparate thread or github issue, I can do either of them.

If you need me to better test any of these, I'd be glad to help.

Thanks for this great app and for your prompt help.

Cristóbal
schast
Beiträge: 2
Registriert: 30. Jun 2021, 06:11

Re: setup admidio behind traefik

Beitrag von schast »

Hi Cristóbal,

sorry for the late reply.

The pull request (https://github.com/Admidio/admidio/pull/1064) fixes point 2 and subsequent errors 1 and 3.
Can you please change your paths from '/var/www/admidio' to '/opt/app-root/src'.

What's your Traefik configuration?

crvio hat geschrieben: 23. Jun 2021, 04:53 Hi again.

So I wanted to point out some other things I observed, in the hope it would help you in the best way to make this project even better.
  1. The environment variable ADMIDIO_ROOT_PATH passed in the docker file seems not to work, requiring the edition of the config.php file.
  2. The 3 volume mounts for admidio files, plugins and themes (according to the docker readme) seem to be created as empty folders in /var/www/ since the actual files seem to be in /opt/app-root/src/.
  3. Mounting those volumes in the described location as bind mounts results in an issue with the next message: "The folder adm_my_files has no write permissions. Without write permissions, no files or photos can be uploaded by users." However the new documentation shows named volumes in use (although mounted in '/var/www/'), which indeed do work flawlessly. Just a bit mysterious for us docker laymen. So this might be completely unrelated to the image.
  4. There seems to be an issue with the back.php script, since hitting the back button when in some element edition or creation page directs to an URL of this sort: "https://my.host.tld/my.host.tld/adm_pro ... rences.php". This also happens when submitting an edit or creation, which gives the impression of the submission not succeeding even when it does.
  5. The installation process seems to finish behind the scenes with no easy way to notice it after pressing the install button. It led me to wait for some time before hitting F5 and finding out the installation process had already completed. Maybe just a message like "reload after a couple minutes if the page doesn't refresh itself" would be useful for new users of admidio.
If you think any of these points is worthy of taking a look at and open a saparate thread or github issue, I can do either of them.

If you need me to better test any of these, I'd be glad to help.

Thanks for this great app and for your prompt help.

Cristóbal
Antworten