Docker image through mod proxy

From FusionForge Wiki
Jump to: navigation, search

This howto takes as hypothesis that you are aware of docker and how to use docker. The docker container is not for production usage but for demo or testing. This howto assumes that the patches mentioned at https://fusionforge.org/tracker/a_follow.php/954 has been added to git master and are included in the mentioned Docker image. If that is not the case, you need to apply them at the used docker image.

This howto describes adding a fusionforge sandbox (https access only, no http and ftp) to a running fusionforge host on <your_valid_fqdn> as an example (pathes and commands are for openSUSE and may be different on other distributions).

Configure the host

Enable mod_proxy for apache

a2enmod proxy

Add apache configuration for mod_proxy

cat >> /etc/fusionforge/httpd.d/sandbox.conf
SSLProxyEngine On
ProxyPass "/sandbox/" "https://<your_valid_fqdn>:444/"
ProxyPassReverse "/sandbox/" "https://<your_valid_fqdn>:444/"

Press CTRL-d to save file

Reload apache configuration

apache2ctl -k restart

Get the container

docker pull fusionforge/fusionforge:master

Create the container

docker create --cap-add=SYS_ADMIN -h <your_valid_fqdn> -v /etc:/host/etc \
  -e PORT_SSH=2222 -p 2222:22 -p 20:21 -p 81:80 -p 444:443 -i fusionforge/fusionforge:master

This command returns the containier id, which is used in further commands.

Start the container

docker start -i <container-id>

Configure the container

run shell inside the container

docker exec -it <container_id> /bin/bash

set the admin user password

forge_set_password admin <your_password>

copy ssl certifacte and key from the host apache installation

cd /etc/fusionforge
mv ssl-cert.key ssl-cert.key.orig
cp /host/etc/apache2/ssl.key/<host>.key ssl-cert.key
mv ssl-cert.pem ssl-cert.pem.orig
cp /host/etc/apache2/ssl.crt/<host>.crt ssl-cert.pem

Enable mod_proxy support in fusionforge

cat >> /etc/fusionforge/config.ini.d/zzz-local.ini

Press CTRL-d to save file

Use the container

Open your browser and go to https://<your_valid_fqdn>/sandbox/
You can connect as user with the login/password: admin/<your_password>

Detach the container

To remove the sandbox from the running fusionforge instance, use the following command on the host:

sed -i 's,^,#,g' /etc/fusionforge/httpd.d/sandbox.conf 
apache2ctl -k restart
docker stop -i <container-id>

Attach the container

To add the sandbox to the running fusionforge instance again, use the following command on the host:

docker start -i <container-id>
sed -i 's,^#,,g' /etc/fusionforge/httpd.d/sandbox.conf 
apache2ctl -k restart

Remove the container

To remove the container completly, run the following commands on the host:

rm /etc/fusionforge/httpd.d/sandbox.conf
apache2ctl -k restart
docker rm -f <container-id>