{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/comments/79462858","id":79462858,"diff_hunk":"@@ -0,0 +1,79 @@\n+#!/bin/bash\n+# Create a virtual bridge with PXE services and bootcfg\n+\n+DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n+\n+EXAMPLE=${2:-\"etcd\"}\n+BRIDGE=metal0\n+COREOS_VERSION=1153.0.0\n+\n+if [ \"$EUID\" -ne 0 ]\n+  then echo \"Please run as root\"\n+  exit\n+fi\n+\n+function main {\n+  case \"$1\" in\n+    \"create\") create;;\n+    \"destroy\") destroy;;\n+    *)\n+      usage\n+      exit 2\n+      ;;\n+  esac\n+}\n+\n+function usage {\n+  echo \"USAGE: ${0##*/} <command>\"\n+  echo \"Commands:\"\n+  echo -e \"\\tcreate\\tcreate a bridge with PXE services and CoreOS bootcfg\"\n+  echo -e \"\\tdestroy\\tdestroy the bridge environment\"\n+}\n+\n+function check {\n+  # SELinux, if present, it cannot be in Enforcing mode\n+  if [ $(getenforce) == 'Enforcing' ]; then\n+    echo \"SELinux must be in permissive mode: 'setenforce Permissive'\"\n+    exit 1\n+  fi\n+\n+  if [ ! -d $DIR/../examples/assets/coreos/$COREOS_VERSION ]; then\n+    echo \"Most examples use CoreOS $COREOS_VERSION. You may wish to download it.\"\n+    exit 1\n+  fi\n+}\n+\n+function create {\n+  check\n+\n+  echo \"Starting bootcfg with examples/groups/$EXAMPLE mounted\"\n+  systemd-run --unit=dev-bootcfg \\\n+    rkt run \\\n+    --uuid-file-save=/tmp/bootcfg \\\n+    --net=metal0:IP=172.15.0.2 \\\n+    --mount volume=data,target=/var/lib/bootcfg \\\n+    --volume data,kind=host,source=$PWD/examples \\\n+    --mount volume=groups,target=/var/lib/bootcfg/groups \\\n+    --volume groups,kind=host,source=$DIR/../examples/groups/$EXAMPLE \\\n+    quay.io/coreos/bootcfg:latest -- -address=0.0.0.0:8080 -log-level=debug\n+\n+  echo \"Starting dnsmasq to provide DHCP/TFTP/DNS services\"\n+  systemd-run --unit=dev-dnsmasq \\\n+    rkt run \\\n+    --uuid-file-save=/tmp/dnsmasq \\\n+    --net=metal0:IP=172.15.0.3 \\\n+    --mount volume=config,target=/etc/dnsmasq.conf \\\n+    --volume config,kind=host,source=$DIR/../contrib/dnsmasq/metal0.conf \\\n+    coreos.com/dnsmasq:v0.3.0\n+}\n+\n+function destroy {\n+  rkt stop --uuid-file=/tmp/bootcfg --force\n+  rkt rm --uuid-file=/tmp/bootcfg\n+  rkt stop --uuid-file=/tmp/dnsmasq --force\n+  rkt rm --uuid-file=/tmp/dnsmasq\n+  systemctl reset-failed dev-bootcfg\n+  systemctl reset-failed dev-dnsmasq\n+}\n+\n+main $@","path":"scripts/devnet","position":78,"original_position":79,"commit_id":"14b0e8282045158fe293305b1601f5f5bd3be7af","original_commit_id":"0b76116132a1118680374d3cdd79ed6171dc5b71","user":{"login":"dghubble","id":2253428,"avatar_url":"https://avatars.githubusercontent.com/u/2253428?v=3","gravatar_id":"","url":"https://api.github.com/users/dghubble","html_url":"https://github.com/dghubble","followers_url":"https://api.github.com/users/dghubble/followers","following_url":"https://api.github.com/users/dghubble/following{/other_user}","gists_url":"https://api.github.com/users/dghubble/gists{/gist_id}","starred_url":"https://api.github.com/users/dghubble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dghubble/subscriptions","organizations_url":"https://api.github.com/users/dghubble/orgs","repos_url":"https://api.github.com/users/dghubble/repos","events_url":"https://api.github.com/users/dghubble/events{/privacy}","received_events_url":"https://api.github.com/users/dghubble/received_events","type":"User","site_admin":false},"body":"done","created_at":"2016-09-19T18:53:38Z","updated_at":"2016-09-19T18:53:38Z","html_url":"https://github.com/coreos/coreos-baremetal/pull/348#discussion_r79462858","pull_request_url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348","_links":{"self":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/comments/79462858"},"html":{"href":"https://github.com/coreos/coreos-baremetal/pull/348#discussion_r79462858"},"pull_request":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348","id":85844185,"html_url":"https://github.com/coreos/coreos-baremetal/pull/348","diff_url":"https://github.com/coreos/coreos-baremetal/pull/348.diff","patch_url":"https://github.com/coreos/coreos-baremetal/pull/348.patch","issue_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues/348","number":348,"state":"open","locked":false,"title":"scripts: Add devnet script to setup PXE/bootcfg bridge","user":{"login":"dghubble","id":2253428,"avatar_url":"https://avatars.githubusercontent.com/u/2253428?v=3","gravatar_id":"","url":"https://api.github.com/users/dghubble","html_url":"https://github.com/dghubble","followers_url":"https://api.github.com/users/dghubble/followers","following_url":"https://api.github.com/users/dghubble/following{/other_user}","gists_url":"https://api.github.com/users/dghubble/gists{/gist_id}","starred_url":"https://api.github.com/users/dghubble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dghubble/subscriptions","organizations_url":"https://api.github.com/users/dghubble/orgs","repos_url":"https://api.github.com/users/dghubble/repos","events_url":"https://api.github.com/users/dghubble/events{/privacy}","received_events_url":"https://api.github.com/users/dghubble/received_events","type":"User","site_admin":false},"body":"The QEMU/KVM tutorial/development setup asks users to run `bootcfg` and `dnsmasq` (DHCP/TFTP/DNS) on the virtual bridge where QEMU/KVM VMs will be created. This script adds an optional \"fast-track\" which sets this up, but does it with proper rkt run transient units.\r\n\r\nRun PXE services and bootcfg set to configure machines into an `etcd` example cluster.\r\n\r\n```\r\n$ ./scripts/devnet create etcd\r\nStarting bootcfg with examples/groups/etcd mounted\r\nRunning as unit dev-bootcfg.service.\r\nStarting dnsmasq to provide DHCP/TFTP/DNS services\r\nRunning as unit dev-dnsmasq.service.\r\n```\r\n\r\nCheck logs as usual for systemd.\r\n\r\n```\r\njournalctl -u dev-bootcfg\r\njournalctl -u dev-dnsmasq\r\n```\r\n\r\nCreate the QEMU/KVM VMs with tutorial/development (known) hardware attributes.\r\n\r\n```\r\n./scripts/libvirt create\r\n```\r\n\r\nStop and garbage collect the rkt run bootcfg and PXE services.\r\n\r\n```\r\n./scripts/devnet destroy\r\n```\r\n\r\nI believe this approach has advantages over some Procfile, Vagrantfile, or ISO ideas.\r\n\r\n* Simple setup for developers using this daily\r\n* Runs pods with rkt just like in production\r\n* rkt run's within a systemd transient unit\r\n    * Units are named `dev-bootcfg` and `dev-dnsmasq` for convenience\r\n    * Journal logs directly with `journalctl -u dev-bootcfg`\r\n    * More similar to production, where systemd/journald run rkt pods\r\n* Solves the previous issue of always needing to run `rkt gc --grace-period=0`\r\n    * Stop and rm the specific pod by UUID\r\n    * Cleanup the transient system unit\r\n* Avoids creating a whole VM just to rkt run these pods, the host has rkt\r\n* Prepares the way for a few (optional) additional services I'll be adding soon\r\n\r\nThough I hate to make the comparison, but you can think of this like a systemd and rkt integrated way of `docker-compose up` style management of a group of pods for bare-metal development.\r\n\r\n### Followup\r\n\r\nThe tutorials/documentation are intentionally left as-is for now. Documentation clearly explains the purpose of each service and using `devnet` right off the bat may be too \"magical\". I'll work to strike a balance before updating docs so educational value is not lost.","created_at":"2016-09-19T18:24:43Z","updated_at":"2016-09-19T18:53:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97676cc37d9f0e2a7c32f8d8b6cb543f0bef2fec","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348/commits","review_comments_url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348/comments","review_comment_url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues/348/comments","statuses_url":"https://api.github.com/repos/coreos/coreos-baremetal/statuses/14b0e8282045158fe293305b1601f5f5bd3be7af","head":{"label":"coreos:devnet","ref":"devnet","sha":"14b0e8282045158fe293305b1601f5f5bd3be7af","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":48007294,"name":"coreos-baremetal","full_name":"coreos/coreos-baremetal","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/coreos-baremetal","description":"Network boot and provision CoreOS Clusters (etcd, Kubernetes, self-hosted Kubernetes, Torus, rktnetes, and more)","fork":false,"url":"https://api.github.com/repos/coreos/coreos-baremetal","forks_url":"https://api.github.com/repos/coreos/coreos-baremetal/forks","keys_url":"https://api.github.com/repos/coreos/coreos-baremetal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/coreos-baremetal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/coreos-baremetal/teams","hooks_url":"https://api.github.com/repos/coreos/coreos-baremetal/hooks","issue_events_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/coreos-baremetal/events","assignees_url":"https://api.github.com/repos/coreos/coreos-baremetal/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/coreos-baremetal/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/coreos-baremetal/tags","blobs_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/coreos-baremetal/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/coreos-baremetal/languages","stargazers_url":"https://api.github.com/repos/coreos/coreos-baremetal/stargazers","contributors_url":"https://api.github.com/repos/coreos/coreos-baremetal/contributors","subscribers_url":"https://api.github.com/repos/coreos/coreos-baremetal/subscribers","subscription_url":"https://api.github.com/repos/coreos/coreos-baremetal/subscription","commits_url":"https://api.github.com/repos/coreos/coreos-baremetal/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/coreos-baremetal/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/coreos-baremetal/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/coreos-baremetal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/coreos-baremetal/merges","archive_url":"https://api.github.com/repos/coreos/coreos-baremetal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/coreos-baremetal/downloads","issues_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/coreos-baremetal/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/coreos-baremetal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/coreos-baremetal/labels{/name}","releases_url":"https://api.github.com/repos/coreos/coreos-baremetal/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/coreos-baremetal/deployments","created_at":"2015-12-14T23:23:12Z","updated_at":"2016-09-18T04:21:06Z","pushed_at":"2016-09-19T18:49:18Z","git_url":"git://github.com/coreos/coreos-baremetal.git","ssh_url":"git@github.com:coreos/coreos-baremetal.git","clone_url":"https://github.com/coreos/coreos-baremetal.git","svn_url":"https://github.com/coreos/coreos-baremetal","homepage":"","size":14929,"stargazers_count":144,"watchers_count":144,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":38,"forks":49,"open_issues":38,"watchers":144,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"bd131fc60d068350e6997e84c0441fddbffbeabc","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":48007294,"name":"coreos-baremetal","full_name":"coreos/coreos-baremetal","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/coreos-baremetal","description":"Network boot and provision CoreOS Clusters (etcd, Kubernetes, self-hosted Kubernetes, Torus, rktnetes, and more)","fork":false,"url":"https://api.github.com/repos/coreos/coreos-baremetal","forks_url":"https://api.github.com/repos/coreos/coreos-baremetal/forks","keys_url":"https://api.github.com/repos/coreos/coreos-baremetal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/coreos-baremetal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/coreos-baremetal/teams","hooks_url":"https://api.github.com/repos/coreos/coreos-baremetal/hooks","issue_events_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/coreos-baremetal/events","assignees_url":"https://api.github.com/repos/coreos/coreos-baremetal/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/coreos-baremetal/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/coreos-baremetal/tags","blobs_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/coreos-baremetal/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/coreos-baremetal/languages","stargazers_url":"https://api.github.com/repos/coreos/coreos-baremetal/stargazers","contributors_url":"https://api.github.com/repos/coreos/coreos-baremetal/contributors","subscribers_url":"https://api.github.com/repos/coreos/coreos-baremetal/subscribers","subscription_url":"https://api.github.com/repos/coreos/coreos-baremetal/subscription","commits_url":"https://api.github.com/repos/coreos/coreos-baremetal/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/coreos-baremetal/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/coreos-baremetal/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/coreos-baremetal/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/coreos-baremetal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/coreos-baremetal/merges","archive_url":"https://api.github.com/repos/coreos/coreos-baremetal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/coreos-baremetal/downloads","issues_url":"https://api.github.com/repos/coreos/coreos-baremetal/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/coreos-baremetal/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/coreos-baremetal/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/coreos-baremetal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/coreos-baremetal/labels{/name}","releases_url":"https://api.github.com/repos/coreos/coreos-baremetal/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/coreos-baremetal/deployments","created_at":"2015-12-14T23:23:12Z","updated_at":"2016-09-18T04:21:06Z","pushed_at":"2016-09-19T18:49:18Z","git_url":"git://github.com/coreos/coreos-baremetal.git","ssh_url":"git@github.com:coreos/coreos-baremetal.git","clone_url":"https://github.com/coreos/coreos-baremetal.git","svn_url":"https://github.com/coreos/coreos-baremetal","homepage":"","size":14929,"stargazers_count":144,"watchers_count":144,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":38,"forks":49,"open_issues":38,"watchers":144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348"},"html":{"href":"https://github.com/coreos/coreos-baremetal/pull/348"},"issue":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/issues/348"},"comments":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/issues/348/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/pulls/348/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/coreos-baremetal/statuses/14b0e8282045158fe293305b1601f5f5bd3be7af"}}}}
{"actor":{"display_login":"dghubble"}}