Traefik with Tutor and Wordpress

I PMed @tony-h about a topic that he discussed earlier: Traefik as a frontend proxy? and provided me with valuable info I hope will help others in the community.

Hi toney,
I am running Open edx Tutor based on subdomains exp: lms.mydomain.com and studio.mydomaine.com and wanted to install a wordpress as primary domain mydomain.com and use Traefik as a frontend proxy.
I saw from your post Traefik as a frontend proxy? that you have some knowledge in that mater, so I hope to find some help.
I tried nginx proxy as explained by some videos but didn’t succeed. Also I don’t want to alter the tutor docor-compose.yml file in case of upgrades, as you mentioned.
Thank you

Thank you Tony for your valuable and rapid replay.
I have already used nginx as a reverse proxy and modified the file configuration of tutor in the location you mentioned and installed Wordpress on docker in a separate directory. Everything seamed ok till I wanted to setup an SSL certificate where it became complicated.
We know that tutor has it’s own certificate which is quite simple to install and because I setup LMS and Studio in subdomains and Wordpress in the main domain, they probably have to share the same SSL certificate and this is where the difficulty rises.
I read that Traefik takes in charge both the proxy function and the SSL certificates but we have to modify the tutor docker-compose.yml which is risky in case of upgrade.
I’ll post our discussion in the forum for probable utility.

1 Like

Hi @SayHi! I don’t quite understand why you want to run tutor behind traefik. Is it just for certificate management? If yes, there are other, more simple solutions, such as enabling a Web proxy that will take care of ssl termination.

Unless I’m mistaken, traefik requires custom annotations of the nginx container. It’s possible for you to add annotations with a docker-compose.override.yml file, if you really want to do that.

Sorry @regis, to not be able to respond earlier. The reasons that Am trying to use traefik to proxy all my containers are as follow:
1- I want to use only containers and nothing on the host to reverse proxy to them (as nginx)
2- I used nginx container with auto SSL from this repository :
https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
but noticed a bug reported by others that the “docker-gen” container stops frequently without a reasonably cause and this is fatal for a production environment.
3- I want to use metrics and management containers as Portainer, Prometheus and Graphana and with traefik it’s easy.
4- I want to install on other stack containing Wordpress, Mysql and phpmyadmin containers and have Wordpress to point on main domain “mydomain.com
5- I installed Tutor-OpenEdx stack on subdomains “lms.mydomaine.com” “studio.mydomaine.com
6- I want to automatically SSL every thing and traefik supports wildcard Let Encrypt out of the box.
7- And finally I want to link Wordpress and OpenEdx with the NextEdu plugin.

So these are my reasons. But the most of all is that I want to use only containers and nothing on the host.

This has been said, I am not a DevOps guy and can’t tell if my plan is the best, I just found containers are easy to manage and don’t “wast” the host OS.
I was able to go through most of the tasks but couldn’t connect Traefik to OpenEdx even though I put the required traefik’s labels on the nginx container at the docker-compose.yml file. So I finally quit.

At the moment, I don’t see a solution but to install nginx on the host as reverse proxy. :disappointed:

Hi @SayHi! I understand your requirements. As far as I can tell, it’s quite possible to achieve what you want already. You need to do the following:

  1. Configure the nginx container (from tutor) to expose different ports than the default ones: https://docs.tutor.overhang.io/configuration.html#nginx
  2. Also, set WEB_PROXY=true to disable SSL termination at the Tutor level.
  3. Add a custom docker-compose.override.yml file to env/local to add custom labels to the nginx container.
  4. Run traefik, or whatever web proxy you want to forward LMS and CMS traffic to the tutor nginx container.

This should work, although I did not try it myself.

2 Likes

Hi
I managed to install Richie along with the tutor on the aws instance and it’s now available at http://domain.com:8070. open edX lms and cms are available respectively at https://domain.com and https://studio.domain.com. Now I want to route a subdomain http://catalogue.domain.com to the (Richie’s) port- 8070.
I tried to add the following lines in nginx openedx.conf file but it didn’t work.

    listen 8070;
    server_name catalogue.domain.com;
    location / {
        proxy_pass http://localhost:8070;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

I think it’s because tutor overwrites it.

The instructions given by @regis are not clear to me. I searched the whole internet but couldn’t find more information about it.
Do I want to configure nginx as instructed in #1 even when Richie is already available at domain:8070 ? What should be the content of docker-compose.override.yml ? Could anyone help me to go forward with steps #2 and #3 ?
Is this the right thing to do if we want to host other apps, for eg, a discourse platform at another port and route sub-domain community.domain.com to it ?

Thank you in advance !

@nadheemabdulla @SayHi are you able to figure this out?
i want to install WordPress docker side by side with tutor installation for blogs and want to point blogs.mydomain.com to WordPress container.

No, I could only deploy Richie at http://domain.com:8070 and couldn’t route my subdomain nor connect Open edX and Richie CMS. I think @ak00001 is trying to create a plugin for the same.

Nadheemabdulla can you please help me to can change the ui of this I have tried but not found any way. I wanted to show tutor indigo theme on my main domain and show Tutor Richie on sub domain like courses