Changes

From Amahi Wiki
Jump to: navigation, search
753 bytes added ,  23:05, 27 August 2017
no edit summary
==Architecture Overview==
// TODO - Add image here
The idea of implementation is very similar to what is showing in the image above. Each app will run as a container. Each container will expose their own port// TODO ports as can be seen as `exposed port` in the diagram above. We can map a host system port (`mapped port` in the diagram) to the `exposed port` in the container. And then using reverse proxy we can connect different subdomains to different container apps. ===How it Works?===Lets assume we are trying to run multiple container apps. Let them be App1, App2, App3 and App4.  NOTE: Each app will have its own networking stack and hence can run a service on any port that they want.   App1 - 9000, 80 App2 - 8000, 80 App3 - 5000, 80 App4 - 22, 80  Each app has a web server running on port 80 (let’s assume) and they have some other service running on different ports. There can be multiple services running on different ports.  We want the web interface of each of the app to be accessible to a user. Assume a user is running their HDA at IP address: 192.168.56.105 and domain amahi.net  They want to access App1 at app1.amahi.net, App2 at app2.amahi.net and so on. Inside the HDA each app is running inside an isolated environment with their own networking stack and hence they are not reachable from the outside world. So how do we work around this problem? The answer to that is reverse proxy. We have apache running on our HDA which handles all the requests coming on *.amahi.net. So for container apps we bind their web server port with a port on the host.   App1 -> 80 binds to -> 35001 on host App2 -> 80 binds to -> 35002 on host App3 -> 80 binds to -> 35003 on host App4 -> 80 binds to - Add image here> 35004 on host This “binding” is similar to port forwarding. Docker by default runs these containers on a separate network and each of those containers have an IP address (local, accessible only inside the host machine) and run their own networking stack.
The idea of implementation Once the port binding is very similar to what is showing in complete if we access -> http://192.168.56.105:35001 we should get the image aboveweb interface of App1 and so on. Each But for our users we want the app will run as a containerto be reachable at app1.amahi.net. Each container will expose their own port/ports as can be seen as `exposed port` in So earlier the diagram above. We can map hda used to create a virtual host system port (`mapped port` in the diagram) file for each app which used to run the `exposed port` in relevant app server based on the containerurl. And then using reverse proxy we can connect different subdomains to different For container apps. , the present approach does this:
The apache running on host reverse proxies all requests coming on http://app1.amahi.net to http://localhost:35001 , This has been explained in detail in way for the user the url is http://app1.amahi.net and they can still access the web interface of the Design Documentapp.
==How the app installation works?==
===Reverse Proxy===
====Why is it needed?====
Each app will be running insidea container and they will attach Please refer to some port/ports on the host machine. For example, imagine if you are running an app like gitlab in container. Gitlab might require different ports for different things. Inside the container different services can run on any port as containers run in an isolated environment and have their own network stack. But ultimately the services running on these containers have [[Architecture Overview]] to be reachable from the outside world. To make that possible we have to bind a port inside the container with a host port.  Gitlab App - Inside Container - Web Server Running on port 80We have to bind this with a port on host machine (our HDA). Let's assume we bind understand why it to port 35001. Now typing amahi.net:35001/ in the browser will open gitlab website. OSticket app - Inside Container - Web Server Running on port 9000Let's bind this to port 35002 on host machine. Now typing amahi.net:35002/ in the browser will open osticket website.  As we can see that each of these apps web interface is accessible on different ports but we want to achieve a behaviour like:  osticket.amahi.net -> opens osticket which is running on amahi.net:35002/gitlab.amahi.net -> opens gitlab which is running on amahi.net:35001/ But the url end point should be the same, i.e osticket.amahi.net and gitlab.amahi.net . To attain this behaviour we have to use Reverse Proxyneeded.  
For reverse proxy I have added a new app-container.conf file which can be seen below. The `APP_PORT` is changed during runtime.
15

edits