[Cluster Daemon] - Add Shell Driver for Cluster Control [part 3]

in #utopian-io7 years ago (edited)





(Source)

<h2>Introduction <p dir="auto"><span>Clustd is an open source cluster management provider. The goal is to provide automated failover systems for apps, whether the system is down for maintenance or an unexpected event. When the system is ready, it will deployed in production on <a href="/@steemdunk">@steemdunk to minimize any form of downtime for the bot and web services. <p dir="auto"><em>Disclaimer: This is not intended to be used in conjunction with a database, otherwise data will be out of sync. See your database manual for setting up clusters that will preserve the integrity of your database across multiple machines. <h3>What does a cluster look like? <p dir="auto">Reminder from part 2 of what the full cluster will look like. This driver allows you to put the full setup into action for testing and deployment across multiple machines. :) <p dir="auto"><img src="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1520015918/c1m12puyk8rnvszdahxb.png" srcset="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1520015918/c1m12puyk8rnvszdahxb.png 1x, https://images.hive.blog/1536x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1520015918/c1m12puyk8rnvszdahxb.png 2x" /> <p dir="auto">Each machine runs a clustd daemon. The daemon provides automatic consensus on deciding a new master if the master goes down. Drivers control what actions to perform when this happens. <h2>Shell Driver <p dir="auto">This is the first release of the shell driver. It is the most basic of all but can be used to virtually control anything on the system with a shell script. The script is executed as the same user as the driver process. Scripts must not require any form of manual intervention! This includes sudo that requires a password. <p dir="auto"><img src="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1520286683/kvpd9xm9lh9ds64yc1gk.png" srcset="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1520286683/kvpd9xm9lh9ds64yc1gk.png 1x, https://images.hive.blog/1536x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1520286683/kvpd9xm9lh9ds64yc1gk.png 2x" /> <p dir="auto">The "1" and "2" and the script output is retrieved from the configuration as an environment variable. This is the output of the driver with full debugging enabled. <p dir="auto">The following configuration is used: <pre><code>host: ws://127.0.0.1:3001 secret: 'cluster secret' script: shell: /bin/bash cwd: . start: ./start.sh stop: ./stop.sh env: TEST: 1 MY_VAR: 2 <p dir="auto">Of course, you can specify any shell or command. The start/stop commands don't even need to be scripts. It can be something as simple as <code>systemctl start myservice (this command may require root depending on your system configuration). Scripts are the recommended way to go if more than a single line is needed. <p dir="auto"><span>Find the driver here: <a href="https://github.com/steemdunk/clustd-driver-shell" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/steemdunk/clustd-driver-shell <h2>Now what? <p dir="auto">clustd can now be deployed in a fully functional and useful manner. The previous parts setup the cluster, but wasn't able to provide usefulness. The shell driver will now fill the missing gap to provide full functionality you would expect of a cluster. <p dir="auto"><span>This is the first step towards creating a cluster for <a href="/@steemdunk">@steemdunk and will be deployed there first on a couple of machines. Afterwards automatic DNS record updating and notification drivers can be implemented to ensure uptime of web services and to personally notify me of issues. <h2>Previous parts <p dir="auto">If you're new to the project, be sure to check out the previous parts to get a full idea on the project. <ul> <li><a href="https://steemit.com/utopian-io/@samrg472/cluster-daemon-plug-and-play-driver-support-part-2" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Plug and Play Driver Support (part 2) <li><a href="https://steemit.com/utopian-io/@samrg472/cluster-daemon-creating-an-automated-failover-system-part-1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Introduction to Clustd (part 1) <h2>Components <ul> <li><a href="https://github.com/steemdunk/clustd" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">clustd service <li><a href="https://github.com/steemdunk/clustd-driver-shell" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">clustd driver library <p dir="auto"><br /><hr /><em>Posted on <a href="https://utopian.io/utopian-io/@samrg472/cluster-daemon-add-shell-driver-for-cluster-control-part-3" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Utopian.io - Rewarding Open Source Contributors<hr /><p>
Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.

[utopian-moderator]

I am not computer savvy...but thanks anyway.

This is really cool!

Another genius contribution Sir Sam, Amazing work brother

Great upgrade!

You do an amazing job, keep it up!

Hey @samrg472 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

so data can travel smoother nice!

please upvote my account. thanks.