GithubHelp home page GithubHelp logo

fleetscheduler's Introduction

fleetscheduler

Scheduler and orchestrator for fleet

Quick setup

coreos

  1. Clone coreos-vagrant

  2. Get your etcd discovery token curl -i -L https://discovery.etcd.io/new

  3. Edit user.data, paste the token in the discovery: variable

  4. Copy config.rb.sample to config.rb and edit num of instance to whatever you want e.g. 3

  5. Start your coreos cluster vagrant up

  6. Install fleetctl on your workstation.

  7. Before all next steps ensure you have an env var pointing to a coreos working ssh endpoint:

ssh-agent bash
ssh-add ~/.vagrant.d/insecure_private_key
export FLEETCTL_TUNNEL=127.0.0.1:2222 # Use vagrant ssh-config to figure out the ip:port for any coreos vm

skydns2

  • On your workstation, compile + run skydns2:
go get github.com/skynetservices/skydns
cd <gosourcepath> skydns2
go build -v
export ETCD_MACHINES='http://172.17.8.102:4001' # use any coreos ip here
./skydns2
  • On a coreos machine or using etcd http api calls create a skydns2 conf:
etcdctl set /skydns/config '{"dns_addr":"127.0.0.1:5354","ttl":3600, "domain":"dimitris.io","nameservers": ["8.8.8.8:53","8.8.4.4:53"]}'

This will force skydns to look for auto registered (gliderlabs/registrator) data under /skydns/local/io/dimitris

start registrator

  • Use the following fleet unit file to start gliderlabs/registrator, located in this repo as registrator-skydns2.service
[Unit]
Description=Gliderlabs registrator for skydns2
Requires=docker.service etcd.service
After=docker.service etcd.service

[Service]
Restart=always
RestartSec=5s
TimeoutStartSec=120
TimeoutStopSec=25

EnvironmentFile=/etc/environment

# remove old container
ExecStartPre=/bin/sh -c "docker ps -a | grep %p 1>/dev/null && docker rm %p || true"

# Start the container
ExecStart=/bin/sh -c "\
  /usr/bin/docker run \
    --rm \
    --name=%p \
    -v /var/run/docker.sock:/tmp/docker.sock \
    -h %H \
    gliderlabs/registrator \
    -ip ${COREOS_PRIVATE_IPV4} \
    skydns2://${COREOS_PRIVATE_IPV4}:4001/dimitris.io"

ExecStop=/usr/bin/docker stop %p


[X-Fleet]
Global=true

start fleet units

  • Run ./fleetscheduler create test.yaml

Note: test.yaml defines two services helloworld (to use domainname: mytestapp.dimitris.io) and redis

  • Run sudo ./hosts_updater.py # to update your /etc/hosts

Note: (TODO) this will be converted to a daemon to get triggered when etcd skydns dir gets updated

  • check /etc/hosts. Visit <defineddomainname>.dimitris.io on your browser. e.g. mytestapp.dimitris.io

  • Destroy services using ./fleetscheduler destroy test.yaml

Options for fleetscheduler

  1. specify service group.

e.g. start containers associated with prod-webapp1 servicegroup only:

./fleetscheduler.py start test.yaml -s prod-webapp1

destroy containers in staging servicegroup:

./fleetscheduler.py destroy test.yaml -s staging-webapp1
  1. if you don't specify -s (--servicegroup) all servicegroups will be affected

fleetscheduler's People

Contributors

dliappis avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.