[SOLVED] Docker Image

Post Reply
nickbrookes
Posts: 3
Joined: Wed May 16, 2018 9:01 am

[SOLVED] Docker Image

Post by nickbrookes »

I'm new to wondercms and also new to docker, but am trying to write a docker file image to quickly get a wondercms instance up and running with minimal effort. So far i can see the homepage fine, but login does not work :-(
In doing so i've created the dockerfile below and it's running through fine, but when i look at the site, the login url does not work. I've checked the .htaccess file is there and available.

GNU nano 2.8.0 File: dockerfile

#
# Super simple example of a Dockerfile
#
FROM ubuntu:latest
MAINTAINER Nick Brookes "my email address"

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get clean -q
RUN apt-get update -q
RUN apt-get install -qy apt-utils
RUN apt-get install -qy dialog
RUN apt-get install -qy apache2
RUN apt-get install -qy libapache2-mod-php7.2
RUN apt-get install -qy nano
RUN apt-get install -qy git-core
RUN apt-get install -qy php
RUN apt-get install -qy php-curl
RUN apt-get install -qy php-mbstring
RUN apt-get install -qy php-zip
RUN apt-get install -qy curl

RUN a2enmod rewrite
RUN rm -r /var/www/html
RUN git config --global http.sslVerify false
RUN git clone https://github.com/robiso/wondercms.git /tmp/wondercms/
RUN cp -Rr /tmp/wondercms/ /var/www/html/
RUN chown -R www-data:www-data /var/www/html
RUN chmod -R 775 /var/www/html
#RUN chown www-data:www-data /var/www/html/database.js
#RUN chmod 775 /var/www/html/database.js
RUN ls -lah /var/www/html
RUN service apache2 restart

WORKDIR /var/www/html
# Start the service
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_SERVERNAME www.nearlyleftmyurlinhere.com
EXPOSE 80
RUN service apache2 restart

as you can see i'm installing all of the required modules (i think) but it's not working.

Any ideas?

it's running PHP 7.2 on ubuntu 18.04 with apache2, no customisation etc as i've not got that far yet!

Once this is running, happy for anyone to build on / tidy up the docker image and maybe more people will use wondercms if its simple to spin up an instance in docker.

- addition html directory listing
-rwxrwxr-x 1 www-data www-data 6 May 16 08:49 version
drwxrwxr-x 1 www-data www-data 4.0K May 16 08:49 themes
-rwxrwxr-x 1 www-data www-data 1.1K May 16 08:49 license
-rwxrwxr-x 1 www-data www-data 45K May 16 08:49 index.php
-rwxrwxr-x 1 www-data www-data 10K May 16 08:49 README.md
-rwxrwxr-x 1 www-data www-data 1.9K May 16 08:49 CONTRIBUTING.md
-rwxrwxr-x 1 www-data www-data 811 May 16 08:49 .htaccess-ultimate
-rwxrwxr-x 1 www-data www-data 208 May 16 08:49 .htaccess
-rwxrwxr-x 1 www-data www-data 63 May 16 08:49 .gitignore
drwxrwxr-x 1 www-data www-data 4.0K May 16 08:49 .git
drwxr-xr-x 1 root root 4.0K May 16 08:49 ..
drwxr-xr-x 2 www-data www-data 4.0K May 16 08:53 plugins
drwxr-xr-x 2 www-data www-data 4.0K May 16 08:53 files
-rw-r--r-- 1 www-data www-data 2.3K May 16 08:53 database.js

I know 775 isn't great, but i'm just debugging atm.
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Docker Image

Post by wiz »

Let me start with the fact I have no experience with docker. I hope someone can jump in and help you better than I can.

It seems that the URL rewriting isn't working properly, although it seems you have enabled the mod rewrite with "RUN a2enmod rewrite".
- you can do a quick test: try visiting: yourWebsite.com/?page=loginURL (replace yourWebsite with your actual website).
- if the above works, we'll know the issues is in the htaccess (mod_rewrite module).

Can you also turn on (full) error reporting and see if there are any weird errors showing up?

Also, I chuckled with the "nearlyleftmyurlinhere" comment.
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Docker Image

Post by wiz »

Found something possibly useful from askubuntu: https://askubuntu.com/questions/422027/ ... ot-working (check link for more possible solutions).

Quoted from the website:
You need to allow the overwrite.

<Directory "/path/to/document/root/">
AllowOverride All
Allow from All
</Directory>
Try the yourSite.com/?page=loginURL from my previous post first and see if the mod rewrite is the issue, then try the above.
nickbrookes
Posts: 3
Joined: Wed May 16, 2018 9:01 am

Re: Docker Image

Post by nickbrookes »

edited /etc/apache2.conf

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All - changed this value from none.
Require all granted
</Directory>


It now works.

It wasn't a docker issue, just an apache configuration issue!
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Docker Image

Post by wiz »

Thanks for giving it a try and sharing, don't forget to roll back the permissions. :)

Marking thread as solved.

Will add this docker image to the documentation and also credit your work. :)
Post Reply