This is an opportunity to not only get feedback from your company, but also to help shape your role into it, defining a roadmap for your own career. When you are not part of this conversation, when you are just a listener, you leave your future in the company up to whatever other decides for you.
5 min read
Don't we love having a good performance review, from our bosses to ourselves, every now and then? Of course we do! Is that moment were we get to be told how great of an employee we have been (finger cross that's the case) and to potentially get a salary raise (and I don't have to ask how much we love that).
Thing is that our performance review, appraisal, catch up, or whatever you would like to call, it is about having a conversation where you should also bring something to the table.
Why?
This is an opportunity to not only get feedback from your company, but also to help shape your role into it, to define a roadmap for your own career for the next cycle up to, let's say, your next performance review.
When you are not part of this conversation, when you are just a listener, you leave your future in the company up to whatever other decides for you. If you are "sort of lucky", the company you work for might already has defined a plan for you, and if you are "very lucky" you will like that plan. You would be betting, twice.
But, again, that's oddly the case when we don't have a say for our career.
How?
What I like to do for basically all meetings I have (and my performance review is no exception) is come prepare with notes and bullet points to discuss.
For this particular scenario I recommend doing a self-evaluation, ahead of the meeting, to know were we stand and were we would like to go from there.
Depending on our role in the company we can also cover where the company stands, where we would like it to go, and how we think we can get there.
I divide my self-evaluation, self-assessment, auto-evaluation, or, again, whatever you would like to call it, into different sections starting with "What I like to do and what I don't like to do".
This is a reflection time opportunity for me to know, up to this moment, after everything I went through from the last catch up, of all the things I've been doing so far what I actually like to do, and if I think I would like to continue doing them.
For example, let's say I've been doing a lot of documentation since the last time we had a catch up. Did I like that? Or was it more of an emergency role I had to take on that I would like to dodge from now on? Can I think of any available role I might like to fulfill with this skill that I think I'm good at and also like to perform?
The "what I don't like to do" part is to identify if the tasks I've been performing were those sort of a one-time-only tasks due to an emergency, or if they are in fact part of my job description.
If the stuff you don't like to do outnumber the things you do like, then you have a bigger problem here. But that's just another good idea for doing a self-evaluation: you can get yourself aware of how happy (or not) you are at your job.
The second section is called "Things I should put more attention at", which basically means "what I've been doing wrong" (but let's keep a positive tone here and not sound that radical). Now is when I need to be truly honest with myself in order to be able to identify where I have room to improve at work.
It's not only about telling where I could be better, but also to discover why I wasn't doing my best so far, and what I think could increase my performance on these areas.
I consider important to demonstrate that I'm able to tell when I'm not at my best before somebody points that out to me, and that I'm also capable of being part of "fixing" this situation with ideas and suggestions of my own.
Third section is about "Things we should keep an eye on", which involves the company itself and it's my chance to talk about how I see the place I work in.
You are, supposedly, at a different position than your superiors, therefore you might be able to provide another vision at how things are: what do you think the company is doing well, what things would be good to avoid losing, and what things do you think the company should put more effort in.
Clearly, this would be attached to your bosses' willingness to get some feedback on a meeting designed mainly to provide it to you. But, if you have the chance to give it a shot, just go for it.
Since my role is more technical I do have a fourth-ish section which is more like a twist for the last one, and I call it "Things we should keep an eye on... from a technical point of view" (the title speaks for itself).
This is my opportunity to say where I would like things to go, for the company, on the technical side, which is allegedly my area of expertise.
Following on the example of me doing a lot of documentation, I can bring ideas on how we can make this behaviour part of the company's culture.
Up there you can see a real self-evaluation I did on March 2019 before a performance review I had, and two more on the sidebar.
Keeping them works as a log to retrace my steps when I feel overwhelmed to assess if I'm on track regarding my latest self-evaluation of my performance or if I need to adjust something.
Basically, my idea is to avoid working blindly from one catch up to the other.
Fixing this is quite simple as it only involves replacing the cacert.pem file with the one you can download here.
2 min read
I'm going to be honest with you: I have no idea why this can happen.
This is one of those errors that makes you say "this started to happen out of the sudden and I'm 100% sure I touched nothing". But it's there, and I have a potential solution, hoping you are in a hurry to get it fixed without asking too much questions.
[Composer\Downloader\TransportException]
The "https://example:example@repo.example.com/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
The full error is up there and it appears when you use Composer such as when running composer install, and it seems to be that your computer is using a wrong (or not up to date?) CA certificate when trying to communicate with a Composer repository.
cacert.pem is a bundle of CA certificates that you use to verify that the server is really the correct site you're talking to (when it presents its certificate in the SSL handshake).
So, fixing this is quite simple as it only involves replacing the cacert.pem file with the one you can download here: CA certificates extracted from Mozilla.
If you are using MAMP, chance are that the file you need to replace, locally, is on /Applications/MAMP/Library/OpenSSL/certs/, but if you are unsure you can open a Terminal and run locate cacert.pem to get a list of all the places where you can find the Certificate Authority file.
If still unsure about the location of the cacert.pem you need to replace, check your php.ini and look for the openssl.cafile= line.
[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
openssl.cafile=path/to/cacert.pem
Finally, remember to restart Apache before trying again.
A complete guide with everything you need to know to successfully migrate any Magento project living on any server to Cloudways.
8 min read
While the title up there make this post looks like a promoted and/or paid one, that's not the case (I wish), and instead this is an honest appreciation of Cloudways and how it has made my life easy while dealing with servers, specially considering that I don't think myself as an advanced devOps.
Recently at the company I work for we had the task to move an existing Magento project, already in production and publicly accessible, from a server outside Cloudways to a server managed by Cloudways.
What's next is going to be long, and everything described could take around 3 days (one day for the server creation, another day for testing the new instance, and a third day for the actual site moving), depending on your skills.
So let's get to it.
Preparation
Make sure to tick a few boxes before moving forward by checking if you have the following:
Credentials to access the original server over SSH and SFTP, with enough permissions to manipulate files within the web root folder (usually public_html or www), use scp, tar, and cat for server configuration files such as the one for Nginx and Varnish.
Server permissions to use mysqldump to create a database backup, or a way to get your hands on a database backup of the project living on the original server.
Access or a point of contact for managing DNS changes for the project’s domain.
Access to the payment gateway accounts and/or credentials needed to configure the payment methods.
Finally, make sure to identify which third-party services currently connect directly to the server over SFTP or similar, because those will need to be reconfigured to point to the new IP and/or to be given new SFTP credentials.
Create the server in Cloudways
Decide on the server size and create it on Cloudways, making sure to factor in how much space you will need for the database, files, and "maneuver" as you will be moving zipped files from the original server to unzip them later.
Server creation example using a "PHP - Custom App" for a Magento Open Source 2.2
Cloudways offers Magento-ready instances for specific versions. If the project you are moving uses a Magento version already listed in Cloudways you can select this version from the dropdown that appears when creating the server, otherwise make sure to select “PHP - Custom App” instead.
This is important because, for example, if you are moving a Magento 2.2 version to Cloudways you can not select “Magento - Version 2.4.1 (with Elasticsearch)” from the dropdown as this instance will come with Elasticsearch 7 out of the box and you won’t be able to downgrade it to Elasticsearch 6 (which is the required version for Magento 2.2 using ElasticSuite).
If you need to go down the route of selecting “PHP - Custom App”, then you must contact Cloudways Support for them to "flag" this instance as Magento internally, after creating it.
This is because Cloudways offers specific configurations and performance-oriented settings for each type of instance, like an internal logic in place to load the specific Varnish settings a Magento project would require.
Cloudways Support flagging a "PHP - CustomApp" as Magento internally
Whatever the Application type you choose, you still need to contact Cloudways Support to ask them to:
Downgrade Composer from version 2 to 1 by running composer self-update --1 (you can't do it because you don't have enough server permissions to do so).
Install a few Elasticseach plugins by running bin/elasticsearch-plugin install analysis-phonetic; bin/elasticsearch-plugin install analysis-icu; bin/elasticsearch-plugin install analysis-smartcn; on the /usr/share/elasticsearch folder (another thing you won't be able to do due to permissions).
You still need to configure a few bits here and there using the Cloudways Dashboard to make sure you match your project needs, including but not limited to the following items:
PHP version, execution limit, memory limit, error reporting, and timezone.
MySQL version and timezone.
Nginx WAF module to be Cloudflare, Sucuri or disabled.
Elasticsearch version, if needed.
Redis, if needed.
Varnish, if needed.
I can't tell what you need to put in those fields as that depends on the project.
Configure the Application
Inside the "Domain Management" section, make sure to configure the project's domain and all the additional necessary domains (like the ones used for different stores if your Magento project is configured to use multiple websites and stores).
Your "SSL Certificate" configuration will depend on what your project needs.
Since you are moving from one server to other, chances are you already have a SSL certificate that you can use, otherwise the Let's Encrypt option is quite good.
If you are using a firewall such as Cloudflare or Sucuri, the certificate might be "living there" already so there's nothing you need to configure here.
Do not add any cron in the "Cron Job Management" section for now.
We'll come back to the "Application Management" configuration later at the end.
Stop crons on the original server
By editing the crontab with crontab -e on the original server, or by contacting the original server hosting provider, disable all the crons by adding # at the beginning of each line.
An example of editing the crons with crontab -e and commenting out every line
This needs to happen before you move any file from the original server to Cloudways, and before the database backup creation.
Technically speaking, you want to avoid Magento to keep on writing any file in, for example, the var folder within the Magento root folder, related to Orders processing or Catalog management (like stock updates), and you want Magento to stop altering tables related also to those entities, which are the usual stuff affected by crons (among many other things).
If, for example, there are pending Order and/or Catalog tasks, they will be taking place in Cloudways after we finish the migration and we enable back the crons on the new server.
Move the files
Make sure to move the pub/media folder from within the Magento root folder, and any other custom folder and file that doesn't live in the repository.
Usually, there are some custom folders and files inside the pub and var folders that are not created automatically.
If you happen to be using Capistrano on the original server you would have a shared folder in the web root. In that case, just move that folder from the original server to Cloudways.
The way I do it is by creating a .tar.gz file with everything in it, but any cache folder...
[user_original]:~$ tar cvzfh shared.tar.gz shared/ --exclude='pub/media/catalog/product/cache';
tar cvzfh filename.tar.gz folder-to-zip/ --exclude='path/to/exclude';
...and then I transfer it from the original server to Cloudways using scp...
Make sure to push this file into the public_html folder in the Cloudways server, so you just need to unzip it there with tar -xvf shared.tar.gz; and then delete it.
Something I would like to do, just in case, after this big move, is to fix any potential permissions issue with the files and folders I just unzipped, by reseting those permissions using the Cloudways Dashboard.
Application Management setting to reset files/folder permissions
Enable Maintenance Mode
Put the site living on the original server into Maintenance Mode by running bin/magento maintenance:enable before proceeding.
For what it's worth, the downtime starts now.
Move the database
Using mysqldump create a database backup on the original server.
For security reasons, make sure this happens on a folder not accessible over the browser, like on the private_html folder or anywhere outside the web root.
Once done, push this .sql file to the Cloudways server using scp again.
For the same security reasons, make sure to push this file to the private_html folder in the Cloudways server.
Once the transfer is completed, and before anything else, you need to remove the DEFINER from the .sql backup to avoid any "Access denied; you need (at least one of) the SUPER privilege(s) for this operation" issue while trying to import it.
Basically, run the following command on the private_html folder in Cloudways (or anywhere you pushed the .sql file before).
[user_cloudways]:~$ sed 's/\sDEFINER=`[^`]*`@`[^`]*`//g' -i database_export.sql;
Now the backup is ready to be imported into the actual database in the new server.
For this to happen you need to contact Cloudways Support with the request.
Cloudways Support handling the database import
After the import, make sure to delete the .sql file.
Configure Magento
By accessing directly to the recently imported database in Cloudways, and not through the Magento Admin Panel, make sure to have the correct details for Varnish and Elasticsearch, keeping in mind that Cloudways uses port 8081 for Varnish, and 127.0.0.1:9200 for Elasticsearch.
Make sure there's no reference in the core_config_data table to the IP for the old server that you might need to change for the IP of the new one.
Go back to the files, and edit the app/etc/env.php file you transferred from the original server to fix the credentials for connecting to the new database living in Cloudways now.
In that same file, correct the details for Redis (if used) keeping in mind that Cloudways uses 127.0.0.1 and 6379 for the host and port, respectively.
Once done, clear cache and reindex to make sure everything is working.
Configure the Application again
Go back to the "Application Management" in the Cloudways Dashboard and configure, in the new server, all the crons you commented out on the original server, making sure to use the right paths for the new server.
Inside the "Application Settings", configure the "WEBROOT" to point to the pub folder from within the Magento root folder.
Point the domain to the new server
First thing first, make sure Magento is still on Maintenance Mode on the new server, and whitelist your IP to be able to access the site (using the bin/magento maintenance:allow-ips command).
Now change the DNS settings to point the project's domain to the new server.
The whole idea is to open the site only for you in order to test it before allowing real customers. So, while the DNS change propagates, some customers will hit the site on the old server (that will show the maintenance page forever and ever), and others will hit the site on the new Cloudways server (that it will also show the maintenance page while you test it).
Now is when you test the site and make sure everything is okay.
Disable Maintenance Mode
Once you are done with the testing open the site, now in Cloudways, to the public, by disabling the Maintenance Mode (with the bin/magento maintenance:disable command).
If you are unlucky enough to be reading this article it means that you are seeing that error when trying to reindex Magento.
This happens because you are probably running out of disk space and Elasticsearch turns itself into read only mode because, well, there's no more space to do stuff.
1 min read
If you are unlucky enough to be reading this article it means that you are seeing that error when trying to reindex Magento.
This happens because you are probably running out of disk space and Elasticsearch turns itself into read only mode because, well, there's no more space to do stuff.
In order to get out of this situation, you need to first disable that Elasticsearch feature of switching to read only mode (otherwise it will happen again) by running the following...
I had a simple task that consisted on getting some query string parameters from the URL, from the PHP $_GET variable, to store them in Magento.
What sounded like a very straightforward task got complicated because the $_GET variable was missing some of the those parameters I needed to save.
2 min read
I had this weird issue a time ago with a simple task that consisted on getting some query string parameters from the URL, from the PHP $_GET variable, to store them in Magento after the Customer places the Order.
What sounded like a very straightforward task got complicated because the $_GET variable was missing some of the those parameters I needed to save.
Debugging this issue made me realise that all the missing parameters where those starting with utm. I was literally going to this example URL...
...to get the following incomplete output when printing the $_GET variable:
The cause of this issue was Varnish's recommended VCL configuration for Magento that includes the following inside the sub vcl_recv {}.
# Remove all marketing get parameters to minimize the cache objects
if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=") {
set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
set req.url = regsub(req.url, "[?|&]+$", "");
}
That was literally subtracting all marketing-related GET parameters from the URL, including those starting with utm_.
The solution is quite simple: remove the utm_[a-z]+ from the if conditional and restart Varnish to apply the changes.
UTM parameters?
UTM stands for "Urchin Tracking Module" (who cares, right?), which are basically marketing-related parameters to track marketing campaigns, and to know how people interact with the site.
In my case I was dealing with them because of a Rakuten integration with Magento.
For interviews to fill a technical role it's obvious that the questions needs to be technicals.
But soft skills related questions allow you to get to know the human you are interviewing, having in mind that you'll share with that person more than some lines of code if you ended up offering the job.
3 min read
For job interviews to fill a technical role it's obvious that the questions needs to be, well, technicals, with focus on the hard skills questions aiming to know the candidate's knowledge in a specific framework, code language, software, etcetera.
But the attitude is very very very... very much... important. I said it before:
Everybody has access to the same documentation, to the same in-house training programs, to the same software, to everybody's code, to basically the same people to ask questions and to learn from... and what's set the difference between someone progressing in his or her line of work and someone stuck is the personality each developer has.
Soft skills related questions allow you to get to know the human you are interviewing, having in mind that you'll share with that person more than some lines of code if you ended up offering the job.
It also humanise the interview. If you pay attention people are usually tense answering the technical questions but when you throw in a soft skills one candidates relax and enjoy the conversation created around that question.
At my current job we have a few very good soft skills questions I would like to share now in case you find them useful (our interviews are for web developers so the questions, while soft skills related questions, orbit around that role).
What do you think makes a good developer?
I personally expect whatever answer that's not about code, software, or any other hard skill stuff.
People usually talks about the ability of being flexible, passionate about it, the importance on working as part of a team, etcetera. Still some candidates mention hard skill stuff not covered before in the interview such as testing, and that's fine.
What do you think makes a good manager?
I like this one because it's a chance for the candidate to talk about others, and it's expected that they think of their current boss (obviously).
The answer will give you an idea of how the candidate works on a team structure where somebody is on a position above them. And at the same time it will hint you if the candidate will do well with the current managers at your company.
I like the answers about leadership and motivation.
What do you think you would add to the team if you were to get the job?
This is the polite version of "Why do you want this job besides money?".
I like this one because it forces the candidate to summarise what's their contribution to the team. And it's important to emphasise the team in the question, like you are not just adding something to the company but adding something to a team made of real humans.
What would you expect from the team if you were to get the job?
In opposition to the previous one, this is the time for the candidate to tell us how they see themselves after any period of time as part of a new team.
Again, we are asking about the team, not the company, so we try to keep it human while guiding the candidate into giving us something not technical.
If you were to organise a work social night out, what would you plan?
This always takes the candidates by surprise. They are thinking about PHP, VueJS, code reviews, pull requests and out the sudden they need to think about beers (because beers is the right answer to a social night out plan).
What do you like to do when you aren't coding?
There's no better question than this one to force the candidate to stop talking about hard skills and say something about their personal life (as much as they want, don't force people into talking about their personal life on a job interview).
It is also fun to learn about others people hobbies.
Magento recommends to configure this to be async for performance, so the email dispatch process doesn't block nor delay what the customer is doing, or to avoid long cron runs when an ERP is updating orders status.
I also recommended to configure this to be async to avoid having unsent emails.
2 min read
There are two ways to configure how Magento send order related emails (order confirmation, invoice, shipment and credit memo emails):
Either immediately when an action is performed (for example, right after you place an order).
Or cron-based (asynchronous).
Magento itself recommends to configure this to be asynchronous for performance reasons, so the email dispatch process doesn't block nor delay what the customer is doing (for example, less time consumption when the customer is placing an order), or to avoid long cron runs (or total crons block) when an ERP is updating orders status in bulk.
Enabling the “Asynchronous email notifications” setting moves processes that handle checkout and order processing email notifications to the background.
For my personal experience, it is also recommended to configure emails sending to be asynchronous to avoid having unsent emails.
When this is configured as immediately (not async), if an email fails to be dispatched because of any reason (like a server timeout) then Magento won’t try to send that email again in the future and the customer won’t be ever notified of his/her action.
Basically, there are a lot of good reasons to have this to be async.
Before setting this up
If you are going live for the first time on a new site there's not much to worry about, but if you are changing this setting from not-async to cron-based on an already live site then there's something to consider first.
The way this works when it's configured to be async is that Magento will rely on a cron to pick up from the database (from those tables related to Orders, Invoices, Shipments and Credit Memos) all those entities where the email was not dispatched, and it will send it.
Problem is that Magento doesn't care much about the date of those entities.
For example, if there’s an Order from 2019 whose order confirmation email was not sent because of any reason (for example, because there was a PHP error that stopped the execution), the cron will now pick this Order up and Magento will send the email related to that order.
To avoid this behaviour we should mark all pending emails from Orders, Invoices, Shipments, and Credit Memos as if they doesn't need to be dispatched, which can be done by executing the following SQL statements before enabling the asynchronous sending.
UPDATE sales_order SET send_email = 0;
UPDATE sales_invoice SET send_email = 0;
UPDATE sales_shipment SET send_email = 0;
UPDATE sales_creditmemo SET send_email = 0;
What we are doing here is ignoring the sending of emails for old Orders (and Invoices, Shipments and Credit Memos) so when we change this to be async the cron will only cares for future stuff.
Changing the configuration
Enable the “Asynchronous sending” option under “Stores → Settings → All Stores → Sales → Sales Email → General Settings”.
This issue seems to be related to macOS Big Sur and MAMP (somehow) and it can be easily solved by fixing some broken symlinks.
2 min read
I had this weird issue that seems to be related to macOS Big Sur and MAMP, allegedly, either both combined or when upgrading any of those two (or both?).
I don't know exactly why this happened to me out of the sudden (I blame MAMP as it was the last thing that I updated) but I managed to fix it anyway.
PHP Warning: PHP Startup: Unable to load dynamic library 'pgsql.so' (tried: /Applications/MAMP/bin/php/php7.3.21/lib/php/extensions/no-debug-non-zts-20180731/pgsql.so (dlopen(/Applications/MAMP/bin/php/php7.3.21/lib/php/extensions/no-debug-non-zts-20180731/pgsql.so, 9): Library not loaded: /Applications/MAMP/Library/pg/lib/libpq.5.dylib
Referenced from: /Applications/MAMP/bin/php/php7.3.21/lib/php/extensions/no-debug-non-zts-20180731/pgsql.so
Reason: image not found), /Applications/MAMP/bin/php/php7.3.21/lib/php/extensions/no-debug-non-zts-20180731/pgsql.so.so (dlopen(/Applications/MAMP/bin/php/php7.3.21/lib/php/extensions/no-debug-non-zts-20180731/pgsql.so.so, 9): image not found)) in Unknown on line 0
To get around this situation, many suggest to update Brew with brew update. That didn't work for me (and to be honest I can't see what's the relationship with Brew and MAMP) but you can give it a try anyway since it's easy to do.
What's interesting about the error above is that it mentions pgsql.so.so which is clearly wrong because of the double .so extension.
So how do I actually fix this issue?
Go to that extensions subfolder mentioned in the error (for example, mine is /Applications/MAMP/bin/php/php7.3.21/lib/php/extensions/no-debug-non-zts-20180731/) and create a symlink for pdo_pgsql.so called pdo_pgsql.so.so by doing:
ln -s pdo_pgsql.so pdo_pgsql.so.so
Now it doesn't matter what MAMP is looking for as it will find it either way.
That's not all. Go to /Applications/MAMP/Library/pg/lib and you'll notice something really weird which are broken paths for the symlinks libpq.5.dylib and libpq.dylib as seen below.
Again, how that happened is another mystery. But it doesn't matter, let's just fix those symlinks by deleting them and creating them again.
As you can see on the previous screenshot, the symlink libpq.5.dylib points to a broken path for libpq.5.7.dylib which is basically right there on the same folder. The same goes for libpq.dylib.
At the end everything should look like the following:
Basically, when you have no way to "unlock" an index, and after you already tried the reset and manual reindex, just change the prefix in your app/etc/env.php file to something new, and try to reindex again.
1 min read
"What now?" issues every now and then with Magento are the norm, and I got this one a few days ago:
SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO `catalog_product_index_eav_temp` SELECT DISTINCT [...]
Apparently the server went down for a second, or MySQL went down... or something happened and a reindex process was interrupted (in my case the one for the "Product EAV" index), and there was no way to make it work again.
Even the usual bin/magento indexer:reset and then a manual reindex with bin/magento indexer:reindex didn't do the trick and the only difference was that instead of the previous error I was getting the classic one:
Product EAV index is locked by another reindex process. Skipping.
Lucky me, I find this tweet by @willemwigman on Twitter that basically indicates that, when you have no way to "unlock" an index and after you already tried the reset and manual reindex, spot the lock node within your app/etc/env.php file and change the prefix within the inner config node.
The related posts are quite easy to add to Ghost if you have some basic knowledge on how to edit your current theme (there's no option to turning this ON and OFF on the Admin, unfortunately, so you must do it on the theme itself).
3 min read
The related posts are quite easy to add to Ghost if you have some basic knowledge on how to edit your current theme (there's no option to turning this ON and OFF on the Admin, unfortunately, so you must do it on the theme itself).
If you open your theme's files you would see a post.hbs template which is the one for the articles (for "this page you are seeing right now", basically), and the block expression {{#post}}...{{/post}} would be the one containing everything related to the post itself.
Outside that expression, after it, we want to add the related posts taking advantage of the {{#get}} helper.
{{#get}} is a special block helper that makes a custom query to the Ghost API to fetch publicly available data.
Clearly, you can use this helper to get the related posts anywhere you want, like on the sidebar of the blog if yours have one, or in a page instead of a post (but I personally like them at the end of an article).
Let's say you would like to get a list of related posts based on the tags of the current one, which can be done by filtering the data on the filter attribute.
{{#get "posts" filter="tags:[{{post.tags}}]+id:-{{post.id}}" as |related|}}
[...]
{{/get}}
In this case the filter attribute also contains id:-{{post.id}} to ignore, from the list of posts we are getting, the current article (we wouldn't want to suggest as related post the same post the user just read).
You can add as many filters as you want using the + sign as separator.
Inside this helper, the related "object" will be the one containing all the related post, so you just need to "loop it".
Once inside the foreach you are in the context of the post, and then you can just get whatever you want from that post such as the {{url}}, {{title}, etcetera.
You can limit how many post to show by using the limit attribute on the {{#get}} helper (15 by default, which seems like too much)
{{#get "posts" limit="2" filter="tags:[{{post.tags}}]+id:-{{post.id}}" as |related|}}
...
{{/get}}
The related posts can be anything you like and you would like to consider as related posts, as you are not limited to that filter for the tags I used as an example.
I'm currently using tags:[{{post.primary_tag.slug}}] within the filters to only consider those posts that have the primary tag of the current post as a tag in any position, as I think those posts would be more relevant to the current one.
{{#get "posts" filter="tags:[{{post.primary_tag.slug}}]+id:-{{post.id}}" as |related|}}
...
{{/get}}
This is not the same as using primary_tag:{{post.primary_tag.slug}} which is another filter option, in this case to get only those posts that their primary tag is the same as the current post (there's a slightly difference).
Optionally, you can use the featured:true filter option to get those posts that are checked as featured within the Admin.
{{#get "posts" filter="tags:[{{post.tags}}]+featured:true+id:-{{post.id}}" as |related|}}
...
{{/get}}
If you have multiple writers in your blog and you want to show related posts where the current author also participates you can use the authors:{{post.primary_author.slug}} option within the filters.
{{#get "posts" filter="authors:{{post.primary_author.slug}}+id:-{{post.id}}" as |related|}}
...
{{/get}}
This is different than using primary_author:{{post.primary_author.slug}} where we are filtering by those posts where the primary author is the same.