AppSwitch performs service discovery, access control, traffic management and telemetry functions on behalf of the applications by transparently and efficiently interposing the applications’ network API calls. In addition, AppSwitch decouples the application from the constructs of underlying network infrastructure by projecting a consistent, virtual view of the network to the application. In abstract terms, AppSwitch can be thought of as the docker equivalent for the networking stack. It combines the application-level functionality of a service mesh with the familiarity and compatibility of traditional networking.
Some of the use cases include:
- Automatically curated service registry for seamless service discovery even across hybrid environments.
- Extremely efficient enforcement of label-based access controls without any data path processing.
- Proxy-less load-balancing and traffic management across service instances.
- IP address portability with ability to assign arbitrary IP addresses to applications regardless of underlying network.
- Transparently redirect connection requests to alternate services without using NAT in case of application migration.
- "flat" connectivity with client IP preservation across hybrid network environments.
Installation of the binary (copying to /usr/bin) and bringing up of the daemon can be done with the following compose file:
version: '2.3' services: appswitch: image: appswitch/ax pid: "host" network_mode: "host" privileged: true volumes: - /usr/bin:/hostbin - /var/run/appswitch:/var/run/appswitch environment: - AX_DRIVER=user # Syscall forwarding driver - AX_NODE_INTERFACE= # Node interface to use by daemon. Accepts IP address or interface name, eg eth0 - AX_NEIGHBORS= # List (csv) of IP addresses of cluster neighbors - AX_CLUSTER= # Cluster name. Required if cluster is part of a federation - AX_FEDERATION_GATEWAY_IP= # IP address or `interface` name for federation connectivity - AX_FEDERATION_GATEWAY_NEIGHBORS= # List (`csv`) of IP addresses of federation neighbors (other gateway nodes) - AX_OPTS=--clean # Remove any saved state from previous sessions web: image: python:alpine entrypoint: /usr/bin/ax run --name web --ip 188.8.131.52 --expose 8000:0.0.0.0:10000 command: python -m http.server networks:  volumes: - /usr/bin/ax:/usr/bin/ax - /var/run/appswitch:/var/run/appswitch - /var/run/appswitch/appswitch-resolv.conf:/etc/resolv.conf curl: image: appropriate/curl entrypoint: /usr/bin/ax run --name curl --ip 184.108.40.206 command: curl -I 220.127.116.11:8000 networks:  volumes: - /usr/bin/ax:/usr/bin/ax - /var/run/appswitch:/var/run/appswitch - /var/run/appswitch/appswitch-resolv.conf:/etc/resolv.conf
Here is a screenshot showing its usage:
$ # Bring up AppSwitch Daemon $ docker-compose up -d appswitch Creating docker_appswitch_1 ... done $ $ # Bring up web service $ docker-compose up -d web docker_appswitch_1 is up-to-date Creating docker_web_1 ... done $ $ # curl it $ docker-compose up curl docker_appswitch_1 is up-to-date docker_web_1 is up-to-date Creating docker_curl_1 ... done Attaching to docker_curl_1 curl_1 | % Total % Received % Xferd Average Speed Time Time Time Current curl_1 | Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.0 200 OK 0 882 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl_1 | Server: SimpleHTTP/0.6 Python/3.7.0 curl_1 | Date: Thu, 11 Oct 2018 23:35:27 GMT curl_1 | Content-type: text/html; charset=utf-8 curl_1 | Content-Length: 882 curl_1 | docker_curl_1 exited with code 0