{"action":"created","comment":{"url":"https://api.github.com/repos/projectcalico/calico-containers/pulls/comments/54663570","id":54663570,"diff_hunk":"@@ -0,0 +1,141 @@\n+<!--- master only -->\n+> ![warning](../../images/warning.png) This document applies to the HEAD of the calico-containers source tree.\n+>\n+> View the calico-containers documentation for the latest release [here](https://github.com/projectcalico/calico-containers/blob/v0.14.0/README.md).\n+<!--- else\n+> You are viewing the calico-containers documentation for release **release**.\n+<!--- end of master only -->\n+\n+# Running Calico Node Containers as a Service\n+\n+This guide explains how to run Calico as a system process or service. We\n+include examples for Systemd, but the commands can be applied to other init\n+daemons such as upstart.\n+\n+## Running the Calico Node Container as a Systemd Service\n+The `calicoctl node` command already starts calico as its own container process\n+on your system. There is no need to run the base `calico/node` container with a\n+different command.  This section provides an example for running the `calicoctl \n+node` command with required components in a Systemd service.\n+\n+\n+Included here is an EnvironmentFile that defines the Environment variables for\n+Calico and a sample systemd service file that uses the environment file and\n+starts the Calico node image as a service.\n+\n+`calico.env` - the EnvironmentFile:\n+```\n+ETCD_AUTHORITY=localhost:2379\n+ETCD_SCHEME=http\n+ETCD_CA_FILE=\"\"\n+ETCD_CERT_FILE=\"\"\n+ETCD_KEY_FILE=\"\"\n+```\n+\n+Be sure to update this environment file as necessary, such as modifying the\n+ETCD_AUTHORITY value to point at the correct instance of Etcd.\n+\n+>Note: The ETCD_SCHEME, ETCD_CA_FILE, ETCD_CERT_FILE, and ETCD_KEY_FILE\n+>environment variables are required when using Etcd with SSL/TLS.  The values\n+>here are standard values for a non-SSL version of Etcd, but you can use this\n+>template to define your SSL values if desired.  For more details about running \n+> Calico with Etcd using SSL/TLS, check out the\n+> [Etcd Secure Cluster guide](../../EtcdSecureCluster.md).\n+\n+`calico-node.service` - the Systemd service:\n+\n+```\n+[Unit]\n+Description=calico-node\n+After=docker.service\n+Requires=docker.service\n+\n+[Service]\n+EnvironmentFile=/etc/calico/calico.env\n+ExecStartPre=-/usr/bin/docker rm -f calico-node\n+ExecStart=/usr/bin/calicoctl node\n+ExecStop=-/usr/bin/docker stop calico-node\n+\n+[Install]\n+WantedBy=multi-user.target\n+```\n+\n+The Systemd service above does the following on start:\n+  - Confirm docker is install under the `[Unit]` section\n+  - Get environment variables from the environment file above\n+  - Remove existing `calico-node` container (if it exists)\n+  - Start `calico/node`\n+\n+The script will also stop the calico-node container when the service is stopped.\n+\n+**Note**: Depending on how you've installed Docker, the name of the Docker service\n+under the `[Unit]` section may be different (such as `docker-engine.service`).\n+Be sure to check this before starting the service.\n+\n+## Starting `calico/node-libnetwork` on its own\n+If you are running Calico as a Docker network plugin, it is also necessary to\n+have a separate job for handling the Calico libnetwork driver.\n+\n+You can start the `calico/node-libnetwork` image directly with the `docker run`\n+command:\n+\n+```\n+docker run -d --privileged --net=host \\\n+    -v /run/docker/plugins:/run/docker/plugins \\\n+    --name=calico-libnetwork -e ETCD_AUTHORITY=localhost:2379\n+    calico/node-libnetwork\n+```\n+\n+In this example,\n+\n+ - Privileged is required since the container creates network devices.\n+ - Host network is used since the network changes need to occur in the host namespace\n+ - The /run/docker/plugins volume is used to allow the plugin to communicate with Docker.\n+\n+### Systemd service example\n+\n+This service uses the same EvnironmentFile as `calico-node.service` above. Again,\n+make sure you update the environment variables in this file to reflect the\n+correct values for your deployment.  It is safe to specify the `-e` flag as seen\n+below even if the environment variable is not set.\n+\n+`calico-libnetwork.service`\n+\n+```\n+[Unit]\n+Description=calico-libnetwork\n+After=docker.service\n+Requires=docker.service\n+\n+[Service]\n+EnvironmentFile=/etc/calico/calico.env\n+ExecStartPre=-/usr/bin/docker rm -f calico-libnetwork\n+ExecStart=/usr/bin/docker run -d --privileged --net=host \\\n+ -v /run/docker/plugins:/run/docker/plugins \\\n+ --name=calico-libnetwork \\\n+ -e ETCD_AUTHORITY=${ETCD_AUTHORITY} \\\n+ -e ETCD_SCHEME=${ETCD_SCHEME} \\\n+ -e ETCD_CA_CERT_FILE=${ETCD_CA_CERT_FILE} \\\n+ -e ETCD_CERT_FILE=${ETCD_CERT_FILE} \\\n+ -e ETCD_KEY_FILE=${ETCD_KEY_FILE} \\\n+ calico/node-libnetwork:latest\n+ExecStop=-/usr/bin/docker stop calico-libnetwork\n+\n+[Install]\n+WantedBy=multi-user.target\n+```\n+\n+This Systemd service does the following on start:\n+  - Confirm docker is install under the `[Unit]` section","path":"docs/calico-with-docker/docker-network-plugin/CalicoAsService.md","position":129,"original_position":129,"commit_id":"392a57b9760466644992d1e769f92cd423842fd7","original_commit_id":"392a57b9760466644992d1e769f92cd423842fd7","user":{"login":"robbrockbank","id":3227729,"avatar_url":"https://avatars.githubusercontent.com/u/3227729?v=3","gravatar_id":"","url":"https://api.github.com/users/robbrockbank","html_url":"https://github.com/robbrockbank","followers_url":"https://api.github.com/users/robbrockbank/followers","following_url":"https://api.github.com/users/robbrockbank/following{/other_user}","gists_url":"https://api.github.com/users/robbrockbank/gists{/gist_id}","starred_url":"https://api.github.com/users/robbrockbank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbrockbank/subscriptions","organizations_url":"https://api.github.com/users/robbrockbank/orgs","repos_url":"https://api.github.com/users/robbrockbank/repos","events_url":"https://api.github.com/users/robbrockbank/events{/privacy}","received_events_url":"https://api.github.com/users/robbrockbank/received_events","type":"User","site_admin":false},"body":"install?","created_at":"2016-03-02T00:54:31Z","updated_at":"2016-03-02T00:54:31Z","html_url":"https://github.com/projectcalico/calico-containers/pull/831#discussion_r54663570","pull_request_url":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831","_links":{"self":{"href":"https://api.github.com/repos/projectcalico/calico-containers/pulls/comments/54663570"},"html":{"href":"https://github.com/projectcalico/calico-containers/pull/831#discussion_r54663570"},"pull_request":{"href":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831"}}},"pull_request":{"url":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831","id":60732328,"html_url":"https://github.com/projectcalico/calico-containers/pull/831","diff_url":"https://github.com/projectcalico/calico-containers/pull/831.diff","patch_url":"https://github.com/projectcalico/calico-containers/pull/831.patch","issue_url":"https://api.github.com/repos/projectcalico/calico-containers/issues/831","number":831,"state":"open","locked":false,"title":"Add doc explaining calico-libnetwork as a systemd process","user":{"login":"TrimBiggs","id":1302077,"avatar_url":"https://avatars.githubusercontent.com/u/1302077?v=3","gravatar_id":"","url":"https://api.github.com/users/TrimBiggs","html_url":"https://github.com/TrimBiggs","followers_url":"https://api.github.com/users/TrimBiggs/followers","following_url":"https://api.github.com/users/TrimBiggs/following{/other_user}","gists_url":"https://api.github.com/users/TrimBiggs/gists{/gist_id}","starred_url":"https://api.github.com/users/TrimBiggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrimBiggs/subscriptions","organizations_url":"https://api.github.com/users/TrimBiggs/orgs","repos_url":"https://api.github.com/users/TrimBiggs/repos","events_url":"https://api.github.com/users/TrimBiggs/events{/privacy}","received_events_url":"https://api.github.com/users/TrimBiggs/received_events","type":"User","site_admin":false},"body":"Fixes #825","created_at":"2016-02-25T19:22:53Z","updated_at":"2016-03-02T00:54:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"559939cacc6f306482f6540141189e471396cd96","assignee":{"login":"robbrockbank","id":3227729,"avatar_url":"https://avatars.githubusercontent.com/u/3227729?v=3","gravatar_id":"","url":"https://api.github.com/users/robbrockbank","html_url":"https://github.com/robbrockbank","followers_url":"https://api.github.com/users/robbrockbank/followers","following_url":"https://api.github.com/users/robbrockbank/following{/other_user}","gists_url":"https://api.github.com/users/robbrockbank/gists{/gist_id}","starred_url":"https://api.github.com/users/robbrockbank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbrockbank/subscriptions","organizations_url":"https://api.github.com/users/robbrockbank/orgs","repos_url":"https://api.github.com/users/robbrockbank/repos","events_url":"https://api.github.com/users/robbrockbank/events{/privacy}","received_events_url":"https://api.github.com/users/robbrockbank/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831/commits","review_comments_url":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831/comments","review_comment_url":"https://api.github.com/repos/projectcalico/calico-containers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectcalico/calico-containers/issues/831/comments","statuses_url":"https://api.github.com/repos/projectcalico/calico-containers/statuses/392a57b9760466644992d1e769f92cd423842fd7","head":{"label":"TrimBiggs:systemd-libnetwork","ref":"systemd-libnetwork","sha":"392a57b9760466644992d1e769f92cd423842fd7","user":{"login":"TrimBiggs","id":1302077,"avatar_url":"https://avatars.githubusercontent.com/u/1302077?v=3","gravatar_id":"","url":"https://api.github.com/users/TrimBiggs","html_url":"https://github.com/TrimBiggs","followers_url":"https://api.github.com/users/TrimBiggs/followers","following_url":"https://api.github.com/users/TrimBiggs/following{/other_user}","gists_url":"https://api.github.com/users/TrimBiggs/gists{/gist_id}","starred_url":"https://api.github.com/users/TrimBiggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrimBiggs/subscriptions","organizations_url":"https://api.github.com/users/TrimBiggs/orgs","repos_url":"https://api.github.com/users/TrimBiggs/repos","events_url":"https://api.github.com/users/TrimBiggs/events{/privacy}","received_events_url":"https://api.github.com/users/TrimBiggs/received_events","type":"User","site_admin":false},"repo":{"id":38397840,"name":"calico-containers","full_name":"TrimBiggs/calico-containers","owner":{"login":"TrimBiggs","id":1302077,"avatar_url":"https://avatars.githubusercontent.com/u/1302077?v=3","gravatar_id":"","url":"https://api.github.com/users/TrimBiggs","html_url":"https://github.com/TrimBiggs","followers_url":"https://api.github.com/users/TrimBiggs/followers","following_url":"https://api.github.com/users/TrimBiggs/following{/other_user}","gists_url":"https://api.github.com/users/TrimBiggs/gists{/gist_id}","starred_url":"https://api.github.com/users/TrimBiggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrimBiggs/subscriptions","organizations_url":"https://api.github.com/users/TrimBiggs/orgs","repos_url":"https://api.github.com/users/TrimBiggs/repos","events_url":"https://api.github.com/users/TrimBiggs/events{/privacy}","received_events_url":"https://api.github.com/users/TrimBiggs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TrimBiggs/calico-containers","description":"Docker version of Project Calico","fork":true,"url":"https://api.github.com/repos/TrimBiggs/calico-containers","forks_url":"https://api.github.com/repos/TrimBiggs/calico-containers/forks","keys_url":"https://api.github.com/repos/TrimBiggs/calico-containers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TrimBiggs/calico-containers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TrimBiggs/calico-containers/teams","hooks_url":"https://api.github.com/repos/TrimBiggs/calico-containers/hooks","issue_events_url":"https://api.github.com/repos/TrimBiggs/calico-containers/issues/events{/number}","events_url":"https://api.github.com/repos/TrimBiggs/calico-containers/events","assignees_url":"https://api.github.com/repos/TrimBiggs/calico-containers/assignees{/user}","branches_url":"https://api.github.com/repos/TrimBiggs/calico-containers/branches{/branch}","tags_url":"https://api.github.com/repos/TrimBiggs/calico-containers/tags","blobs_url":"https://api.github.com/repos/TrimBiggs/calico-containers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TrimBiggs/calico-containers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TrimBiggs/calico-containers/git/refs{/sha}","trees_url":"https://api.github.com/repos/TrimBiggs/calico-containers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TrimBiggs/calico-containers/statuses/{sha}","languages_url":"https://api.github.com/repos/TrimBiggs/calico-containers/languages","stargazers_url":"https://api.github.com/repos/TrimBiggs/calico-containers/stargazers","contributors_url":"https://api.github.com/repos/TrimBiggs/calico-containers/contributors","subscribers_url":"https://api.github.com/repos/TrimBiggs/calico-containers/subscribers","subscription_url":"https://api.github.com/repos/TrimBiggs/calico-containers/subscription","commits_url":"https://api.github.com/repos/TrimBiggs/calico-containers/commits{/sha}","git_commits_url":"https://api.github.com/repos/TrimBiggs/calico-containers/git/commits{/sha}","comments_url":"https://api.github.com/repos/TrimBiggs/calico-containers/comments{/number}","issue_comment_url":"https://api.github.com/repos/TrimBiggs/calico-containers/issues/comments{/number}","contents_url":"https://api.github.com/repos/TrimBiggs/calico-containers/contents/{+path}","compare_url":"https://api.github.com/repos/TrimBiggs/calico-containers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TrimBiggs/calico-containers/merges","archive_url":"https://api.github.com/repos/TrimBiggs/calico-containers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TrimBiggs/calico-containers/downloads","issues_url":"https://api.github.com/repos/TrimBiggs/calico-containers/issues{/number}","pulls_url":"https://api.github.com/repos/TrimBiggs/calico-containers/pulls{/number}","milestones_url":"https://api.github.com/repos/TrimBiggs/calico-containers/milestones{/number}","notifications_url":"https://api.github.com/repos/TrimBiggs/calico-containers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TrimBiggs/calico-containers/labels{/name}","releases_url":"https://api.github.com/repos/TrimBiggs/calico-containers/releases{/id}","deployments_url":"https://api.github.com/repos/TrimBiggs/calico-containers/deployments","created_at":"2015-07-01T22:16:32Z","updated_at":"2016-01-22T18:37:43Z","pushed_at":"2016-03-01T23:34:04Z","git_url":"git://github.com/TrimBiggs/calico-containers.git","ssh_url":"git@github.com:TrimBiggs/calico-containers.git","clone_url":"https://github.com/TrimBiggs/calico-containers.git","svn_url":"https://github.com/TrimBiggs/calico-containers","homepage":"http://www.projectcalico.org","size":19712,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"projectcalico:master","ref":"master","sha":"38d88f636d112b7a7597aab9248651891b011bda","user":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"repo":{"id":29629333,"name":"calico-containers","full_name":"projectcalico/calico-containers","owner":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectcalico/calico-containers","description":"Project Calico deployed in a containerized environment","fork":false,"url":"https://api.github.com/repos/projectcalico/calico-containers","forks_url":"https://api.github.com/repos/projectcalico/calico-containers/forks","keys_url":"https://api.github.com/repos/projectcalico/calico-containers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectcalico/calico-containers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectcalico/calico-containers/teams","hooks_url":"https://api.github.com/repos/projectcalico/calico-containers/hooks","issue_events_url":"https://api.github.com/repos/projectcalico/calico-containers/issues/events{/number}","events_url":"https://api.github.com/repos/projectcalico/calico-containers/events","assignees_url":"https://api.github.com/repos/projectcalico/calico-containers/assignees{/user}","branches_url":"https://api.github.com/repos/projectcalico/calico-containers/branches{/branch}","tags_url":"https://api.github.com/repos/projectcalico/calico-containers/tags","blobs_url":"https://api.github.com/repos/projectcalico/calico-containers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectcalico/calico-containers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectcalico/calico-containers/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectcalico/calico-containers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectcalico/calico-containers/statuses/{sha}","languages_url":"https://api.github.com/repos/projectcalico/calico-containers/languages","stargazers_url":"https://api.github.com/repos/projectcalico/calico-containers/stargazers","contributors_url":"https://api.github.com/repos/projectcalico/calico-containers/contributors","subscribers_url":"https://api.github.com/repos/projectcalico/calico-containers/subscribers","subscription_url":"https://api.github.com/repos/projectcalico/calico-containers/subscription","commits_url":"https://api.github.com/repos/projectcalico/calico-containers/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectcalico/calico-containers/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectcalico/calico-containers/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectcalico/calico-containers/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectcalico/calico-containers/contents/{+path}","compare_url":"https://api.github.com/repos/projectcalico/calico-containers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectcalico/calico-containers/merges","archive_url":"https://api.github.com/repos/projectcalico/calico-containers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectcalico/calico-containers/downloads","issues_url":"https://api.github.com/repos/projectcalico/calico-containers/issues{/number}","pulls_url":"https://api.github.com/repos/projectcalico/calico-containers/pulls{/number}","milestones_url":"https://api.github.com/repos/projectcalico/calico-containers/milestones{/number}","notifications_url":"https://api.github.com/repos/projectcalico/calico-containers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectcalico/calico-containers/labels{/name}","releases_url":"https://api.github.com/repos/projectcalico/calico-containers/releases{/id}","deployments_url":"https://api.github.com/repos/projectcalico/calico-containers/deployments","created_at":"2015-01-21T23:46:47Z","updated_at":"2016-03-01T19:44:48Z","pushed_at":"2016-03-01T22:02:08Z","git_url":"git://github.com/projectcalico/calico-containers.git","ssh_url":"git@github.com:projectcalico/calico-containers.git","clone_url":"https://github.com/projectcalico/calico-containers.git","svn_url":"https://github.com/projectcalico/calico-containers","homepage":"http://www.projectcalico.org","size":20183,"stargazers_count":314,"watchers_count":314,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":52,"forks":67,"open_issues":52,"watchers":314,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831"},"html":{"href":"https://github.com/projectcalico/calico-containers/pull/831"},"issue":{"href":"https://api.github.com/repos/projectcalico/calico-containers/issues/831"},"comments":{"href":"https://api.github.com/repos/projectcalico/calico-containers/issues/831/comments"},"review_comments":{"href":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831/comments"},"review_comment":{"href":"https://api.github.com/repos/projectcalico/calico-containers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectcalico/calico-containers/pulls/831/commits"},"statuses":{"href":"https://api.github.com/repos/projectcalico/calico-containers/statuses/392a57b9760466644992d1e769f92cd423842fd7"}}}}