Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple services with mulitple Routing not working #2

Open
ssboopathi opened this issue Apr 30, 2019 · 0 comments
Open

Multiple services with mulitple Routing not working #2

ssboopathi opened this issue Apr 30, 2019 · 0 comments

Comments

@ssboopathi
Copy link

ssboopathi commented Apr 30, 2019

I have used on your files. It's working fine. I have added the extra two services in the docker-compose.yml file. I have removed the volume_from in all the services. I have removed the mongodb service in the docker-compose file.

microservice_first_hotels_fpm:
        build: ./microservices/first_hotels/php-fpm/
        links:
            - autodiscovery
        ports:
            - 9001:9000
        environment:
            - BACKEND=microservice-hotels-nginx
            - CONSUL=autodiscovery

microservice_second_hotels_fpm:
        build: ./microservices/second_hotels/php-fpm/
        links:
            - autodiscovery
        ports:
            - 9002:9000
        environment:
            - BACKEND=microservice-hotels-nginx
            - CONSUL=autodiscovery

microservice_third_hotels_fpm:
        build: ./microservices/third_hotels/php-fpm/
        links:
            - autodiscovery
        ports:
            - 9003:9000
        environment:
            - BACKEND=microservice-hotels-nginx
            - CONSUL=autodiscovery

    microservice_hotels_nginx:
        build: ./microservices/nginx/
        links:
            - autodiscovery
        environment:
            - BACKEND=microservice-first-hotels-fpm
            - BACKEND=microservice-second-hotels-fpm
            - BACKEND=microservice-third-hotels-fpm
            - CONSUL=autodiscovery
        ports:
            - 8081:80
            - 9091:9090

I have changed the folder structure. I have added below the folder structure.

hotels
    |_ source
        |_ index.php
        |_ first_hotel
             |_ Lumen Files
        |_ second_hotel
             |_ Lumen Files
        |_ third_hotel
             |_ Lumen Files
    |_ docker
        |_ autodiscovery
             |_ Dockerfile
        |_ microservices
             |_ nginx
                    |_ config
                            |_  containerpilot.json
                            |_  nginx
                                   |_  nginx.conf.ctmpl
                    |_ Dockerfile
                    |_ scripts
                            |_  reload.sh
                            |_  sensor.sh
             |_ first_hotels
                    |_ php-fpm
                            |_  config
                                   |_  containerpilot.json
                            |_  Dockerfile
                            |_  scripts
                                   |_  reload.sh
             |_ second_hotels
                    |_ php-fpm
                            |_  config
                                   |_  containerpilot.json
                            |_  Dockerfile
                            |_  scripts
                                   |_  reload.sh
             |_ third_hotels
                    |_ php-fpm
                            |_  config
                                   |_  containerpilot.json
                            |_  Dockerfile
                            |_  scripts
                                   |_  reload.sh

I have changed the microservice name in the containerpilot.json file for first_hotels, second_hotels, and third_hotels.

Microservices inside the nginx folder is there. That folder having the nginx.conf.ctmpl file. This file I have changed the server.

server {
    root /var/www/html/source;//I have changed the root url
   // I have added the following lines.
       location ^~ /first_hotels {
            root /var/www/html/source/first_hotels/public;
        }

        location ^~ /second_hotels {
            root /var/www/html/source/second_hotels/public;
        }

        location ^~ /third_hotels {
            root /var/www/html/source/third_hotels/public;
        }
}

Now I have used the command. docker-compose down

Again I have started the compose command.

docker-compose up --build -d

I have checked in browser with consul UI. It's working fine.

Screenshot from 2019-04-30 17-26-59

I have checked on the URL. It's showing 404 not found error.

Screenshot from 2019-04-30 17-23-23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant