View this post on Hive: Dockerizing DiscoSteem-Bot and new action to get Steem account info
Bug Fixes
- Fix syntax error where a line was ending with a coma instead of a semicolon.
New Features
- Added a Dockerfile and docker-compose.yml to allow running the bot in a Docker container. This will facilitate the deployment of the bot on any platform that supports Docker.
- Added a new command and action to retrieve a Steem account info and render it in the channel. To trigger the action, the command is:
$info <account>
The Implementation
Docker/Docker Compose
The Dockerfile
Allows you to build a Docker image containing NodeJS and NPM. It will copy the current directory containing the bot into the image and run an npm install
to download dependencies and build the bot.
The docker-compose.yml file just makes your life easier by providing a YML config file from which Docker Compose will form a valid Docker command line to start/stop the container.
Building the project
You just need to install Docker and Dockercompose for your platform. Then clone the DiscoSteem-Bot GIT repository and run the build command docker-compose build
.
Docker will download all the dependencies to install the OS inside the container and run an npm install
.
Running the projet
Once the project has been built, you just need to do a docker-compose up
:
Do some tests, if you are happy with it, press Control + C to stop the container. You could do a docker-compose down
to make sure the container has been properly stopped. Then run docker-compose up -d
to start the project as a background process.
The new action
You can see the changes on this GIT commit. I'm just using the SteemJS API methods getAccounts
and getDynamicGlobalProperties
wrapped inside a Promise so I can start rendering the data when both results are sent back from those two asynchronous calls. getDynamicGlobalProperties
is needed to retrieve needed values to calculate Steem Power.
Posted on Utopian.io - Rewarding Open Source Contributors