Skip to content

Commit

Permalink
Update config options and fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tobin C. Harding <me@tobin.cc>
  • Loading branch information
tcharding committed Jun 5, 2018
1 parent eee017a commit 2bb4f49
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 93 deletions.
20 changes: 9 additions & 11 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,32 @@ 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
* 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
* Extremely efficient enforcement of label-based access controls without
any data path processing.

* proxy-less load-balancing and traffic management across service instances
* 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
applications regardless of underlying network.

* transparently redirect connection requests to alternate services without
using NAT in case of application migration
* 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
environments.


.. toctree::
:maxdepth: 2
:caption: Contents:

overview
getting-started
arch
install
cli
api
integrations

References
Expand Down
143 changes: 61 additions & 82 deletions install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,99 +6,78 @@ Install and Configuration

Running the AppSwitch docker image will start the ``ax`` daemon and also copy
the binary onto the host at ``/usr/bin/ax``. No further installation is
required. However if you wish to run the daemon on the host without Docker then
please see below.
required.


Install on Bare Metal
=====================
Running the Daemon
==================

Although the usual use case for AppSwitch is to run it from within a docker
container we describe here the installation method to run AppSwitch directly on
a host machine.


Components
----------

The AppSwitch binary is used to run an application as well as running the
ax daemon.
It can be convenient to run the AppSwitch daemon in a container using
``docker-compose``. Here is an example docker-compose file
::

$ ax daemon & `# run the AppSwitch daemon`
$ ax run -- nc -l 9999 `# run netcat under AppSwitch`

For an application to be run under AppSwitch the AppSwitch (ax) daemon must
be running.

The daemon can be configured using a configuration file typically located
in ``/etc/default/ax.config``.
version: '2.3'

volumes:
appswitch_logs:

services:
appswitch:
image: appswitch/ax
pid: "host"
network_mode: "host"
privileged: true
volumes:
- /usr/bin:/usr/bin
- /dev:/dev
- /var/run/appswitch:/var/run/appswitch
- appswitch_logs:/var/log
env_file:
- ${AX_CONFIG_FILE:-ax.config}

test:
image: python:alpine
entrypoint: /usr/bin/ax run --name test
command: python -m http.server
privileged: true
networks: []
volumes:
- /usr/bin:/usr/bin
- /var/run/appswitch:/var/run/appswitch
depends_on:
- appswitch


As indicated in this docker-compose file the AppSwitch daemon can be
passed a config file by either setting an environment variable
``AX_CONFIG_FILE`` or placing the configuration options in a file called
``ax.config`` in the same directory as the docker-compose file above.

(You only need the ``/dev`` volume if you are using the kernel driver.)

The configuration file consists of environment variable definitions.
::

# Name of the node (defaults to host name)
APPSWITCH_NAME=

# Cluster name (defaults to appswitch)
APPSWITCH_CLUSTER=

# Name/IP of the interface to bind (defaults to first interface)
APPSWITCH_INTERFACE=

# Name/IP of the external interface to bind (for inter datacenter connectivity)
APPSWITCH_EXTERNAL_INTERFACE=
# AppSwitch configuration file template.
#
# Copy to ax.config or set AX_CONFIG_FILE within your environment.

# IP addresses of other nodes in the cluster for bootstrap (comma separated list)
APPSWITCH_NEIGHBORS=
# Syscall forwarding driver
AX_DRIVER=user

# IP addresses of other nodes in the cluster for bootstrap (comma separated list)
APPSWITCH_WAN_NEIGHBORS=
# Cluster config options.
AX_NODE_INTERFACE=
AX_NEIGHBORS=

# DNS domain for the appswitch cluster
APPSWITCH_DNS_DOMAIN="appswitch.local"
# Federation config options.
AX_CLUSTER=
AX_FEDERATION_GATEWAY_IP=
AX_FEDERATION_GATEWAY_NEIGHBORS=

# Additional options
APPSWITCH_OPTS=
# APPSWITCH_OPTS=--clean --dns-domain=local.appswitch
APPSWITCH_OPTS=--clean

These configuration options can also be passed to the daemon on the command
line.


Install
-------

AppSwitch is distributed as a static binary. Therefore to install all that
is required is placing the binary in your path, typically at ``/usr/bin/ax``.


Systemd
-------

You may like to bring up the daemon using systemd. To do so, first create a
service file ``/etc/systemd/system/ax.service``
::

[Unit]
Description=AppSwitch Daemon
Requires=network-online.target
After=network-online.target

[Service]
Restart=on-failure
EnvironmentFile=/etc/default/ax.config
ExecStart=/bin/sh -c '/usr/bin/ax daemon \
--service.name=$APPSWITCH_NAME \
--service.cluster=$APPSWITCH_CLUSTER \
--service.ip=$APPSWITCH_INTERFACE \
--service.extIp=$APPSWITCH_EXTERNAL_INTERFACE \
--service.neighbors=$APPSWITCH_NEIGHBORS \
--service.wanNeighbors=$APPSWITCH_WAN_NEIGHBORS \
--dns.domain=$APPSWITCH_DNS_DOMAIN \
$APPSWITCH_OPTS \
>> /var/log/ax.log 2>&1'

ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT
KillMode=control-group

[Install]
WantedBy=multi-user.target
Of course you can just run the daemon from the command line if you prefer
but then you will need to pass all configuration options on the command line.

0 comments on commit 2bb4f49

Please sign in to comment.