simplesamlphp / docker-simplesamlphp

A docker image for easy deployment of SimpleSAMLphp as either an Identity Provider or as a Service Provider.
GNU General Public License v2.0
23 stars 10 forks source link

This configuration is no longer working and it's outdated. #4

Closed MicheleMallia closed 4 months ago

MicheleMallia commented 4 months ago

I tried to run docker-compose but had problems (precisely it couldn't find xdebug, I didn't understand why). Looking at the docker-compose.yml I saw that no versions are specified in the images, so there might be a mismatch between the new versions and older configurations. It would be helpful to update the repository.

MicheleMallia commented 4 months ago

Here is an updated version of docker-compose:

services:
  idp.tutorial.stack-dev.cirrusidentity.com:
    build: build
    volumes:
      - ./simplesamlphp:/code
      - ./idp:/conf
    working_dir: /code
    environment:
      - SIMPLESAMLPHP_CONFIG_DIR=/conf/
    links:
      - mysql

  proxy.tutorial.stack-dev.cirrusidentity.com:
    build: build
    volumes:
      - ./simplesamlphp:/code
      - ./proxy:/conf
    working_dir: /code
    environment:
      - SIMPLESAMLPHP_CONFIG_DIR=/conf/

  sp1.tutorial.stack-dev.cirrusidentity.com:
    build: build
    hostname: sp1
    volumes:
      - ./simplesamlphp:/code
      - ./sp1:/conf
    working_dir: /code
    environment:
      - SIMPLESAMLPHP_CONFIG_DIR=/conf/
    command: apache2 -D FOREGROUND
    links:
      - redis

  sp2.tutorial.stack-dev.cirrusidentity.com:
    build: build
    volumes:
      - ./simplesamlphp:/code
      - ./sp2:/conf
    working_dir: /code
    environment:
      - SIMPLESAMLPHP_CONFIG_DIR=/conf/
    links:
      - memcached

  memcached:
    image: memcached

  mysql:
    image: mysql:8.0
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_DATABASE: sessions
      MYSQL_USER: dbuser
      MYSQL_PASSWORD: dbpassword
      MYSQL_ROOT_PASSWORD: rootpassword
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - tutorial-network
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 30s
      timeout: 10s
      retries: 3

  redis:
    image: redis

  gencert:
    image: cfssl/cfssl
    volumes:
      - .:/work
    working_dir: /work
    entrypoint: /bin/bash
    command:
      - ./ca/generate.sh

  nginx:
    image: nginx:stable
    links:
      - idp.tutorial.stack-dev.cirrusidentity.com
      - proxy.tutorial.stack-dev.cirrusidentity.com
      - sp1.tutorial.stack-dev.cirrusidentity.com
      - sp2.tutorial.stack-dev.cirrusidentity.com
    volumes:
      - ./nginx:/etc/nginx:ro
    ports:
      - '80:80'
      - '443:443'

volumes:
  mysql-data:

networks:
  tutorial-network:

And updated version of dockerfile:

# Use a base image with PHP and Apache
FROM php:7.3.13-apache

# Set the Apache document root
ENV APACHE_DOCUMENT_ROOT /code/www

# Update and install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
  apt-transport-https \
  ca-certificates \
  curl \
  gnupg \
  git \
  libmemcached-dev \
  libpng-dev \
  unzip \
  zlib1g-dev \
  libcurl4-openssl-dev \
  libssl-dev \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql

# Install PECL extensions memcached and redis
RUN pecl install memcached redis && \
    docker-php-ext-enable memcached redis

# Manually install Xdebug
RUN curl -L https://xdebug.org/files/xdebug-2.9.8.tgz -o xdebug.tgz && \
    tar -xvzf xdebug.tgz && \
    rm xdebug.tgz && \
    cd xdebug-2.9.8 && \
    phpize && \
    ./configure && \
    make && \
    make install && \
    cd .. && \
    rm -rf xdebug-2.9.8 && \
    echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Configure Apache
RUN a2dismod mpm_event && a2enmod mpm_prefork

# Copy Apache configuration files
COPY apache2.conf /etc/apache2/
COPY mpm_prefork.conf /etc/apache2/mods-available/

# Copy the startup script
COPY startup.sh /

# Ensure the startup script has executable permissions
RUN chmod +x /startup.sh

# Set the default command to run the startup script
CMD ["/startup.sh"]

# Default command to start PHP server if ENTRYPOINT is overridden
CMD ["php", "-S", "0.0.0.0:8732", "-t", "/code/www"]