martialblog/docker-limesurvey

The `BASE_URL` config seem to be broken in at least 6.x

fkrauthan opened this issue · 8 comments

It seems like the BASE_URL env variable currently maps to:

request -> baseUrl in config.php.

However when I didn't modify it I had a bunch of links broken as well as question preview images did not load correctly (I am using traefik and the apache image).

However changing that to

request -> hostInfo while appending a trailing / solved all issues for me. So maybe that config has changed and the entrypoint.sh needs to be updated?

Hi, might be, I'm not using LS in my day to day. Last time I checked the LS documentation on these variables mostly points to the Yii Framework docs.

Since there are a bazillion config options in the Framework which we can't have as Env Variables in the Image, it's usually best to just mount a config.php.

So you are saying the hostInfo needs to be set instead of baseUrl? Or both? If you have a working example we can include it in the repo.

I only set hostInfo instead of baseUrl (it is also the one mentioned in the docs as the param to use: https://manual.limesurvey.org/Optional_settings#Request_settings)

I'll try to replicate things and update the docs then.

@fkrauthan I think I got the same problem. I can not upload pictures because the buttons are just not working, everything else seems to work fine.

I have a running Traefik setup with the following docker-compose

services:
  limesurvey:
    image: martialblog/limesurvey:6-apache
    restart: unless-stopped
    volumes:
      - ./upload/surveys:/var/www/html/upload/surveys
      - ./config.php:/var/www/html/application/config/config.php
    depends_on:
      - lime-db
    networks:
      - internal
      - web
    environment:
      - DB_HOST=lime-db
      - DB_PASSWORD=${DB_PASSWORD}
      - DB_NAME=limesurvey
      - DB_USERNAME=limesurvey
      - ADMIN_USER=admin
      - ADMIN_NAME=Admin
      - ADMIN_EMAIL=XXX@XXX.de
      - ADMIN_PASSWORD=${LIMESURVEY_ADMIN_PASSWORD}
    labels:
      - traefik.enable=true
      - traefik.http.routers.${WEBSITE}.rule=Host(`${URL}`)
      - traefik.http.routers.${WEBSITE}.tls=true
      - traefik.http.routers.${WEBSITE}.tls.certresolver=lets-encrypt
      - traefik.http.services.${WEBSITE}-limesurvey.loadbalancer.server.port=8080
  lime-db:
    image: mariadb:10.5
    restart: unless-stopped
    environment:
      - "MYSQL_USER=limesurvey"
      - "MYSQL_DATABASE=limesurvey"
      - "MYSQL_PASSWORD=${DB_PASSWORD}"
      - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}"
    networks:
      - internal
    volumes:
      - ./db:/var/lib/mysql

networks:
  web:
    external: true
  internal:
    external: false

config.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
return array(
  'components' => array(
    'db' => array(
      'connectionString' => 'mysql:host=lime-db;port=3306;dbname=limesurvey;',
      'emulatePrepare' => true,
      'username' => 'limesurvey',
      'password' => 'XXX',
      'charset' => 'utf8mb4',
      'tablePrefix' => 'lime_',
    ),
    //'session' => array (
    //   'class' => 'application.core.web.DbHttpSession',
    //   'connectionID' => 'db',
    //   'sessionTableName' => '{{sessions}}',
    //),
    'urlManager' => array(
      'urlFormat' => 'path',
      'rules' => array(),
      'showScriptName' => true,
    ),
    'request' => array(
      'baseUrl' => '',
      'hostInfo' => 'https://XXX.de/',
     ),
  ),
  'config'=>array(
    'publicurl'=>'',
    'debug'=>0,
    'debugsql'=>0,
    'mysqlEngine' => 'MyISAM',
  )
);

I create a config.php and used the hostInfo entry like you said, however I still can't upload any pictures as I have the same problem as before, how did you fix it?

@strickes I haven't tried image uploads itself. But at least for me my settings are slightly different.

  • showScriptName set to false
  • baseUrl is removed
  • publicurl is set to the same as hostInfo minus the trailing slash

Maybe try that modifications and see if it solves it?

@strickes I haven't tried image uploads itself. But at least for me my settings are slightly different.

  • showScriptName set to false
  • baseUrl is removed
  • publicurl is set to the same as hostInfo minus the trailing slash

Maybe try that modifications and see if it solves it?

thank you so much! This absolutely did the trick and worked like a charm. Now I can finally upload pictures and attachments to the surveys

Hey, I had the same issue (limesurvey 6.4 to 6.5). It seems like the only needed modification for me is removing 'baseUrl', no need to set publicurl/hostInfo or set showScriptName to false. My config.php is as follows :

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
return array(
  'components' => array(
    'db' => array(
      'connectionString' => 'mysql:host=lime-db;port=3306;dbname=limesurvey;',
      'emulatePrepare' => true,
      'username' => 'limesurvey',
      'password' => 'limesurvey',
      'charset' => 'utf8mb4',
      'tablePrefix' => 'lime_',
    ),
    //'session' => array (
    //   'class' => 'application.core.web.DbHttpSession',
    //   'connectionID' => 'db',
    //   'sessionTableName' => '{{sessions}}',
    //),
    'urlManager' => array(
      'urlFormat' => 'path',
      'rules' => array(), 
      'showScriptName' => true,
    ),
  ),
  'config'=>array(
    'debug'=>0,
    'debugsql'=>0,
    'mysqlEngine' => 'MyISAM',
  ) 
);

Thanks for the example. I'll have a look at it and update the examples/defaults