Hello the moodle community,
For a university project I must deploy a static website and a moodle instance (i have acces to one server: Ubuntu 16.04, php7.0, mysql5.7).
For this purpose i have stored the static website on the VPS host and I use a docker container for the moodle instance.
To make those two thing public, I use a nginx proxy with the following config in the server block:
server {
listen 80;
listen [::]:80;
server_name 104.238.164.33;
set $base /var/www/public/;
root $base;
# $uri, index.html
location / {
try_files $uri $uri/ /index.html;
}
location /moodle/ {
proxy_pass http://172.20.0.3/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
the / location only hold static html.
the /moodle/ location point to the ip of the container, I build using this config:
https://github.com/jda/docker-moodle
To make it work i made the following change:
to make the moodle instace work behind the proxy, i just add in the config.php file line :
$CFG->reverseproxy=1;
Then I modify the docker-compose.yml to remove the exposed port
version: '3'
services:
dbapp:
image: mysql:5
restart: always
volumes:
- db-volume:/var/lib/mysql
env_file:
- moodle_variables.env
networks:
- backendDB
moodleapp:
build:
context: .
links:
- dbapp:DB
depends_on:
- dbapp
restart: always
volumes:
- moodleapp-data:/var/moodledata
env_file:
- moodle_variables.env
networks:
- backendDB
- frontendWEB
volumes:
db-volume:
moodleapp-data:
networks:
backendDB:
frontendWEB:
Then to make it use the last moodle version i change the git command in the Dockerfile
git clone -b MOODLE_34_STABLE git://git.moodle.org/moodle.git --depth=1 && \
Once all this is done you can build the image and deploy with:
docker-compose build
docker-compose up -d
Once deployed i access the server with the following URL: http://104.238.164.33/moodle/
I can validate the license and all the plugins are installed, but once the installation script begin i get the error as showned in the attached screenshot.
When i check on the sql container all the table are created. What could make the server believe it cant access it ?
I am using this technique (proxy+docker) as it was the easiest path for me.
Seems like its an issue on the php side how could i debug this ?
Thank you for reading all this!