View more context

 

guttmann

2 seconds, just upgrading a site from 4.3 to 4.4 so will know shortly 😛

guttmann

seems to work fine

taoceanz

Do you use image: brettt89/silverstripe-web with a particular tag?

guttmann

For SS4 sites we use: brettt89/silverstripe-web:7.1-platform

taoceanz

Cool, that's what I was considering using. That doesn't have anything to do with the SilverStripe Platform?

guttmann

you can see everything it installs here: https://github.com/brettt89/silverstripe-web/blob/master/7.1/platform/Dockerfile

Show 1 attachment(s)
7.1/platform/Dockerfile

FROM php:7.1-apache-jessie
MAINTAINER Brett Tasker "<[email protected]>"
ENV DEBIAN_FRONTEND=noninteractive

# Install components
RUN apt-get update -y && apt-get install -y \
        curl \
        git-core \
        gzip \
        libcurl4-openssl-dev \
        libgd-dev \
        libldap2-dev \
        libmcrypt-dev \
        libtidy-dev \
        libxslt-dev \
        zlib1g-dev \
        libicu-dev \
        g++ \
        openssh-client \
        libmagickwand-dev \
        unzip \
        zip \
    --no-install-recommends && \
    curl -sS <https://silverstripe.github.io/sspak/install> | php -- /usr/local/bin &amp;&amp; \
    curl -sS <https://getcomposer.org/installer> | php &amp;&amp; mv composer.phar /usr/local/bin/composer &amp;&amp; \
    pecl install xdebug &amp;&amp; \
    pecl install imagick-3.4.3 &amp;&amp; \
    apt-get remove -y libmagickwand-dev &amp;&amp; \
    apt-get install -y libmagickwand-6.q16-2 &amp;&amp; \
    apt-get autoremove -y &amp;&amp; \
    rm -r /var/lib/apt/lists/*

# Install PHP Extensions
RUN docker-php-ext-configure intl &amp;&amp; \
    docker-php-ext-configure mysqli --with-mysqli=mysqlnd &amp;&amp; \
    docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ &amp;&amp; \
    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ &amp;&amp; \
    docker-php-ext-enable xdebug &amp;&amp; \
    docker-php-ext-enable imagick &amp;&amp; \
    sed -i '1 a xdebug.remote_autostart=true' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini &amp;&amp; \
        sed -i '1 a xdebug.remote_mode=req' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini &amp;&amp; \
        sed -i '1 a xdebug.remote_handler=dbgp' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini &amp;&amp; \
        sed -i '1 a xdebug.remote_connect_back=1 ' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini &amp;&amp; \
        sed -i '1 a xdebug.remote_port=9000' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini &amp;&amp; \
        sed -i '1 a xdebug.remote_host=127.0.0.1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini &amp;&amp; \
        sed -i '1 a xdebug.remote_enable=1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini &amp;&amp; \
    docker-php-ext-install -j$(nproc) \
        intl \
        gd \
        ldap \
        mcrypt \
        mysqli \
        pdo \
        pdo_mysql \
        soap \
        tidy \
        xsl \
        zip

# Apache + xdebug configuration
RUN { \
                echo "&lt;VirtualHost *:80&gt;"; \
                echo "  DocumentRoot /var/www/html"; \
                echo "  LogLevel warn"; \
                echo "  ErrorLog /var/log/apache2/error.log"; \
                echo "  CustomLog /var/log/apache2/access.log combined"; \
                echo "  ServerSignature Off"; \
                echo "  &lt;Directory /var/www/html&gt;"; \
                echo "    Options +FollowSymLinks"; \
                echo "    Options -ExecCGI -Includes -Indexes"; \
                echo "    AllowOverride all"; \
                echo; \
                echo "    Require all granted"; \
                echo "  &lt;/Directory&gt;"; \
                echo "  &lt;LocationMatch assets/&gt;"; \
                echo "    php_flag engine off"; \
                echo "  &lt;/LocationMatch&gt;"; \
                echo; \
                echo "  IncludeOptional sites-available/000-default.local*"; \
                echo "&lt;/VirtualHost&gt;"; \
    } | tee /etc/apache2/sites-available/000-default.conf

RUN echo "ServerName localhost" &gt; /etc/apache2/conf-available/fqdn.conf &amp;&amp; \
    echo "date.timezone = Pacific/Auckland" &gt; /usr/local/etc/php/conf.d/timezone.ini &amp;&amp; \
    a2enmod rewrite expires remoteip cgid &amp;&amp; \
    usermod -u 1000 www-data &amp;&amp; \
    usermod -G staff www-data

EXPOSE 80
CMD ["apache2-foreground"]
Hide attachment content
guttmann

might just be that it installs php extensions that are also available on SilverStripe platform?

taoceanz

Ah yeah, I had the thought it wasn't intrinsically tied the the SilverStripe Platform, but that it get's it set up in line with the platform.

taoceanz

@guttmann do you have your entry point in a public folder? If so, did you do anything in particular to your Dockerfile to get the site loading correctly from the public folder?

guttmann

one of my sites uses the public folder but I'm relying on the .htaccess one level above the public folder to redirect all requests to public

guttmann

haven't messed around with the document root yet


Show less replies
MichalKleiner

nothing changed from 4.3 to 4.4 in terms of why it wouldn’t work

Karan Kumar

Hi Team, In SS3 we could do some thing like [in snippet below] and you could call $searchForm from page template but in SS4 we can't have two classes in one file, so when I separate out TestSearchPage and TestSearchPageController in two different files, page template can't call $searchForm. I tried adding getControllerName method in TestSearchPage class but that didn't help.

Karan Kumar

`<?php

class TestSearchPage extends Page {

}

class TestSearchPageController extends PageController { public function searchForm() {

}

public function index() {

}

}`

StefanO

@Karan Kumar have you enabled search in _config.php? e.g FulltextSearchable::enable(array(SiteTree::class));

StefanO

SearchForm is built in you shouldn't need to alter anything unless you want specific search behaviour

Karan Kumar

@StefanO Thanks for your help! sorry yes you're right my bad, I should have used something else. Actually I'm implementing Solr Search functionality and the true method name is SolrSearchForm(). But I haven't enabled search in _config.php. Just to keep things simple, if I change my method name from searchForm() -> toSomeRandomMethod(). Would I then be able to access $toSomeRandomMethod in TestSearchPage template in SS4 having two classes in two separate files?