Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

Question: Setting the container up for connection to another database host #1

Closed
SeppPenner opened this issue Mar 4, 2018 · 10 comments

Comments

@SeppPenner
Copy link

Let's assume that I already have a MySQL instance running on server 192.168.2.205 and already existing phpBB tables in it.

Your container seems to be perfect for my use case:

  • Running phpBB on another host (let's say 192.168.2.212) with connection to the MySQL DB on 192.168.2.205 (Let's assume username and password/ database all to be phpBB)

  • SSL only, so I do only want to have port 443 for the Webserver (disallow HTTP, enforce HTTPS)

  • No additional requirements (Except using volumes for the Html data)

  • No backups or so one needed (On AWS or whatever)

So the question is: How can I configure the container like that? :D

@SeppPenner
Copy link
Author

The SSL should be self-signed^^ Forgot to mention tat.

@blueimp
Copy link
Owner

blueimp commented Mar 4, 2018

Hi @SeppPenner,

a sample docker-compose.yml for your desired configuration would be the following:

version: '2.3'
services:
  phpbb:
    image: blueimp/phpbb:3.2
    ports:
      - 443:443
    environment:
      - SERVER_NAME=example.org
      - DBHOST=192.168.2.205
      - DBPORT=3307
      - DBNAME=phpBB
      - DBUSER=phpBB
      - DBPASSWD=phpBB
    volumes:
      - ./ssl:/etc/apache2/ssl
      - ./files:/var/www/html/files
      - ./store:/var/www/html/store
      - ./avatars-upload:/var/www/html/images/avatars/upload

The container runs a redirect service from HTTP to HTTPS, but as long as you don't expose port 80, only HTTPS is served.
By simply not using the blueimp/phpbb-s3-backup image, no automatic backups are configured.

For the self-signed SSL certificate, you could follow the SSL setup guide.

The other host mounts are for your existing files, store and
images/avatars/upload phpBB directories, so you have to copy them in the directory of docker-compose.yml.

@SeppPenner
Copy link
Author

Hi @blueimp,
thank you for the answer. I will try this out tomorrow.
I have already done some not successful tests with this container: https://github.com/MarvAmBass/docker-nginx-ssl-secure and now I'm searching for an alternative ;)

@SeppPenner
Copy link
Author

Hi @blueimp,

I have now the following setup:
grafik

where I only adjusted the passwords and host and so on in the Dockerfile:

ENV \
  DBHOST=192.168.2.205 \
  DBPORT=3307 \
  DBNAME=phpBB \
  DBUSER=default \
  DBPASSWD=SomePassword \
  TABLE_PREFIX=phpbb_ \
  PHPBB_INSTALLED=false \
  AUTO_DB_MIGRATE=false

I generated SSL files locally under the ssl subfolder in the same folder as the Dockerfile. (See image)

Building the Dockerfile locally with docker build . -f Dockerfile works:

Step 12/12 : CMD ["phpbb-apache2"]
---> Running in daa6ee4a57db
Removing intermediate container daa6ee4a57db
---> cc2546484f13
Successfully built cc2546484f13

If I try to run the Dockerfile now with e.g.

docker run \
-p 443:443 \
--restart always \
--name nginxphpbb \
cc2546484f13

I get the following message:

root@raspberrypi:/opt/Docker/phpBB# docker run \

-p 443:443
--restart always
--name nginxphpbb
cc2546484f13
Usage: apache2 [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t -D DUMP_INCLUDES: show all included configuration files
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)

and the web server under the IP address does not respond...


Why do I use the Dockerfile and not docker-compose? --> The docker-compose setup from the official site does somehow not work...

Is my database port really 3307? --> Yes. Was changed during the update from MariaDB5 to MariaDB10.

@SeppPenner
Copy link
Author

SeppPenner commented Mar 11, 2018

Do you have any idea what's wrong there? Thank you in advance 👍

EDIT:
I've put all my files and the steps I did so far into this repository: https://github.com/SeppPenner/DockerNginxSSLFailed (Never mind the SSL files included, I will generate new ones at the next start, so they can be exposed).

@blueimp
Copy link
Owner

blueimp commented Mar 13, 2018

You get that error cause you did not host-mount the SSL directory, nor did you pass on the SERVER_NAME environment variable.

A working invocation with your setup would be:

docker run -v "$PWD/ssl:/etc/apache2/ssl" -e SERVER_NAME=localhost nginxphpbb

There are some other issues with your setup:

  • Instead of copying the Dockerfile code and then adjusting it, you could simply extend it with the Dockerfile instruction FROM blueimp/phpbb.
  • Hard-coding database hostnames in a Dockerfile is not a good idea, as hostnames can change
  • Setting PHPBB_INSTALLED=false in the Dockerfile is not a good idea as this will download the phpBB source everytime, unless you override the environment variable. This should be set if needed only (usually at setup time).

I'm closing this issue ticket now, as this is really not about any issue with this project, but rather about your specific setup requirements.
Of course you can still continue to comment and I'll still try to help you out.

@SeppPenner
Copy link
Author

Thank you, @blueimp. It works now 👍

https://github.com/SeppPenner/DockerNginxSSLFailed

@SeppPenner
Copy link
Author

SeppPenner commented Mar 18, 2018

Just one more thing: When I setup the board with the phpBB install page, I always get the following message:

grafik

Renaming the install directory in the container:

docker exec -t -i phpbb /bin/bash
cd /var/www/html/phpbb
mv install install_old

does not seem to solve this.

Do you have any suggestions here? Thanks again for your patience :)

@blueimp
Copy link
Owner

blueimp commented Mar 20, 2018

Make sure that PHPBB_INSTALLED=true when starting the container, then no install directory should be present.

@SeppPenner
Copy link
Author

Ok, thanks. But now I get the following message:

[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 255: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 317: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 255: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 317: mysqli_free_result(): Couldn't fetch mysqli_result
Fatal: ./cache/production/ is NOT writable.

grafik

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants