@@ -29,33 +29,43 @@ Instead of `some_secure_password` you put your password that later you should pr
2929
3030### Docker with TLS
3131
32+ In this case ExApps will only map host's loopback adapter, and will be avalaible to Nextcloud only throw HaProxy.
33+
3234``` shell
3335docker run -e NC_HAPROXY_PASSWORD=" some_secure_password" \
36+ -e BIND_ADDRESS=" x.y.z.z"
3437 -v /var/run/docker.sock:/var/run/docker.sock \
3538 -v ` pwd` /certs/cert.pem:/certs/cert.pem \
36- --name aa-docker-socket-proxy -h aa-docker-socket-proxy \
39+ --name aa-docker-socket-proxy -h aa-docker-socket-proxy --net host \
3740 --restart unless-stopped --privileged -d ghcr.io/cloud-py-api/aa-docker-socket-proxy:release
3841```
3942
40- Here in addition we map certificate file from host with SSL certificate that will be used by HaProxy.
43+ Here in addition we map certificate file from host with SSL certificate that will be used by HaProxy and specify to use the ` host ` network.
44+
45+ You should set ` BIND_ADDRESS ` to the IP on which server with ExApps can accept requests coming from the Nextcloud instance.
46+
47+ * This is necessary when using the “host” network so as not to occupy all interfaces, because ExApp will use loopback adapter.*
4148
4249> [ !WARNING]
4350> If the certificates are self-signed, your job is to add them to the Nextcloud instance so that AppAPI can recognize them.
4451
4552### AppAPI
4653
47- 1 . Create a daemon from the ` Docker Socket Proxy ` or ` Docker Socket Proxy Remote ` template in AppAPI.
54+ 1 . Create a daemon from the ` Docker Socket Proxy ` template in AppAPI.
48552 . Fill the password you used during container creation.
49- 3 . If ` Docker Socket Proxy Remote ` is used you need to specify the IP/DNS of the created HaProxy.
5056
5157### Additionally supported variables
5258
5359` HAPROXY_PORT ` : using of custom port instead of ** 2375** which is the default one.
5460
55- ` EX_APPS_NET ` : only for custom remote ExApp installs with TLS, determines destination of requests to ExApps for HaProxy.
61+ ` BIND_ADDRESS ` : the address to use for port binding. (Usually needed only for remote installs, ** must be accessible from the Nextcloud** )
62+
63+ ` EX_APPS_NET_FOR_HTTPS ` : only for custom remote ExApp installs with TLS, determines destination of requests to ExApps for HaProxy.
5664
5765## Development
5866
67+ ### HTTP(local)
68+
5969To build image locally use:
6070
6171``` shell
@@ -65,16 +75,54 @@ docker build -f ./Dockerfile -t aa-docker-socket-proxy:latest ./
6575Deploy image(for ` nextcloud-docker-dev ` ):
6676
6777``` shell
68- docker run -e NC_HAPROXY_PASSWORD=" some_secure_password" -v /var/run/docker.sock:/var/run/docker.sock \
69- --name aa-docker-socket-proxy -h aa-docker-socket-proxy --net master_default --privileged -d aa-docker-socket-proxy:latest
78+ docker run -e NC_HAPROXY_PASSWORD=" some_secure_password" \
79+ -v /var/run/docker.sock:/var/run/docker.sock \
80+ --name aa-docker-socket-proxy -h aa-docker-socket-proxy --net master_default \
81+ --privileged -d aa-docker-socket-proxy:latest
7082```
7183
72- If you need create Self-Signed cert for tests:
84+ After that create daemon in AppAPI from the Docker Socket Proxy template, specifying:
85+ 1 . Host: ` aa-docker-socket-proxy:2375 `
86+ 2 . Network in Deploy Config equal to ` master_default `
87+ 3 . Deploy Config: HaProxy password: ` some_secure_password `
88+
89+ ### HTTPS(remote)
90+
91+ We will emulate remote deployment still with ` nextcloud-docker-dev ` setup.
92+ For this we deploy ` aa-docker-socket-proxy ` to host network and reach it using ` host.docker.internal ` .
93+
94+ > [ !NOTE]
95+ > Due to current Docker limitations, this setup type is not working on macOS.
96+ > Ref issue: [ Support Host Network for macOS] ( https://github.com/docker/roadmap/issues/238 )
97+
98+ First create Self-Signed cert for tests:
7399
74100``` shell
75- openssl req -nodes -new -x509 -subj ' /CN=* ' -sha256 -keyout certs/privkey.pem -out certs/fullchain.pem -days 365000 > /dev/null 2>&1
101+ openssl req -nodes -new -x509 -subj ' /CN=host.docker.internal ' -sha256 -keyout certs/privkey.pem -out certs/fullchain.pem -days 365000 > /dev/null 2>&1
76102```
77103
78104``` shell
79105cat certs/fullchain.pem certs/privkey.pem | tee certs/cert.pem > /dev/null 2>&1
80106```
107+
108+ Place ` cert.pem ` into ` data/shared ` folder of ` nextcloud-docker-dev ` and execute inside Nextcloud container:
109+
110+ ``` shell
111+ sudo -u www-data php occ security:certificates:import /shared/cert.pem
112+ ```
113+
114+ Create HaProxy container:
115+
116+ ``` shell
117+ docker run -e NC_HAPROXY_PASSWORD=" some_secure_password" \
118+ -e BIND_ADDRESS=" 172.17.0.1" \
119+ -v /var/run/docker.sock:/var/run/docker.sock \
120+ -v ` pwd` /certs/cert.pem:/certs/cert.pem \
121+ --name aa-docker-socket-proxy -h aa-docker-socket-proxy --net host \
122+ --privileged -d aa-docker-socket-proxy:latest
123+ ```
124+
125+ After that create daemon in AppAPI from the Docker Socket Proxy template, with next parameters:
126+ 1 . Host: ` host.docker.internal:2375 `
127+ 2 . Tick ` https ` checkbox.
128+ 3 . Deploy Config: HaProxy password: ` some_secure_password `
0 commit comments