github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/examples/caddy-lb/README.md (about)

     1  # IronFunctions Load Balance example using Caddy
     2  
     3  Simple example of IronFunctions load balancer using Caddy Server
     4  
     5  
     6  ## Run IronFunctions
     7  
     8  Start the IronFunctions instances
     9  
    10  Ref: https://github.com/iron-io/functions/blob/master/README.md#start-the-ironfunctions-api
    11  
    12  
    13  ## Configure environment variable
    14  
    15  Pass the host and port of IronFunctions instances in environment variables, 
    16  this example uses three IronFunctions instances.
    17  
    18  ```sh
    19  export LB_HOST01="172.17.0.1:8080"
    20  export LB_HOST02="172.17.0.1:8081"
    21  export LB_HOST03="172.17.0.1:8082"
    22  ```
    23  
    24  Note: Caddy doesn't support multiple hosts in only one variable. 
    25  
    26  
    27  ## Run Caddy
    28  
    29  ```sh
    30  docker run --rm  \
    31      -v $PWD/Caddyfile:/etc/Caddyfile  \
    32      -e LB_HOST01=$LB_HOST01 -e LB_HOST02=$LB_HOST02 -e LB_HOST03=$LB_HOST03 \
    33      -p 9000:9000  \
    34      abiosoft/caddy
    35  ```
    36  
    37  ## Execute a function
    38  
    39  Follow the Quick-Start steps replacing the example hosts by the Caddy host (localhost:9000)
    40  
    41  https://github.com/iron-io/functions/blob/master/README.md#quick-start
    42  
    43  
    44  ## Docker Compose example
    45  
    46  This is an additional example.
    47  
    48  ```sh
    49  docker-compose up
    50  ```
    51  
    52  
    53  ## Caddy Reference: 
    54  
    55  * https://github.com/mholt/caddy
    56  * https://caddyserver.com/
    57  
    58