Set url for Docker App

I plan to dockerize a LAMP Stack for hosting own php code. Using the build-in lamp doesn’t work since the code I’m using relys on PHP 7.1 and UCS only supports 7.0.

My approach is to use this docker image: https://github.com/mattrayner/docker-lamp
And run it with docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql --restart always mattrayner/lamp:latest

But where do i config the url like ucs.my.intranet/lamp?
And how to register this to be displayed in ucs.my.intranet/univention/portal?

To have a real UCS App for a lamp stack would be great, especially with a UI in univention portal for setting the php version, php libraries like gd-lib and changing the php.ini. But after reading the docs I don’t feel like this is something I could do easily.

Hi @Amerlander,

You can not bind it to port 80, since the Univention Apache is already listening on this port.

For it to be reachable from the web and alsop to show up in the univention portal you need to run some additional commands on the system.

You can have a look at https://github.com/fbartels/univention-bitwarden/blob/master/start-bitwarden_rs.sh#L143-L154 to see how I create a Portal link for my Bitwarden app running on UCS. And have a look at https://github.com/fbartels/univention-netdata to see how to pull in a Docker app that should run in a subfolder.

Disclaimer: I cannot speak for the quality of the Docker image that you linked to. My personal impression is that I would not want to use a single container that holds all of Apache, MySQL and PHP. Rather you should look at using the mysql/mariadb running on the UCS system instead.

Hey fbartels,
thank you. Ill take a look at your repos.

You are right, I do not need a container holding apache and mysql. Just a php docker image >= 7.1 would be enough. I just thought it would be easier to serve everything in one package but I think I’ll try to figgure out how I can use the ucs apache and mysql within a php docker.

You can create a file /etc/apache2/sites-enabled/my-lamp.conf with content:

ProxyPass /lamp https://127.0.0.1:41001/lamp retry=0
ProxyPassReverse /lamp https://127.0.0.1:41001/lamp

The port 41001 would be the port you expose from the PHP-app in the Docker container. https is assuming you want to use this with HTTPS.

Hello troeder,
thank you too for your reply.

I was able to use a docker with
docker run -d -p "41001:443" -p "41002:80" -v $(pwd)/app:/app/myapp --restart always --name myapp webdevops/php-apache:7.3

pass it trough in /etc/apache2/sites-enabled/myapp.conf with

ProxyPass /myapp https://127.0.0.1:41001/myapp retry=0
ProxyPassReverse /myapp https://127.0.0.1:41001/myapp

ProxyPass /myapp http://127.0.0.1:41002/myapp retry=0
ProxyPassReverse /myapp http://127.0.0.1:41002/myapp

and finaly add them in ucs panel with

ucr set 
ucs/web/overview/entries/service/phpbb-myapp/description="My App" 
ucs/web/overview/entries/service/phpbb-myapp/label/de="My App" 
ucs/web/overview/entries/service/phpbb-myapp/label="My App" 
ucs/web/overview/entries/service/phpbb-myapp/link="/myapp"

So thank you both, your answers were really helpful and lead me to an solution :slight_smile:

2 Likes