Parcourir la source

limesurvey: install from CLI

Guilhem Saurel il y a 6 ans
Parent
commit
492bfa7486
4 fichiers modifiés avec 73 ajouts et 4 suppressions
  1. 4 0
      limesurvey/Dockerfile.fpm
  2. 1 4
      limesurvey/README.md
  3. 66 0
      limesurvey/config.php
  4. 2 0
      limesurvey/docker-compose.yml

+ 4 - 0
limesurvey/Dockerfile.fpm

@@ -13,5 +13,9 @@ RUN wget -q $URL -O $FILE \
  && rm $FILE
 
 RUN chown -R www-data tmp upload application/config
+ADD config.php application/config/
 
 VOLUME /var/www/html
+
+CMD sed -i "s|POSTGRES_PASSWORD|$POSTGRES_PASSWORD|" application/config/config.php \
+ && php-fpm

+ 1 - 4
limesurvey/README.md

@@ -7,8 +7,5 @@ https://www.limesurvey.org/
 ```
 echo POSTGRES_PASSWORD=$(openssl rand -base64 32) >> .env
 docker-compose up -d --build
+docker-compose exec app php application/commands/console.php install "ADMIN_USER" "ADMIN_PASSWORD" "ADMIN_NAME" "ADMIN_EMAIL"
 ```
-
-Go to your webbrowser to finish installation:
-- DB name / DB host / DB user: `postgres`
-- DB password: look inside .env

+ 66 - 0
limesurvey/config.php

@@ -0,0 +1,66 @@
+<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+/*
+| -------------------------------------------------------------------
+| DATABASE CONNECTIVITY SETTINGS
+| -------------------------------------------------------------------
+| This file will contain the settings needed to access your database.
+|
+| For complete instructions please consult the 'Database Connection'
+| page of the User Guide.
+|
+| -------------------------------------------------------------------
+| EXPLANATION OF VARIABLES
+| -------------------------------------------------------------------
+|
+|    'connectionString' Hostname, database, port and database type for
+|     the connection. Driver example: mysql. Currently supported:
+|                 mysql, pgsql, mssql, sqlite, oci
+|    'username' The username used to connect to the database
+|    'password' The password used to connect to the database
+|    'tablePrefix' You can add an optional prefix, which will be added
+|                 to the table name when using the Active Record class
+|
+*/
+return array(
+	'components' => array(
+		'db' => array(
+			'connectionString' => 'pgsql:host=postgres;port=5432;user=postgres;password=POSTGRES_PASSWORD;dbname=postgres;',
+			'emulatePrepare' => true,
+			'username' => 'postgres',
+			'password' => 'POSTGRES_PASSWORD',
+			'charset' => 'utf8',
+			'tablePrefix' => 'lime_',
+		),
+
+		// Uncomment the following lines if you need table-based sessions.
+		// Note: Table-based sessions are currently not supported on MSSQL server.
+		// 'session' => array (
+			// 'class' => 'application.core.web.DbHttpSession',
+			// 'connectionID' => 'db',
+			// 'sessionTableName' => '{{sessions}}',
+		// ),
+
+		'urlManager' => array(
+			'urlFormat' => 'get',
+			'rules' => array(
+				// You can add your own rules here
+			),
+			'showScriptName' => true,
+		),
+
+	),
+	// For security issue : it's better to set runtimePath out of web access
+	// Directory must be readable and writable by the webuser
+	// 'runtimePath'=>'/var/limesurvey/runtime/'
+	// Use the following config variable to set modified optional settings copied from config-defaults.php
+	'config'=>array(
+	// debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
+	// then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
+	// on your webspace.
+	// LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
+		'debug'=>0,
+		'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
+		// Update default LimeSurvey config here
+	)
+);
+/* End of file config.php */

+ 2 - 0
limesurvey/docker-compose.yml

@@ -30,6 +30,8 @@ services:
     build:
       context: .
       dockerfile: Dockerfile.nginx
+    depends_on:
+      - app
     labels:
       traefik.enable: "true"
       traefik.frontend.rule: "Host: limesurvey.${CHATONS_DOMAIN:-localhost}, www.limesurvey.${CHATONS_DOMAIN:-localhost}"