====== Docker ====== A web server for SoSci Survey can also be operated via a Docker container. **Warning:** This manual is still incomplete (work in progress). It describes a minimal configuration without SSL encryption and further security mechanisms, intended for local operation. Do not use this configuration to operate a production system. On Windows, it is best to install [[https://docs.docker.com/desktop/setup/install/windows-install/|Docker Desktop]] for this purpose. ===== Configuration ===== Create a directory, e.g., ''C:\Data\sosci'', and in it a file ''docker-compose.yml'' with the following content. Do not forget to enter your own data at the places marked with ''%%__Change__%%''. services: mariadb: image: 'mariadb:11.0' working_dir: /application volumes: - './data:/application' - './data/mysql:/var/lib/mysql' environment: - MYSQL_ROOT_PASSWORD=__Change__ - MYSQL_DATABASE=sosci - MYSQL_USER=sosci - MYSQL_PASSWORD=__Change__ ports: - '63003:3306' webserver: image: 'nginx:alpine' working_dir: /application volumes: - './data:/application' - './conf/nginx.conf:/etc/nginx/conf.d/default.conf' - './survey:/var/www/html' - './log:/var/log' ports: - '63000:80' # - '443:443' php-fpm: build: php-fpm working_dir: /application volumes: - './data:/application' - './conf/php-ini-overrides.ini:/etc/php/8.4/fpm/conf.d/99-overrides.ini' - './conf/php-ini-overrides.ini:/etc/php/8.4/cli/conf.d/99-overrides.ini' - './survey:/var/www/html' - './log:/var/log' Extract the SoSci Survey installation package to ''C:\Data\sosci\survey\'', a file ''C:\Data\sosci\survey\index.html'' should exist afterwards. Create the following configuration in ''C:\Data\sosci\conf\nginx.conf'' server { listen 80 default; client_max_body_size 128M; access_log /var/log/nginx/access.log; root /var/www/html; index index.php; # try to serve file directly, fallback to index.php location / { try_files $uri $uri/ =404; index index.php index.html; } if (!-e $request_filename) { rewrite ^.*$ /index.php last; } # Forbidden directories location ~ ^/(inc|lib|system)/ { deny all; return 403; } location ~ ^/files/(protected|upload|share)/ { deny all; return 403; } location ~ /\.ht { deny all; return 403; } # Use default favicon, so no entries will appear in the errorlog location ~ ^/.*/favicon\.ico$ { try_files /favicon.ico =404; } location ~ \.php$ { try_files $uri =404; fastcgi_pass php-fpm:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log"; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; include fastcgi_params; } } Furthermore, create the configuration ''C:\Data\sosci\conf\php-ini-overrides.ini'' upload_max_filesize = 100M post_max_size = 128M Create a configuration ''C:\Data\sosci\php-fpm\Dockerfile'' FROM phpdockerio/php:8.4-fpm WORKDIR "/application" RUN apt-get update \ && apt-get -y --no-install-recommends install \ php8.4-bcmath \ php8.4-gd \ php8.4-imap \ php8.4-intl \ php8.4-memcached \ php8.4-mysql \ php8.4-xml \ php8.4-gd \ php8.4-mbstring \ php8.4-zip \ php8.4-apcu \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* Start the container on the command line or in the terminal with the following command: docker-compose up In the future, you can then also start the containers directly in Docker Desktop. ===== Access to the Containers ===== You open the installation routine via [[http://localhost:63000/admin/install.php]]. As the database server in the SoSci Survey installation, enter ''mariadb:3306''. ===== Permissions ===== This solution uses different (Linux) users for the PHP process and for the web server. For access to the survey projects to work, set the option "limited writing (0x755)" for //New projects' file permissions// in the **Server Settings**, in the tab "Server", in the section "Security".