Skip to content

Instantly share code, notes, and snippets.

@jdbohrman
Forked from DenisIzmaylov/NOTES.md
Created November 30, 2018 12:15

Revisions

  1. @DenisIzmaylov DenisIzmaylov revised this gist Jun 6, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -279,6 +279,7 @@ ssh core@<host1> 'bash -s' < custom-firewall.sh
    sudo systemctl start etcd2
    sudo systemctl status etcd2
    sudo journalctl -xe
    sudo journalctl -xep3
    sudo journalctl -ru etcd2
    ```

  2. @DenisIzmaylov DenisIzmaylov revised this gist Jun 4, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -327,6 +327,8 @@ sudo update_engine_client -update
    sudo reboot
    ```
    See more details [here.](https://coreos.com/os/docs/latest/update-strategies.html)
    ## Install Deis v1
    Attention! It seems that doesn't work correctly with Online.net and other bare metal setups because `ceph` which is using for v1 works unstable and unpredictable. But if you would like to make an experiment, let's go:
  3. @DenisIzmaylov DenisIzmaylov revised this gist Apr 6, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion NOTES.md
    Original file line number Diff line number Diff line change
    @@ -396,9 +396,9 @@ Attention! It seems that doesn't work correctly with Online.net and other bare m
    + [Gist: Running a High Availability Service on CoreOS using Docker, Fleet, Flannel, Etcd, Confd & Nginx](https://gist.github.com/learncodeacademy/2a11bd906c87cf2301a1)
    + [Docker Fleet Starter](https://github.com/sedouard/fleet-bootstrapper)<sup>[github repo]</sup>
    + [Do Not Use Public Discovery Service For Runtime Reconfiguration](https://github.com/coreos/etcd/blob/master/Documentation/runtime-reconf-design.md#do-not-use-public-discovery-service-for-runtime-reconfiguration)<sup>[tips]</sup>
    + [docker-nginx-https-redirect](https://github.com/coreos/docker-nginx-https-redirect)

    ## Appendix 2 - Tools and Services

    + [docker-nginx-https-redirect](https://github.com/coreos/docker-nginx-https-redirect)
    + [Monitor CoreOS at scale with DataDog](https://www.datadoghq.com/blog/monitor-coreos-scale-datadog/)
    + [CoreGI - WebUI for monitoring CoreOS clusters including fleet and etcd](https://github.com/yodlr/CoreGI)
  4. @DenisIzmaylov DenisIzmaylov revised this gist Apr 6, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -396,6 +396,7 @@ Attention! It seems that doesn't work correctly with Online.net and other bare m
    + [Gist: Running a High Availability Service on CoreOS using Docker, Fleet, Flannel, Etcd, Confd & Nginx](https://gist.github.com/learncodeacademy/2a11bd906c87cf2301a1)
    + [Docker Fleet Starter](https://github.com/sedouard/fleet-bootstrapper)<sup>[github repo]</sup>
    + [Do Not Use Public Discovery Service For Runtime Reconfiguration](https://github.com/coreos/etcd/blob/master/Documentation/runtime-reconf-design.md#do-not-use-public-discovery-service-for-runtime-reconfiguration)<sup>[tips]</sup>
    + [docker-nginx-https-redirect](https://github.com/coreos/docker-nginx-https-redirect)

    ## Appendix 2 - Tools and Services

  5. @DenisIzmaylov DenisIzmaylov revised this gist Apr 5, 2016. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,7 @@ This guide describes how to bootstrap new Production Core OS Cluster as High Ava
    + [Configure Firewall Rules](#configure-firewall-rules)
    + [Load Balancers and Service Discovery](#load-balancers-and-service-discovery)
    + [Troubleshooting](#troubleshooting)
    + [Update CoreOS](#update-coreos)
    + [Usage with Deis v1](#usage-with-deis-v1)
    + [Appendix 1 - Info and Tutorials](#appendix-1---info-and-tutorials)
    + [Appendix 2 - Tools and Services](#appendix-2---tools-and-services)
    @@ -319,6 +320,13 @@ ssh core@<host1> 'bash -s' < custom-firewall.sh
    ssh -A <your-host>
    ```

    ## Update CoreOS

    ```
    sudo update_engine_client -update
    sudo reboot
    ```
    ## Install Deis v1
    Attention! It seems that doesn't work correctly with Online.net and other bare metal setups because `ceph` which is using for v1 works unstable and unpredictable. But if you would like to make an experiment, let's go:
  6. @DenisIzmaylov DenisIzmaylov revised this gist Mar 10, 2016. 3 changed files with 22 additions and 8 deletions.
    10 changes: 9 additions & 1 deletion someapp-discovery@.service
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,18 @@
    [Unit]
    Description=Announce Someapp%i

    # Requirements
    BindsTo=someapp@%i.service
    Requires=etcd2.service
    Requires=docker.service

    # Dependency ordering
    After=someapp@%i.service
    After=etcd2.service
    After=docker.service

    [Service]
    ExecStart=/bin/sh -c "sleep 10; while true; do etcdctl set /services/someapp/upstream/someapp%i \"$(sleep 5 && docker inspect -f '{{.NetworkSettings.IPAddress}}' someapp%i):3000\" --ttl 60; sleep 45; done"
    ExecStart=/bin/sh -c "while true; do etcdctl set /services/someapp/upstream/someapp%i \"$(sleep 5 && docker inspect -f '{{.NetworkSettings.IPAddress}}' someapp%i):3000\" --ttl 60;sleep 45;done"
    ExecStop=/usr/bin/etcdctl rm /services/someapp/upstream/someapp%i

    [X-Fleet]
    11 changes: 7 additions & 4 deletions someapp-lb@.service
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,14 @@
    [Unit]
    Description=someapp-lb%i
    After=docker.service

    # Requirements
    Requires=docker.service
    After=etcd2.service
    Requires=etcd2.service

    # Dependency ordering
    After=docker.service
    After=etcd2.service

    [Service]
    # Let the process take awhile to start up (for first run Docker containers)
    TimeoutStartSec=0
    @@ -16,12 +20,11 @@ KillMode=none
    # Get CoreOS environmental variables
    EnvironmentFile=/etc/environment

    # Pre-start and Start
    # Directives with "=-" are allowed to fail without consequence
    ExecStartPre=-/usr/bin/docker kill someapp-lb%i
    ExecStartPre=-/usr/bin/docker rm someapp-lb%i
    ExecStartPre=/usr/bin/docker pull denisizmaylov/nginx-lb
    ExecStart=/usr/bin/sh -c "/usr/bin/docker run --name someapp-lb%i --rm -p 80:80 -e SERVICE_NAME=someapp -e ETCD=\"$(ifconfig docker0 | awk '/\<inet\>/ { print $2}'):2379\" denisizmaylov/nginx-lb"
    ExecStart=/usr/bin/sh -c "/usr/bin/docker run --name someapp-lb%i --rm -p 80:80 -e SERVICE_NAME=someapp -e ETCD=\"$(ifconfig docker0 | awk '/\\<inet\\>/ { print $2 }'):2379\" denisizmaylov/nginx-lb"
    ExecStop=/usr/bin/docker stop someapp-lb%i

    [X-Fleet]
    9 changes: 6 additions & 3 deletions someapp@.service
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,15 @@
    [Unit]
    Description=someapp%i
    After=docker.service
    Requires=docker.service
    After=docker.service

    [Service]
    # Let the process take awhile to start up (for first run Docker containers)
    TimeoutStartSec=0

    # Directives with "=-" are allowed to fail without consequence
    ExecStartPre=-/usr/bin/docker kill someapp%i
    ExecStartPre=-/usr/bin/docker rm someapp%i
    ExecStartPre=/usr/bin/docker pull denisizmaylov/node-sample
    ExecStart=/usr/bin/docker run --name someapp%i -e APPNAME=someapp%i denisizmaylov/node-sample
    ExecStop=/usr/bin/docker kill someapp%i
    ExecStart=/usr/bin/docker run -e APPNAME=someapp%i --name someapp%i -P denisizmaylov/node-sample
    ExecStop=/usr/bin/docker stop someapp%i
  7. @DenisIzmaylov DenisIzmaylov revised this gist Mar 10, 2016. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions someapp-lb@.service
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,22 @@
    Description=someapp-lb%i
    After=docker.service
    Requires=docker.service
    After=etcd2.service
    Requires=etcd2.service

    [Service]
    # Let the process take awhile to start up (for first run Docker containers)
    TimeoutStartSec=0

    # Change killmode from "control-group" to "none" to let Docker remove
    # work correctly.
    KillMode=none

    # Get CoreOS environmental variables
    EnvironmentFile=/etc/environment

    # Pre-start and Start
    # Directives with "=-" are allowed to fail without consequence
    ExecStartPre=-/usr/bin/docker kill someapp-lb%i
    ExecStartPre=-/usr/bin/docker rm someapp-lb%i
    ExecStartPre=/usr/bin/docker pull denisizmaylov/nginx-lb
  8. @DenisIzmaylov DenisIzmaylov revised this gist Mar 10, 2016. No changes.
  9. @DenisIzmaylov DenisIzmaylov revised this gist Mar 10, 2016. 1 changed file with 50 additions and 47 deletions.
    97 changes: 50 additions & 47 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ This guide describes how to bootstrap new Production Core OS Cluster as High Ava
    + [Create Fleet Units](#create-fleet-units)
    + [Configure Firewall Rules](#configure-firewall-rules)
    + [Load Balancers and Service Discovery](#load-balancers-and-service-discovery)
    + [Troubleshooting](#troubleshooting)
    + [Usage with Deis v1](#usage-with-deis-v1)
    + [Appendix 1 - Info and Tutorials](#appendix-1---info-and-tutorials)
    + [Appendix 2 - Tools and Services](#appendix-2---tools-and-services)
    @@ -165,16 +166,6 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.

    Sometimes it takes a time. Don't panic. Just wait for a few minutes.

    If something goes wrong use follow commands to debug:

    ```bash
    # use for etcd2, fleet, etcd
    sudo systemctl start etcd2
    sudo systemctl status etcd2
    sudo journalctl -xe
    sudo journalctl -ru etcd2
    ```

    9. Repeat those steps for each server in your cluster.

    10. Check your cluster health and fleet status:
    @@ -239,8 +230,56 @@ See: [Launching Containers with fleet](https://coreos.com/fleet/docs/latest/laun
    test-app@2.service a78a3229.../10.1.9.18 active running
    test-app@3.service 081c8a1e.../10.1.9.19 active running
    ```

    ### Configure Firewall Rules

    Run [custom-firewall.sh](https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-firewall.sh) from Deis v1 on your local machine:

    ```bash
    curl -O https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-firewall.sh
    # run follow line for each server
    ssh core@<host1> 'bash -s' < custom-firewall.sh
    ```

    ### Load Balancers and Service Discovery

    1. Download [someapp@.service](#file-someapp-service), [someapp-discovery@.service](#file-someapp-discovery-service) and [someapp-lb@.service](#file-someapp-lb-service).
    2. Modify those Unit Templates according to your application config.
    3. Submit modificated files to your Fleet:

    ```bash
    fleetctl submit someapp@.service
    fleetctl submit someapp-discovery@.service
    fleetctl submit someapp-lb@.service
    ```

    4. Start Unit instances from templates:

    ```bash
    fleetctl start someapp@{1..6}
    fleetctl start someapp-discovery@{1..6}
    fleetctl start someapp-lb@{1..2}
    ```

    #### Troubleshooting
    5. Verify all is working good:

    ```bash
    fleetctl list-units
    ```

    ## Troubleshooting

    + **Something goes wrong and a service doesn't work**

    Use those commands to debug:

    ```bash
    # also for fleet, etcd, flanneld
    sudo systemctl start etcd2
    sudo systemctl status etcd2
    sudo journalctl -xe
    sudo journalctl -ru etcd2
    ```

    + **`fleet list-units` is displaying `failed` state for any units**

    @@ -279,42 +318,6 @@ See: [Launching Containers with fleet](https://coreos.com/fleet/docs/latest/laun
    ssh-add ~/.ssh/id_rsa
    ssh -A <your-host>
    ```

    ### Configure Firewall Rules

    Run [custom-firewall.sh](https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-firewall.sh) from Deis v1 on your local machine:

    ```bash
    curl -O https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-firewall.sh
    # run follow line for each server
    ssh core@<host1> 'bash -s' < custom-firewall.sh
    ```

    ### Load Balancers and Service Discovery

    1. Download [someapp@.service](#file-someapp-service), [someapp-discovery@.service](#file-someapp-discovery-service) and [someapp-lb@.service](#file-someapp-lb-service).
    2. Modify those Unit Templates according to your application config.
    3. Submit modificated files to your Fleet:

    ```bash
    fleetctl submit someapp@.service
    fleetctl submit someapp-discovery@.service
    fleetctl submit someapp-lb@.service
    ```

    4. Start Unit instances from templates:

    ```bash
    fleetctl start someapp@{1..6}
    fleetctl start someapp-discovery@{1..6}
    fleetctl start someapp-lb@{1..2}
    ```

    5. Verify all is working good:

    ```bash
    fleetctl list-units
    ```

    ## Install Deis v1

  10. @DenisIzmaylov DenisIzmaylov revised this gist Mar 10, 2016. 1 changed file with 13 additions and 7 deletions.
    20 changes: 13 additions & 7 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -54,14 +54,16 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.
    ```bash
    coreos:
    etcd2:
    # generate a new token for each unique cluster from https://discovery.etcd.io/new
    # Generate a new token for each unique cluster from https://discovery.etcd.io/new
    # discovery: https://discovery.etcd.io/<token>
    discovery: https://discovery.etcd.io/9c19239271bcd6be78d4e8acfb393551
    # multi-region and multi-cloud deployments need to use $public_ipv4

    # Multi-region and multi-cloud deployments need to use $public_ipv4
    advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
    initial-advertise-peer-urls: http://$private_ipv4:2380
    # listen on both the official ports and the legacy ports
    # legacy ports can be omitted if your application doesn't depend on them

    # Listen on both the official ports and the legacy ports
    # Legacy ports can be omitted if your application doesn't depend on them
    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
    listen-peer-urls: http://$private_ipv4:2380

    @@ -85,7 +87,12 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.
    - name: fleet.service
    command: start

    # network configuration should be here
    # Network configuration should be here, e.g:
    # - name: 00-eno1.network
    # content: "[Match]\nName=eno1\n\n[Network]\nDHCP=yes\n\n[DHCP]\nUseMTU=9000\n"
    # - name: 00-eno2.network
    # runtime: true
    # content: "[Match]\nName=eno2\n\n[Network]\nDHCP=yes\n\n[DHCP]\nUseMTU=9000\n"

    - name: flanneld.service
    command: start
    @@ -107,7 +114,6 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.
    [Service]
    Restart=always


    - name: docker-tcp.socket
    command: start
    enable: true
    @@ -127,7 +133,7 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.

    ```bash
    units:
    # ...
    # ...
    - name: 00-eno2.network
    runtime: true
    content: "[Match]\nName=eno2\n\n[Network]\nDHCP=yes\n\n[DHCP]\nUseMTU=9000\n"
  11. @DenisIzmaylov DenisIzmaylov revised this gist Mar 10, 2016. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion NOTES.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@ This guide describes how to bootstrap new Production Core OS Cluster as High Ava
    # Content

    + [Introduction](#introduction)
    + [Tools Used](#tools-used)
    + [Basic Configuration](#basic-configuration)
    + [Connect Your Servers as a Cluster](#connect-your-servers-as-a-cluster)
    + [Create Fleet Units](#create-fleet-units)
    @@ -18,13 +19,19 @@ This guide describes how to bootstrap new Production Core OS Cluster as High Ava
    ## Introduction

    CoreOS is a powerful Linux distribution built to make large, scalable deployments on varied infrastructure simple to manage.

    CoreOS is designed for security, consistency, and reliability. Instead of installing packages via yum or apt, CoreOS uses Linux containers to manage your services at a higher level of abstraction. A single service's code and all dependencies are packaged within a container that can be run on one or many CoreOS machines.

    Main building blocks of CoreOS — etcd, Docker and systemd.

    See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.com/coreos/posts/coreos-with-docker).

    ### Tools Used

    + etcd: key-value store for service registration and discovery
    + fleet: scheduling and failover of Docker containers across CoreOS Cluster
    + flannel: gives each docker container a unique IP that allows you to access the internal port (i.e. port 80 not 32679)
    + confd: watch etcd for nodes arriving/leaving and update (with reload) nginx configuration by using specified template

    ## Basic Configuration

    ### Connect your servers as a cluster
  12. @DenisIzmaylov DenisIzmaylov revised this gist Mar 10, 2016. 1 changed file with 43 additions and 7 deletions.
    50 changes: 43 additions & 7 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -62,6 +62,9 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.
    public-ip: $private_ipv4
    metadata: region=europe,public_ip=$public_ipv4

    flannel:
    interface: $private_ipv4

    units:
    - name: etcd2.service
    command: start
    @@ -71,23 +74,56 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.
    content: |
    [Service]
    TimeoutStartSec=0

    - name: fleet.service
    command: start

    # network configuration should be here

    - name: flanneld.service
    command: enable
    command: start
    drop-ins:
    - name: 50-network-config.conf
    content: |
    [Service]
    ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'

    - name: docker.service
    command: start
    drop-ins:
    - name: 60-docker-wait-for-flannel-config.conf
    content: |
    [Unit]
    After=flanneld.service
    Requires=flanneld.service

    [Service]
    Restart=always


    - name: docker-tcp.socket
    command: start
    enable: true
    content: |
    [Unit]
    Description=Docker Socket for the API

    [Socket]
    ListenStream=2375
    Service=docker.service
    BindIPv6Only=both

    [Install]
    WantedBy=sockets.target
    ```
    5. For RPN-Online you should also add follow lines to get Private Network working:
    5. Online.net provide has a specific configuration preset. It requires you to process additional step - add those lines to Cloud Config to get Private Network working:

    ```bash
    units:
    # ...
    - name: 00-eno2.network
    runtime: true
    content: "[Match]\nName=eno2\n\n[Network]\nDHCP=yes\n\n[DHCP]\nUseMTU=9000\n"
    units:
    # ...
    - name: 00-eno2.network
    runtime: true
    content: "[Match]\nName=eno2\n\n[Network]\nDHCP=yes\n\n[DHCP]\nUseMTU=9000\n"
    ```

    6. Validate your changes:
  13. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. No changes.
  14. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion NOTES.md
    Original file line number Diff line number Diff line change
    @@ -119,7 +119,7 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.
    If something goes wrong use follow commands to debug:

    ```bash
    # etcd2
    # use for etcd2, fleet, etcd
    sudo systemctl start etcd2
    sudo systemctl status etcd2
    sudo journalctl -xe
  15. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 2 changed files with 7 additions and 7 deletions.
    10 changes: 5 additions & 5 deletions someapp-lb@.service
    Original file line number Diff line number Diff line change
    @@ -5,11 +5,11 @@ Requires=docker.service

    [Service]
    TimeoutStartSec=0
    ExecStartPre=-/usr/bin/docker kill someapp-lb
    ExecStartPre=-/usr/bin/docker rm someapp-lb
    ExecStartPre=/usr/bin/docker pull willrstern/nginx-lb
    ExecStart=/usr/bin/sh -c "/usr/bin/docker run --name someapp-lb --rm -p 80:80 -e SERVICE_NAME=someapp -e TEST_HOST=%H -e ETCD=\"$(ifconfig docker0 | awk '/\<inet\>/ { print $2}'):2379\" willrstern/nginx-lb"
    ExecStop=/usr/bin/docker stop someapp-lb
    ExecStartPre=-/usr/bin/docker kill someapp-lb%i
    ExecStartPre=-/usr/bin/docker rm someapp-lb%i
    ExecStartPre=/usr/bin/docker pull denisizmaylov/nginx-lb
    ExecStart=/usr/bin/sh -c "/usr/bin/docker run --name someapp-lb%i --rm -p 80:80 -e SERVICE_NAME=someapp -e ETCD=\"$(ifconfig docker0 | awk '/\<inet\>/ { print $2}'):2379\" denisizmaylov/nginx-lb"
    ExecStop=/usr/bin/docker stop someapp-lb%i

    [X-Fleet]
    Conflicts=someapp-lb@*
    4 changes: 2 additions & 2 deletions someapp@.service
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,6 @@ Requires=docker.service
    TimeoutStartSec=0
    ExecStartPre=-/usr/bin/docker kill someapp%i
    ExecStartPre=-/usr/bin/docker rm someapp%i
    ExecStartPre=/usr/bin/docker pull willrstern/node-sample
    ExecStart=/usr/bin/docker run --name someapp%i -e APPNAME=someapp%i willrstern/node-sample
    ExecStartPre=/usr/bin/docker pull denisizmaylov/node-sample
    ExecStart=/usr/bin/docker run --name someapp%i -e APPNAME=someapp%i denisizmaylov/node-sample
    ExecStop=/usr/bin/docker kill someapp%i
  16. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -324,18 +324,18 @@ Attention! It seems that doesn't work correctly with Online.net and other bare m
    ## Appendix 1 - Info and Tutorials
    + [Building Microservices with CoreOS & etcd](https://www.youtube.com/watch?v=5BPSnDSDnOc) <sup>[video talk]<sup>
    + [How To Set Up a CoreOS Cluster on DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-coreos-cluster-on-digitalocean) <sup>[article]</sup>
    + http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/
    + http://blog.stevenedouard.com/high-availability-apps-via-fleet-coreos-from-start-to-finish-provisioning-coreos-using-azure-resource-manager/
    + https://blog.docker.com/2015/04/tips-for-deploying-nginx-official-image-with-docker/
    + http://blog.scottlowe.org/2014/08/20/coreos-continued-fleet-and-docker/
    + [How To Set Up a CoreOS Cluster on DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-coreos-cluster-on-digitalocean)
    + [How To Secure Your CoreOS Cluster with TLS/SSL and Firewall Rules on DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-secure-your-coreos-cluster-with-tls-ssl-and-firewall-rules)
    <sup>[article]</sup>
    + [Automated Nginx Reverse Proxy for Docker](http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/)<sup>[article]</sup>
    + [High Availability Apps via Fleet & CoreOS – Start to Finish: Provisioning on Azure](http://blog.stevenedouard.com/high-availability-apps-via-fleet-coreos-from-start-to-finish-provisioning-coreos-using-azure-resource-manager/)<sup>[article]</sup>
    + [Tips for Deploying NGINX (Official Image) with Docker](https://blog.docker.com/2015/04/tips-for-deploying-nginx-official-image-with-docker/)<sup>[article]</sup>
    + [CoreOS Continued: Fleet and Docker](http://blog.scottlowe.org/2014/08/20/coreos-continued-fleet-and-docker/)<sup>[article]</sup>
    + [Nginx Load Balancer Service For Core OS](https://gist.github.com/mssio/1b949d0952aaf69c2543)
    + [ServerFault: Nginx proxy to many container running on different CoreOS nodes](http://serverfault.com/questions/678695/nginx-proxy-to-many-container-running-on-different-coreos-nodes)
    + http://infoslack.com/devops/creating-a-cluster-with-coreos-and-docker/
    + [Gist: Running a High Availability Service on CoreOS using Docker, Fleet, Flannel, Etcd, Confd & Nginx](https://gist.github.com/learncodeacademy/2a11bd906c87cf2301a1)
    + https://www.digitalocean.com/community/tutorials/how-to-secure-your-coreos-cluster-with-tls-ssl-and-firewall-rules
    + https://github.com/sedouard/fleet-bootstrapper
    + https://github.com/coreos/etcd/blob/master/Documentation/runtime-reconf-design.md#do-not-use-public-discovery-service-for-runtime-reconfiguration
    + [Docker Fleet Starter](https://github.com/sedouard/fleet-bootstrapper)<sup>[github repo]</sup>
    + [Do Not Use Public Discovery Service For Runtime Reconfiguration](https://github.com/coreos/etcd/blob/master/Documentation/runtime-reconf-design.md#do-not-use-public-discovery-service-for-runtime-reconfiguration)<sup>[tips]</sup>
    ## Appendix 2 - Tools and Services
  17. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -212,12 +212,12 @@ See: [Launching Containers with fleet](https://coreos.com/fleet/docs/latest/laun
    1. Check you have connected with `ssh -A`.
    2. Check you are not using `sudo` for remote machines. In this case a process under `sudo` can't access to your `SSH_AUTH_SOCK`.

    + **Error response from daemon: Conflict. The name "testapp1" is already in use by container c4acbb70c654. You have to delete (or rename) that container to be able to reuse that name.**
    + **Error response from daemon: Conflict. The name "someapp1" is already in use by container c4acbb70c654. You have to delete (or rename) that container to be able to reuse that name.**

    ```bash
    fleetctl stop testapp@1
    docker rm testapp1
    fleetctl start testapp@1
    fleetctl stop someapp@1
    docker rm someapp1
    fleetctl start someapp@1
    ```

    + **fleet `ssh` command doesn't working**
  18. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion NOTES.md
    Original file line number Diff line number Diff line change
    @@ -195,10 +195,23 @@ See: [Launching Containers with fleet](https://coreos.com/fleet/docs/latest/laun

    + **`fleet list-units` is displaying `failed` state for any units**

    For local units:

    ```bash
    sudo fleetctl journal testapp@1
    sudo fleetctl journal someapp@1
    ```

    For remote units:

    ```bash
    fleetctl journal someapp@1
    ```

    + **`fleetctl` reponds with: Error running remote command: SSH_AUTH_SOCK environment variable is not set. Verify ssh-agent is running. See https://github.com/coreos/fleet/blob/master/Documentation/using-the-client.md for help.**

    1. Check you have connected with `ssh -A`.
    2. Check you are not using `sudo` for remote machines. In this case a process under `sudo` can't access to your `SSH_AUTH_SOCK`.

    + **Error response from daemon: Conflict. The name "testapp1" is already in use by container c4acbb70c654. You have to delete (or rename) that container to be able to reuse that name.**

    ```bash
  19. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion NOTES.md
    Original file line number Diff line number Diff line change
    @@ -230,7 +230,7 @@ ssh core@<host1> 'bash -s' < custom-firewall.sh

    ### Load Balancers and Service Discovery

    1. Download [someapp@.service](someapp@.service), [someapp-discovery@.service](someapp-discovery@.service) and [someapp-lb@.service](someapp-lb@.service).
    1. Download [someapp@.service](#file-someapp-service), [someapp-discovery@.service](#file-someapp-discovery-service) and [someapp-lb@.service](#file-someapp-lb-service).
    2. Modify those Unit Templates according to your application config.
    3. Submit modificated files to your Fleet:

  20. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -230,22 +230,29 @@ ssh core@<host1> 'bash -s' < custom-firewall.sh

    ### Load Balancers and Service Discovery

    1. Modify attached files according to your application config.
    2. Submit that to your Fleet:
    1. Download [someapp@.service](someapp@.service), [someapp-discovery@.service](someapp-discovery@.service) and [someapp-lb@.service](someapp-lb@.service).
    2. Modify those Unit Templates according to your application config.
    3. Submit modificated files to your Fleet:

    ```bash
    fleetctl submit someapp@.service
    fleetctl submit someapp-discovery@.service
    fleetctl submit someapp-lb@.service
    ```

    3. Start Unit instances from templates:
    4. Start Unit instances from templates:

    ```bash
    fleetctl start someapp@{1..6}
    fleetctl start someapp-discovery@{1..6}
    fleetctl start someapp-lb@{1..2}
    ```

    5. Verify all is working good:

    ```bash
    fleetctl list-units
    ```

    ## Install Deis v1

  21. @DenisIzmaylov DenisIzmaylov revised this gist Mar 9, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -220,7 +220,7 @@ See: [Launching Containers with fleet](https://coreos.com/fleet/docs/latest/laun

    ### Configure Firewall Rules

    Run [custom-firewall.sh](https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-firewall.sh) on your local machine:
    Run [custom-firewall.sh](https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-firewall.sh) from Deis v1 on your local machine:

    ```bash
    curl -O https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-firewall.sh
    @@ -230,7 +230,7 @@ ssh core@<host1> 'bash -s' < custom-firewall.sh

    ### Load Balancers and Service Discovery

    1. Modify attached files according to your application.
    1. Modify attached files according to your application config.
    2. Submit that to your Fleet:

    ```bash
    @@ -249,7 +249,7 @@ ssh core@<host1> 'bash -s' < custom-firewall.sh

    ## Install Deis v1

    Attention! It seems that doesn't work correctly with Online.net bare metal setups.
    Attention! It seems that doesn't work correctly with Online.net and other bare metal setups because `ceph` which is using for v1 works unstable and unpredictable. But if you would like to make an experiment, let's go:

    1. Create backup copy of your original config:

  22. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -74,8 +74,7 @@ See: [7 reasons why you should be using CoreOS with Docker](https://www.airpair.
    - name: fleet.service
    command: start
    - name: flanneld.service
    command: start
    # Attention! Setup "Network" according your environment
    command: enable
    drop-ins:
    - name: 50-network-config.conf
    content: |
  23. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion NOTES.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Step By Step Guide to Configure a CoreOS Cluster From Scratch
    =============================================================

    This guide describes how to bootstrap new Core OS Cluster as High Availability Service in a 15 minutes with scalable Web Microservices by using etcd2, fleet, flannel, Nginx Balancer and Docker, of course.
    This guide describes how to bootstrap new Production Core OS Cluster as High Availability Service in a 15 minutes with using etcd2, Fleet, Flannel, Confd, Nginx Balancer and Docker.

    # Content

  24. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -232,10 +232,12 @@ ssh core@<host1> 'bash -s' < custom-firewall.sh
    ### Load Balancers and Service Discovery

    1. Modify attached files according to your application.
    2. Submit those Unit Templates:
    2. Submit that to your Fleet:

    ```bash
    fleetctl submit someapp@.service someapp-discovery@.service someapp-lb@.service
    fleetctl submit someapp@.service
    fleetctl submit someapp-discovery@.service
    fleetctl submit someapp-lb@.service
    ```

    3. Start Unit instances from templates:
  25. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 20 additions and 2 deletions.
    22 changes: 20 additions & 2 deletions NOTES.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,8 @@ This guide describes how to bootstrap new Core OS Cluster as High Availability S
    + [Connect Your Servers as a Cluster](#connect-your-servers-as-a-cluster)
    + [Create Fleet Units](#create-fleet-units)
    + [Configure Firewall Rules](#configure-firewall-rules)
    + [Install Deis v1](#install-deis-v1)
    + [Load Balancers and Service Discovery](#load-balancers-and-service-discovery)
    + [Usage with Deis v1](#usage-with-deis-v1)
    + [Appendix 1 - Info and Tutorials](#appendix-1---info-and-tutorials)
    + [Appendix 2 - Tools and Services](#appendix-2---tools-and-services)

    @@ -228,7 +229,24 @@ curl -O https://raw.githubusercontent.com/deis/deis/master/contrib/util/custom-f
    ssh core@<host1> 'bash -s' < custom-firewall.sh
    ```

    ### Install Deis v1
    ### Load Balancers and Service Discovery

    1. Modify attached files according to your application.
    2. Submit those Unit Templates:

    ```bash
    fleetctl submit someapp@.service someapp-discovery@.service someapp-lb@.service
    ```

    3. Start Unit instances from templates:

    ```bash
    fleetctl start someapp@{1..6}
    fleetctl start someapp-discovery@{1..6}
    fleetctl start someapp-lb@{1..2}
    ```

    ## Install Deis v1

    Attention! It seems that doesn't work correctly with Online.net bare metal setups.
  26. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion someapp-lb@.service
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ TimeoutStartSec=0
    ExecStartPre=-/usr/bin/docker kill someapp-lb
    ExecStartPre=-/usr/bin/docker rm someapp-lb
    ExecStartPre=/usr/bin/docker pull willrstern/nginx-lb
    ExecStart=/usr/bin/docker run --name someapp-lb%i --rm -p 80:80 -e SERVICE_NAME=someapp -e ETCD="$(ifconfig docker0 | awk '/\<inet\>/ { print $2}'):2379" willrstern/nginx-lb
    ExecStart=/usr/bin/sh -c "/usr/bin/docker run --name someapp-lb --rm -p 80:80 -e SERVICE_NAME=someapp -e TEST_HOST=%H -e ETCD=\"$(ifconfig docker0 | awk '/\<inet\>/ { print $2}'):2379\" willrstern/nginx-lb"
    ExecStop=/usr/bin/docker stop someapp-lb

    [X-Fleet]
  27. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions someapp-lb@.service
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    [Unit]
    Description=someapp-lb%1
    Description=someapp-lb%i
    After=docker.service
    Requires=docker.service

    @@ -8,7 +8,7 @@ TimeoutStartSec=0
    ExecStartPre=-/usr/bin/docker kill someapp-lb
    ExecStartPre=-/usr/bin/docker rm someapp-lb
    ExecStartPre=/usr/bin/docker pull willrstern/nginx-lb
    ExecStart=/usr/bin/docker run --name someapp-lb --rm -p 80:80 -e SERVICE_NAME=someapp -e ETCD="$(ifconfig docker0 | awk '/\<inet\>/ { print $2}'):2379" willrstern/nginx-lb
    ExecStart=/usr/bin/docker run --name someapp-lb%i --rm -p 80:80 -e SERVICE_NAME=someapp -e ETCD="$(ifconfig docker0 | awk '/\<inet\>/ { print $2}'):2379" willrstern/nginx-lb
    ExecStop=/usr/bin/docker stop someapp-lb

    [X-Fleet]
  28. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion someapp@.service
    Original file line number Diff line number Diff line change
    @@ -8,5 +8,5 @@ TimeoutStartSec=0
    ExecStartPre=-/usr/bin/docker kill someapp%i
    ExecStartPre=-/usr/bin/docker rm someapp%i
    ExecStartPre=/usr/bin/docker pull willrstern/node-sample
    ExecStart=/usr/bin/docker run --name someapp%i -e APPNAME=someapp%i-P willrstern/node-sample
    ExecStart=/usr/bin/docker run --name someapp%i -e APPNAME=someapp%i willrstern/node-sample
    ExecStop=/usr/bin/docker kill someapp%i
  29. @DenisIzmaylov DenisIzmaylov revised this gist Mar 6, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions someapp-discovery@.service
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@ BindsTo=someapp@%i.service
    After=someapp@%i.service

    [Service]
    ExecStart=/bin/sh -c "sleep 10; while true; do etcdctl set /services/someapp/upstream/%i \"$(sleep 5 && docker inspect -f '{{.NetworkSettings.IPAddress}}' someapp%i):3000\" --ttl 60; sleep 45; done"
    ExecStop=/usr/bin/etcdctl rm /services/someapp/upstream/%i
    ExecStart=/bin/sh -c "sleep 10; while true; do etcdctl set /services/someapp/upstream/someapp%i \"$(sleep 5 && docker inspect -f '{{.NetworkSettings.IPAddress}}' someapp%i):3000\" --ttl 60; sleep 45; done"
    ExecStop=/usr/bin/etcdctl rm /services/someapp/upstream/someapp%i

    [X-Fleet]
    MachineOf=someapp@%i.service
  30. @DenisIzmaylov DenisIzmaylov renamed this gist Mar 6, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions someapp-lb.service → someapp-lb@.service
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    [Unit]
    Description=someapp-lb
    Description=someapp-lb%1
    After=docker.service
    Requires=docker.service

    @@ -12,5 +12,5 @@ ExecStart=/usr/bin/docker run --name someapp-lb --rm -p 80:80 -e SERVICE_NAME=so
    ExecStop=/usr/bin/docker stop someapp-lb

    [X-Fleet]
    Conflicts=someapp*
    Conflicts=someapp-lb@*
    MachineMetadata=loadbalancer=true