Commit aa3aa31b authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Started Dockerization

parent 1e5c3a27
Loading
Loading
Loading
Loading

Dockerfile

0 → 100644
+52 −0
Original line number Diff line number Diff line
FROM ubuntu:18.10

# To fix "configuring tzdata" interactive input during apt install
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -yq --no-install-recommends \
    apache2 \
    libapache2-mod-php7.2 \
    php7.2-xml \
    php7.2-mbstring \
    php-mysql \
    php-curl \
    libapache2-mod-shib2 \
    make \
    wget \
    ca-certificates \
    vim

# Copying Shibboleth SP configuration
COPY docker/shibboleth2.xml /etc/shibboleth/
    
# Installing Embedded Discovery Service
WORKDIR /usr/local/src

RUN wget https://shibboleth.net/downloads/embedded-discovery-service/1.2.1/shibboleth-embedded-ds-1.2.1.tar.gz -O shibboleth-eds.tar.gz
RUN tar xzf shibboleth-eds.tar.gz

WORKDIR shibboleth-embedded-ds-1.2.1
RUN make install

RUN mv /etc/shibboleth-ds/shibboleth-ds.conf /etc/apache2/conf-available/shibboleth-ds.conf
RUN sed -i 's/Allow from All/Require all granted/g' /etc/apache2/conf-available/shibboleth-ds.conf
RUN a2enconf shibboleth-ds.conf

# Adding RAP Apache configuration
COPY docker/rap.conf /etc/apache2/conf-available/
RUN a2enconf rap.conf

# Enable mod_rewrite (for Flight framework)
RUN a2enmod rewrite

# Copying RAP php files
WORKDIR /var/www/html
COPY . rap-ia2

WORKDIR /var/www/html/rap-ia2
RUN mkdir -p logs
RUN chown -R www-data logs

# Starting Apache
CMD apachectl -D FOREGROUND
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ abstract class BaseMySQLDAO {
     */
    public function getDBHandler(): PDO {
        $config = $this->locator->config->databaseConfig;
        $connectionString = "mysql:host=" . $config->hostname . ";dbname=" . $config->dbname;
        $connectionString = "mysql:host=" . $config->hostname . ";port=" . $config->port . ";dbname=" . $config->dbname;
        $dbh = new PDO($connectionString, $config->username, $config->password);
        // For transaction errors (see https://stackoverflow.com/a/9659366/771431)
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

docker/db/1-user.sql

0 → 100644
+5 −0
Original line number Diff line number Diff line
CREATE DATABASE rap;
CREATE USER rap@'%' IDENTIFIED BY 'rap123';
GRANT ALL PRIVILEGES ON rap.* TO rap@'%';

USE rap;

docker/db/Dockerfile

0 → 100644
+9 −0
Original line number Diff line number Diff line
FROM mariadb:10.4

ENV MYSQL_ROOT_PASSWORD=root

ADD docker/db/event.cnf /etc/mysql/conf.d/
ADD docker/db/1-user.sql /docker-entrypoint-initdb.d/
ADD sql/setup-database.sql /docker-entrypoint-initdb.d/

RUN sed -i.old '1s;^;USE rap\;\n;' /docker-entrypoint-initdb.d/setup-database.sql

docker/db/event.cnf

0 → 100644
+2 −0
Original line number Diff line number Diff line
[mysqld]
event_scheduler=1 
Loading