Hello. I have used two docker-compose.yml files to create a meteor application using NginX and also nexcloud. I am able to see all my containers up and running. The meteor app is accessible using http and https, but my nextcloud and MariaDB are not accessible. I was told that I can modify the nginx.conf in my meteor app related container that redirects traffic to the next cloud container. Unfortunately I could not find a way to do so. I will be glad if you show me the way how to do so, in case someone knows about it. Thanks.
Hello,
How is your Docker Environment setup? Layer 7 Routing / Interlock? If yes you can do this in your docker-compose file, add this to the nginx service: com.docker.lb.redirects: “source,target”
If not here is something to help you:
Thanks a lot for your prompt response. Actually, The structure is as follows:
docker-compose.yml (1):
nginx (balances the load between the two nodes with the given URL to direct the traffic to the 80 and 443 ports)
node1
node2
docker-compose.yml (2):
next cloud
MariaDB
My problem is that I want to set up the nextcloud console to be redirected to port 8080 which I have set up the nextcloud on using one of the subdomains of nodes 1 and 2 URLs. Is there an easy fix for this issue?
Can you post the compose files?
Thanks. Sure. I have provided the two docker files below:
The main docker-compose for my web interface which is working normally:
version: "2"
services:
nginx:
build: ./nginx
container_name: container-nginx
restart: always
links:
- node1:node1
- node2:node2
ports:
- "80:80"
- "443:443"
volumes:
- "/etc/pki/tls/certs/:/etc/pki/tls/certs/"
- "/etc/pki/tls/private/:/etc/pki/tls/private/"
node1:
image: robo-meteor-base
container_name: app-node1
restart: always
env_file:
- .env
environment:
- SETTINGS_FILE=/home/meteor/settings-production.json
- ROOT_URL=https://www.example.com
- MONGO_URL=mongodb://user:pass@example.com:27017/meteordb
- BUNDLE_FILE=/home/meteor/code.tar.gz
volumes:
- ./images/production.tar.gz:/home/meteor/code.tar.gz
- ./code/settings-production.json:/home/meteor/settings-production.json
node2:
image: robo-meteor-base
container_name: app-node2
restart: always
env_file:
- .env
environment:
- SETTINGS_FILE=/home/meteor/settings-production.json
- ROOT_URL=https://www.example.com
- MONGO_URL=mongodb://user:pass@example.com:27017/meteordb
- BUNDLE_FILE=/home/meteor/code.tar.gz
volumes:
- ./images/production.tar.gz:/home/meteor/code.tar.gz
- ./code/settings-production.json:/home/meteor/settings-production.json
The second docker-compose is for my next cloud to be accessed under a URL like https://www.example.com/nextcloud:
version: '2'
volumes:
nextcloud:
db:
services:
mariadb:
image: mariadb
container_name: nextcloud_mariadb
restart: always
volumes:
- ./db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=pass123
- MYSQL_DATABASE=nextCloud
- MYSQL_PASSWORD=admin
- MYSQL_USER=admin
nextcloud:
image: nextcloud
container_name: nextcloud_app
ports:
- 8080:80
links:
- mariadb
volumes:
- ./nextcloud:/var/www/html
restart: always