{"id":1202,"date":"2019-02-07T02:33:46","date_gmt":"2019-02-07T02:33:46","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=1202"},"modified":"2019-02-10T01:24:30","modified_gmt":"2019-02-10T01:24:30","slug":"adding-linux-dash-as-a-system-service","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2019\/02\/07\/adding-linux-dash-as-a-system-service\/","title":{"rendered":"Adding Linux Dash As A System Service"},"content":{"rendered":"<p>Ivan Mikushin discussed adding\u00a0<a href=\"http:\/\/rancher.com\/using-docker-compose-to-define-rancheros-system-services\/\">system services to RancherOS using Docker Compose<\/a>. Today I want to show you an exmaple of how to deploy Linux Dash as a system service. Linux Dash is a simple, low overhead, and web supported monitoring tool for Linux, you can read more about Linux Dash\u00a0<a href=\"https:\/\/github.com\/afaqurk\/linux-dash\">here<\/a>. In this post i will add Linux Dash as a system service to RancherOS version 0.3.0 which allows users to add system services using\u00a0<strong>rancherctl<\/strong>\u00a0command. The Ubuntu\u2019s console is the only service that is currently available in RancherOS.<\/p>\n<h2 id=\"creating-linux-dash-docker-image\">Creating Linux Dash Docker Image<\/h2>\n<p>I build a 32MB node.js busybox image on top of the hwestphal\/nodebox image, with linux-dash installed which will run on port 80 by default. The Docker file of this image:<\/p>\n<div class=\"highlight\">\n<pre>FROM hwestphal\/nodebox\r\nMAINTAINER Hussein Galal\r\n\r\nRUN opkg-install unzip\r\nRUN curl -k -L -o master.zip https:\/\/github.com\/afaqurk\/linux-dash\/archive\/master.zip\r\nRUN unzip master.zip\r\nWORKDIR linux-dash-master\r\nRUN npm install\r\n\r\nENTRYPOINT [\"node\",\"server\"]<\/pre>\n<\/div>\n<p>The image needs to be available on Docker Hub to be pulled later by RancherOS, so we should build and push the image:<\/p>\n<div class=\"highlight\">\n<pre># docker build -t husseingalal\/busydash busydash\/\r\n# docker push husseingalal\/busydash<\/pre>\n<\/div>\n<h2 id=\"starting-linux-dash-as-a-system-service\"><strong>Starting Linux Dash As A System Service<\/strong><\/h2>\n<p>Linux Dash can be started as system service in RancherOS using rancherctl service enable\u00a0<em>&lt;system-service&gt;<\/em>\u00a0while\u00a0<em>&lt;system-service&gt;<\/em>\u00a0is the location of the yaml file that contains the option for starting the system service in RancherOS.\u00a0<strong>linux-dash.yml<\/strong><\/p>\n<div class=\"highlight\">\n<pre>dash:\r\nimage: husseingalal\/busydash\r\nprivileged: true\r\nlinks:\r\n- network\r\nlabels:\r\n- io.rancher.os.scope=system\r\nrestart: always\r\npid: host\r\nipc: host\r\nnet: host<\/pre>\n<\/div>\n<p>To start the previous configuration as a system service, run the following command on RancherOS:<\/p>\n<div class=\"highlight\">\n<pre>~# rancherctl service enable \/home\/rancher\/linux-dash\/linux-dash.yml<\/pre>\n<\/div>\n<p>By using this command, the service will also be added to the\u00a0<strong>rancher.yml<\/strong>\u00a0file and set to enabled, but a reboot needs to occur in order for it take effect. After rebooting, you can see that the dash service has been started using rancherctl command:<\/p>\n<div class=\"highlight\">\n<pre>rancher@xxx:~$ sudo rancherctl service list\r\nenabled  ubuntu-console\r\nenabled  \/home\/rancher\/linux-dash\/linux-dash.yml<\/pre>\n<\/div>\n<p>And you can see that the Dash container has been started as a system Docker container:<\/p>\n<div class=\"highlight\">\n<pre>rancher@xxx:~$ sudo system-docker ps\r\nCONTAINER ID        IMAGE                          COMMAND                CREATED             STATUS              PORTS               NAMES\r\n\r\n447ada85ca78        rancher\/ubuntuconsole:v0.3.0   \"\/usr\/sbin\/entry.sh    About an hour ago   Up About an hour                        console\r\n\r\nfb7ce6f074e6        husseingalal\/busydash:latest   \"node server\"          About an hour ago   Up About an hour                        dash\r\n\r\nb7b1c734776b        userdocker:latest              \"\/usr\/sbin\/entry.sh    About an hour ago   Up About an hour                        userdocker\r\n\r\n2990a5db9042        udev:latest                    \"\/usr\/sbin\/entry.sh    About an hour ago   Up About an hour                        udev\r\n\r\n935486c2bf83        syslog:latest                  \"\/usr\/sbin\/entry.sh    About an hour ago   Up About an hour                        syslog<\/pre>\n<\/div>\n<p>And to test the Web UI just enter the following url to your browser:\u00a0<strong><a href=\"http:\/\/server%27s-ip\/\">http:\/\/server&#8217;s-ip<\/a><\/strong>\u00a0<a href=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2015\/05\/01131844\/16.png\"><img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2015\/05\/01131844\/16.png\" alt=\"16\" \/><\/a><a href=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2015\/05\/01131846\/17.png\"><img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2015\/05\/01131846\/17.png\" alt=\"17\" \/><\/a><\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>In version 0.3.0 of RancherOS, you have the ability to create and manage your own RancherOS system services. System service in RancherOS make it easy to enable is a Docker container that will start at the OS startup and can be designed in Docker compose format. For more information about\u00a0<a href=\"http:\/\/docs.rancher.com\/os\/configuration\/system-services\/\">system services in RancherOS.<\/a>\u00a0You can find instructions on how to download RancherOS from\u00a0<a href=\"http:\/\/docs.rancher.com\/os\/configuration\/system-services\/\">Github<\/a>.<\/p>\n<p><a href=\"https:\/\/rancher.com\/adding-linux-dash-as-a-system-service\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ivan Mikushin discussed adding\u00a0system services to RancherOS using Docker Compose. Today I want to show you an exmaple of how to deploy Linux Dash as a system service. Linux Dash is a simple, low overhead, and web supported monitoring tool for Linux, you can read more about Linux Dash\u00a0here. In this post i will add &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2019\/02\/07\/adding-linux-dash-as-a-system-service\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Adding Linux Dash As A System Service&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1202","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/1202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=1202"}],"version-history":[{"count":2,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/1202\/revisions"}],"predecessor-version":[{"id":1214,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/1202\/revisions\/1214"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=1202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=1202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=1202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}