Nowadays, you can easily get a free SSL certificate but you have to manually/automatically renew it every 90 days.
To apply for a certificate, you have to verify your domain - either by email of your domain, place a file on your server (which can be public accessed), or modify the DNS record.
If your DNS has configured CAA records, you need to remove them or add specific records allowing a SSL provider to issue the certificates on your domain.
Once the certificates are issued, you will see the following files:
The HTTP 503 Error indidicates the server is busy. It might be due to the fact that the servers are overloaded (high load average).
One of my API is designed to return 503 Error when the cached file is not available. It is designed as the follows:
1 2 3 4
if (!is_file($file)) { throw_503(); die(); }
The $file will be updated periodically e.g. every minute via Crontab. When the OS is writing to that file, the is_file will return false because the file is in-use.
One way of solving this is to have multiple caching versions, to avoid the single point of failure. For example, if a file-1 is not available we can check for file-2. These two files should not be updated at the same time.
Another way to resolve this issue is to add a delay check (hacky solution), for example:
1 2 3 4 5 6 7
if (!is_file($file)) { sleep(1); // delay check. } if (!is_file($file)) { throw_503(); die(); }
Which is incorrect. The problem is at the code L166
Here, the developer probably didn’t know the Math.log10 function can be used to compute the Log10, instead, he/she uses a math trick Math.log(x)/Math.log(10) to compute the Math.log10 based on natural logarithm (base e ).
This will introduce rounding errors, and sometimes intermediate results will be amplified leading to much bigger errors.
In Line 168, it uses parseInt, therefore, the difference will be becoming ONE.
There are a few fixes:
change parseInt to Math.round
change entirely to use Math.log10
or completely rewriting this function, as my PR (approved by @ety001 thanks!, but not merged yet due to this is a legacy PR which was created more than 2 years ago and the main branch has differed a lot). https://github.com/steemit/steem-js/pull/345/files
If you are happening to rely on this function, you probably need to do it yourself until this fix is merged.
Every little helps! I hope this helps!
Steem On!~
If you like my work, please consider voting for me, thanks! https://steemit.com/~witnesses type in justyy and click VOTE
Alternatively, you could proxy to me if you are too lazy to vote!
Many questions are interesting but the answers are not obvious or easy to get. For example: Who comments most in the last 24 hours?
I am going to show you a pattern to find out the answers to such questions using SteemJs.
Get Current Lastest Block
We need to get the latest block number on the steem blockchain, and we can work out roughly the last 24 hours block range by subtracting 206024 (3 seconds a block).
1 2 3 4 5 6 7 8 9 10 11
function getBlockchainData() { return new Promise((resolve, reject) => { steem.api.getDynamicGlobalProperties(function(err, result) { if (!err) { resolve(result); } else { reject(err); } }); }); }
Each block contains transactions, here you would need to parse the list of transactions and look for the particular ones that you are interested. For example, if we want to compute the total producer rewards by witnesses, we can look for “producer_reward”.
Of course, if you want to further develop into a tool, you would need a database, and a background daemon that automatically syncs with the blockchain.
Usually, I send update using the conductor directly on my witness server. But sometimes when you are not able to SSH, this tool would be handy.
Click “Get Witness Information” which will retrieve the current Witness Data and populate in the fields.
A friendly advice: Set Signing Key to STM1111111111111111111111111111111114T1Anm to take your witness offline if you are not able to make it! (to avoid missing blocks and be voted out)
Every little helps! I hope this helps!
Steem On!~
If you like my work, please consider voting for me, thanks! https://steemit.com/~witnesses type in justyy and click VOTE
Alternatively, you could proxy to me if you are too lazy to vote!
What is On-Call? You know many Software Engineers at Big Companies need to do On-Call Duties to fix service related issues when they arise.
Yesterday, I presented a utility to switch your node in case of missing too many blocks. But wouldn’t it be a lot nicer if we can be notified (be paged) when this happens?
Please be warned that if you like less intrusive notification, you should go for SMS (which should be easy to set up using the method below) or even just email.
This is how we can set up the on-call when missing blocks.
IFTTT
You may have heard of IFTTT which stands for If This Then That. This is a powerful service that allows you to connect two or more services.
First, you would need to register a IFTTT account, then you would need to connect the “Webhooks” service which allows you to send a message to the hook. Then, the “That” part would be to connect the “Voip Call” part which will call you - alternatively, you could choose other notification methods such as SMS or Emails, or even make a tweet if you like!
This is how the final recipe looks like:
Note that we can pass a value1 parameter to report the current missing blocks. Here is how you send a notification message to the webhook aka “This”
function reportMissing(missed) { log("Report missing: " + missed); // TODO: You can send a email/SMS here execSync('curl -X POST -H "Content-Type: application/json" -d \'{"value1":"' + missed + '"}\' https://maker.ifttt.com/trigger/{steem-witness}/with/key/YourIFTTTKeyHere'); }
That is it, everytime there is a missing block, you will get a call who will tell you total missed blocks aka the parameter value1