Getting Started With The SteemIt Development (AWS Certified)

in #steemit7 years ago

A Complete Tutorial On Steemit Development

First, let me give you some overhead of some really great tools out there.

I am an Associate AWS Certified Engineer. I've been working with AWS for 4 years now professionally. I have personally been using Docker, as well as I have worked with developers who use Lambda. I handle the automated deployment process.

So, let me introduce some of these great tools to you. If you aren't using one or some of these (or at least something comparable), you probably want to reconsider what you are doing.

Tools

Docker

This is great for portability. In short, you can write your entire application in a 'Docker Container'. Its basically a linux box that you customize and then upload to a repository, such as docker hub. Docker hub is basically a place where you put your docker images. A docker image is like a "compiled server". It is your linux instance with everything pre-installed and ready to go.

https://docs.docker.com/get-started/

A basic docker container is really simple to understand. Basically, it goes something like this:
https://github.com/dockerfile/ubuntu/blob/master/Dockerfile

You basically define which operating system you want to use. And then you run Linux Commands using the "RUN Command".

Dockerfile

FROM ubuntu:14.04
RUN apt-get install mysql

Note that the above example uses Ubuntu. Ubuntu is very large, around 1 GB. Ideally you should use Alpine Linux, which is 5MB. But if you are familiar with ubuntu, it is reasonable to use it when starting off.

Elastic Beantstalk

This is paid AWS Service. Why is this service awesome? Because it allows you to easily scale your software (assuming, of course, you wrote your software correctly). You can increase how much RAM/CPU your server has, as well as how many of them you have. It handles load balancing between the servers, so if one of your servers fails, that doesn't mean your product becomes unavailable.

The best part? It allows you to deploy docker containers. So, you can write your platform independent server on your docker container, and then plop it on to Elastic Beanstalk. Then, you can scale all the way up to 1000 servers handling your requests.

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html

You just need to make sure you upload your docker container to a docker repository first.

http://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html

Lambda

This is "the future" of computing. This is effectively a micro-server that runs for no longer than 5 minutes. It simply executes your code and returns a result. AWS takes care of all the infrastructure behind the scenes, so this is great. And, to sweeten the deal, you only pay for what you use. So if you carefully design your software, you can drastically reduce the cost of running your software in the internet. This is a must have.

This allows you to use Node.js, Python, Java, and C#. This sounds super useful for Steemit's Python SDK. I will definitely be experimenting here to keep costs down.

http://docs.aws.amazon.com/lambda/latest/dg/welcome.html

API Gateway

This AWS Service is used to provide a layer on top of Lambda (or Elastic Beanstalk for that matter). Why is this awesome? Because it exposes your services over a RESTFul interface. Your server's (or microservice's) functions become readily exposed through a restful interface.

This allows you to write your code in a platform independent way. Maybe facebook uses PHP, and Steemit uses Python. But they can all make REST requests to API gateway. And API gateway can return the result.

They give you a nice UI to work with to create your Restful Interface. It can be exported as a Swagger document as well, which comes in handy.

http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html

Python

This is the language that Steem uses. You need Python 3.5 or higher according to the documentation. To make it easy, you can download python here:
https://www.python.org/downloads/

Installation

First, lets install Python

You pretty much select "Install Complete" and then you are all set.

We should be good to go. Now we need to install the steemit SDK. Open up a command prompt, and install the steemit SDK. I had problems, and I had to upgrade pip prior to installing steem. PIP, is a package manager for python. Think of it like an app store where everything is free.

After installing, I also had to add python to my PATH variable.

Start -> Control Panel -> System -> Advanced System Settings -> Environment Variables
Modify the system variables (bottom pane), and add the following to the end of PATH
...;C:\Users<username>\AppData\Local\Programs\Python\Python36-32\Scripts\

I had to install other dependencies prior to install the Python Steem SDK. Basically, Steem SDK required Visual CPP, which required .NET Framework 4.5+. So, working backwards, install .NET first.
https://www.microsoft.com/en-us/download/details.aspx?id=48137

I also had to install the visual-cpp-build-tools. Those are available from this site:
http://landinghub.visualstudio.com/visual-cpp-build-tools

I still had additional issues with installing the Steemit SDK and had to install the following. This stack overflow post helped me get started:
https://stackoverflow.com/questions/23691564/running-cython-in-windows-x64-fatal-error-c1083-cannot-open-include-file-ba

First, Download and install Microsoft Visual C++ 2008 Express.
http://go.microsoft.com/?linkid=7729279

Then download the SDK for Windows 7. You only need the headers and libraries, plus the visual c++ compilers.
http://www.microsoft.com/en-us/download/details.aspx?id=3138

This lead to other problems, for which I had to install more python libraries.

pip install -U setuptools
pip install -U virtualenv Download and install Visual C++ Build tools

Even after all of this, I still had problems, and I also had to install this.
https://github.com/develersrl/gccwinbinaries

This is when I learned that the python library is not compatible with windows, due to some C++ files that are only available on linux.

I am tracking the issue here, and will repost as soon as I get this running on Linux.

Once you've done this, you're ready to begin installing the steem SDK

python -m pip install --upgrade pip
pip install steem

Sort:  

Congratulations @iceshaft07! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!