The Steem blockchain was upgraded earlier today. You may experience trouble posting and transacting while the new bandwidth system stabilizes. Read more here.

Dockerized + Pistonized version of clayop/steemfeed for Witnesses

in witness-category •  2 years ago

https://blog.docker.com/wp-content/uploads/2013/08/KuDr42X_ITXghJhSInDZekNEF0jLt3NeVxtRye3tqco.png

As a brand new witness, I was having one hell of a time getting everything setup for my publish_feedscript. Everything I found needed a cli_wallet running and serving a http rpc with my key in it. Unlocking and locking wallets felt a little insecure and I figured there had to be a better way. I started doing research on how we could do away with the cli_wallet instance as a requirement and make it a standalone application.

After a half day of research, I forked clayop/steemfeed and creating a new version that no longer uses the cli_wallet, but instead uses @xeroc's piston. It creates the signed publish_feed transactions and broadcasts them via the database_api rather than the wallet_api. I also wrapped it in a docker configuration for easier management. Special thanks to everyone (including @clayop) who worked on this project previously.

You can find my fork of this steemfeed publishing tool here: https://github.com/aaroncox/steemfeed

You can also view all of the changes I've made in this single commit.

Running

Installing Docker

I'm not going to go into detail about installing docker, there's plenty of documentation for that already. Just make sure docker works from your command line, docker info is a good command to see if you're connected properly.

Clone the Repository

Clone down the repository to the desired location:

git clone git@github.com:aaroncox/steemfeed.git

Configuration

The entire configuration is now controlled through a .env file that you'll create inside of the project. I've placed a template file, .example.env, in the root of the project that you can copy as a default. Copy the example to the proper place:

cp .example.env .env

Then open this file in your favorite editor. There are only 2 values you need to fill out:

  • feed_account: The account name of the witness account.
  • feed_wif: The WIF ACTIVE Private Key for the witness account. This is used to sign transactions.

There are plenty of other adjustable configuration options, all of which already have default values.

Run it

There are two ways to run this in docker:

Run in the foreground

If you'd like for this to be an active process on your machine, run this command:

docker-compose up

The output of the application will be displayed on your terminal window. To stop the process, use CTRL+C.

Run in the background (daemon)

If you'd like for this to be a background process on your machine, run this command:

docker-compose up -d

If you'd like to view it's logs, you should be able to just run:

docker logs -f steemfeed_app_1

To stop the background process:

docker stop steemfeed_app_1

Rebuilding the Docker image due to Code Changes

Since this is docker, the code has been copied in place during your first build. If you are modifying the code itself and need to rebuild the docker image, you can run:

docker-compose build

If you're actively developing and want to rebuild and run, just run:

docker-compose build && docker-compose up

That's it!

You've got a price feed updater running now. Feel free to suggest changes, fork my code, or submit some pull requests!

I'm pretty thrilled with how this all worked out, though there are still a few things that need to be done:

  • The two classes I added, Exchange_rate and Feed_publish will need to be implemented eventually (and properly) into the libraries provided by @xeroc.
  • Default values should probably be defined if the environmental variables are unset.
  • I cleaned up the dependancies as best I could, but there may still be some strays. I'm still relatively new to python.

Good luck witnessing!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Nice work @jesta - thanks for getting it integrated with Piston.

Wow, its sounds like a lot of work. Is this something we all should look into, and what might be the gain. I see its a price feed updateer is that for the posts or steem in general. Hope you'll update us on this, and share your results. I'll be looking. I need to research this witnessing thing...Im not up on that yet!

·

It's only something you need to do if you're really intent on helping the network and you're acting as a "witness". I'd do some research into that. The price feed component is one of the smaller parts of witnessing in general.

Awesome work! My friend just set up Docker for the project we are working on and it really is incredible for the people who get to take advantage of it after it has all been setup up :D

I mentioned you in my last post as it related to your comment thread with @snowflake on @kaylinarts post.

It is about an "all-in-one" app in China.
There is also a video link that I based it off if you just want to head about the app itself.

·

Glad you're continuing on the conversation :)

Nice one! I WISH i was a coder :)

Good job! Btw. I have seen you push to Telegram. Do you (or anyone reading this comment ;) know of any good instant messenger libraries for Python? I am currently looking at Skype4Py, the official one for Slack and three Telegram ones twx.botapi, Telepot and txTelegramBot. Additionally ms bot framework , but it requires to create a Microsoft account... I do not want to send to steemit anything, just pull stats from there and push them further.

What @jesta has done in terms of dockerization-- it surely was a lot of work, and it's probably something that would indeed prove to be a useful standard for both witnesses and miners alike.