Running on alternate ports

#1

I’m trying to run devilbox on a shared machine that I have where I already have the native ubuntu apache running on port 80 and mysql running on 3306

So when trying to do the docker-compose up -d, it throws errors

I’ve modified both the env file and the yml file, trying to move devilbox to port 8080 and mysql to 3307 - is that possible?

I’m following the following


which as I read it, seems to say that only the php versions uncommented in the env file should be pulled down during the initial start up
first time I ran update-docker.sh it pulled down every PHP version, although 7.2 was the only one uncommented :

#PHP_SERVER=5.2
#PHP_SERVER=5.3
#PHP_SERVER=5.4
#PHP_SERVER=5.5
#PHP_SERVER=5.6
#PHP_SERVER=7.0
#PHP_SERVER=7.1
PHP_SERVER=7.2
#PHP_SERVER=7.3
#PHP_SERVER=7.4

I had to modify the IMAGES line below - taking out the #*
IMAGES="( grep -Eo '^PHP_SERVER=[.0-9]+' "{CWD}/env-example" | sed ‘s/.*=//g’ )"

#2

update-docker.sh will initially pull or update every single version that could be enabled via the Devilbox. If you simply want to pull the versions you have selected use docker-compose pull

Yes, that is very much possible via .env file

# Change ports of MySQL
HOST_PORT_MYSQL=3307

# Change ports of HTTPD
HOST_PORT_HTTPD=8080
HOST_PORT_HTTPD_SSL=4443

For more detailed information about the .env file, have a look here: https://devilbox.readthedocs.io/en/latest/configuration-files/env-file.html

#3

Hey, so - a few followup questions, I followed the advice here, and made a few modifications to avoid my existing host servers’ port bindings, but now I’m unsure of how to set up my DNS and access the vhost locations in the container…

I set LOCAL_LISTEN_ADDR to 192.168.xx.xxx:
HOST_PORT_HTTPD=8045 & HOST_PORT_HTTPD_SSL=8055

How would I set my DNS?
I assume 127.0.0.1 isn’t correct, but the wizardry of docker “networks” is beyond my comprehension…
I tried the default of 127.0.0.1 testone.loc in /etc/hosts, that did not work unsurprisingly, but I’m not sure how to correctly refer to the assets to be served.

I was also wondering if there was a way to configure the included Postfix instance to send email externally? is the main.cf file present in the container somewhere?

Thank you in advance!

#4

I haven’t used this much recently, but here is my config …

Default here, so 127.0.0.1

LOCAL_LISTEN_ADDR=

I am using ports 8080 for the webserver and 8443 for SSL

Expose HTTPD Port to Host

HOST_PORT_HTTPD=8080
HOST_PORT_HTTPD_SSL=8443

/etc/hosts entries to my virt hosts with a .loc extension :

127.0.0.1 geolaw.loc
127.0.0.1 corleen.loc

And I have my websites in the data/www/ directory off the devilbox directory :

]$ ls -la data/www
total 16K
drwxr-xr-x 4 glaw glaw 4.0K Jan 28 12:04 .
drwxrwxr-x 7 glaw glaw 4.0K Jan 28 11:38 …
drwx–x--x 8 glaw glaw 4.0K Jan 28 14:57 corleen
drwxrwxr-x 3 glaw glaw 4.0K Jan 28 11:49 geolaw
-rw-rw-r-- 1 glaw glaw 0 Jan 28 11:38 .keepme

So from the machine running devilbox, I can hit corleen.loc:8080 and geolaw.loc:8080

I think to do the 192.168.xx.xx local address, you would need to bring those addressed up on the host machine (ie additional virtual adresses - eth0:1 eth0:2 ) and then pass those through to docker

#5

Hey thanks!!

I ended up just using docker’s internal 172 address, and using an NGINX proxy

So my server has an aaddresss 192.xxxxx and on port 9089, it does a proxy pass to 172.xxxx:9089.
Its really clunky to me, but it works. I think I’m just not getting the whole docker concept just yet, your solution seems to at least represent the right kind of thinking, when this storm passes I’ll do a little more testing and feeling to gain some competency here…

Now on to fair Postfix!

P.S. - my Nginx config if you’re interested:

vim /etc/nginx/conf.d/devilbox.conf

server {
listen 8098 ssl;
ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;
ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
ssl on;
location / {
proxy_pass https://172.16.xxx.xx:8098;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_http_version 1.1;
}
}

Cheers!

#6

@mjhd regardint the Postfix setup, there is currently no easy way to disable this (as far as I remember). The catch-all is enabled by this env variable: https://github.com/devilbox/docker-php-fpm#launch-postfix-for-mail-catching

You can try to hard-code this to 0 in the docker-compose.yml and see if that works out for you or not. (It’s really been a long time since I hacked that together). Let me know either way and I will probably have to reconsider the Postfix setup.

#7

Hey ok, I’m going to take a look over the next day or two… I’m trying to build a simple, per user, sync/backup/restore application and I’m going to try out UserFrosting, which requires working SMTP. I’ll let you know what I find out and if I come up with any workable solutions :smiley: