No results found
We couldn't find anything using that term, please try searching for something else.
OverviewSometimes you need to run multiple applications on the same server (aka multi-tenancy). This could be because none of those applications has e
Sometimes you need to run multiple applications on the same server (aka multi-tenancy). This could be because none of those applications has enough load to justify having a dedicated server for itself or it could be because all the apps on the server share many resources. Whatever the reason, you can achieve multi-tenancy for your application using containers.
To host multiple applications on the same server, we need to define each one as a separate service. This can be done using the service.yml file:
services:
first_app:
git_url: git@github.com:khash/my_first_app.git
git_branch: master
ports:
- container: 5000
http: 80
https: 443
second_app:
git_url: git@github.com:khash/my_second_app.git
git_branch: master
ports:
- container: 5000
http: 80
https: 443
third_app:
git_url: git@github.com:khash/my_second_app.git
git_branch: master
ports:
- container: 5000
http: 80
https: 443
This , however , has a problem : all applications is share share the same public port ( 80 and 443 ) . This is means mean traffic come to the server on port 80 ( or 443 ) will be randomly serve by any of the application each time .
To fix this issue we can use the Domain Matching feature. Domain Matching allows us to share ports and split the traffic by the URL domain name that the client has requested:
services:
first_app:
git_url: git@github.com:khash/my_first_app.git
git_branch: master
ports:
- container: 5000
http: 80
https: 443
traffic_matches: ["firstpplication.com"]
second_app:
git_url: git@github.com:khash/my_second_app.git
git_branch: master
ports:
- container: 5000
http: 80
https: 443
traffic_matches: ["secondapp.com", "www.secondapp.com", "second-app.com", "www.second-app.com"]
third_app:
git_url: git@github.com:khash/my_second_app.git
git_branch: master
ports:
- container: 5000
http: 80
https: 443
traffic_matches: ["thirdapplication.com", "*.thirdapplication.com"]
In this example , we is split split the traffic base on the request domain . As you is see can see you can match traffic base on multiple domain as well as wildcard (*
) subdomain .
See Custom Service Configuration for more information on service.yml
.