I've been assigned to an online booking system development team for three months. I finished all coding, testing, and deployment. I want to wrap up this development!
Project Overview
- Developed with Laravel
- The subject of this system is to reserve easily online
- This development has two software engineers (one is me)
- I was charged in development for building infrastructure, coupon features, and remotely unlocking door features.
- Initially, this system deployed to Amazon Lightsail but migrated to EC2 in middle
I was assigned this project to help in the middle. I was mainly charged with development for remotely unlocking door features.
People can unlock store doors using this system. In other words, this system can affect physically with some people. It is a big difference point for any system I developed.
If remote unlocking features don't work, people may have to wait in front of the door for a long time. So, we need enough testing to avoid those bad things.
However, that testing was not easy. Especially in production development, I couldn't test at any time because testing production unlocks real doors. I had to finish testing at the predetermined time, but I couldn't finish testing quickly. It was very tough.
Remote unlocking doors system
I developed the remote unlocking doors system with Akerun.
Akerun provides functional APIs that use OAuth authorization. People use unlocking doors request with the access token.
The Access token is expired for 90 days, so we must issue a new access token to use the refresh token regularly.
First, I couldn't understand OAuth authorization and how to use the access and refresh token. I read many article about OAuth authorization, and tried!
Finally, I developed a re-issue access token function using cron. I stored all issued access tokens and refresh tokens in DB and issued both to use the refresh token every month.
I worried that is the correct way even now. If I would be aware of more excellent practices to rotate tokens, I want to fix quickly and post an article about that in this blog.
Also, I developed remote unlocking functions, but it was easy than I expected. When I think about it, it's just API. I only had to do was send a request with curl.
Migration from LightSail to EC2
Although I don't know why we must have done that, I had to migrate to EC2 from Lightsail after release.
Unfortunately, this system is working for 24 hours. I had to get as short a downtime as possible. I wrote the migration manual documents and migrated following that at midnight.
That reminded me of my employee times when I often monitored midnight batch progress. I checked the manual and input some commands too.
It was very tough, but that experience helped me in this project! I appreciated my past self.
The migration manual outline is that.
- Create a new production environment in AWS and test it.
- Both before and after production environments set maintenance mode.
- Migrate DB and storage data.
- Change domain A record.
- Wait for the reflection of the DNS change.
- Test in after migration environment.
- After the production environment, set out maintenance mode.
I could finish the migration smoothly. Thanks for AWS and Laravel.
Mainly, I was impressed by the Laravel maintenance mode. I found out about that feature when I wrote the migration manual documents.
I could set maintenance mode only to input one command even though I didn't ready for anything. It was beautiful.
Recognize texts in driver's license
I use Google Cloud Vision to recognize texts on driver's licenses. It was terrific that easy development and high-quality recognition.
It should be tough to recognize texts from images. But I could develop that just request that API.
I wrote this code.
// get images
$file = file_get_contents($img_path);
$client = new ImageAnnotatorClient([
'credentials' => storage_path(config('gcp.cloud_vision.json_path'))
]);
// send API
$image_file = $client->createImageObject($file);
$response = $client->textDetection($image_file);
if (!is_null($response->getError())) {
response()->json($response->getError());
}
$annotations = $response->getTextAnnotations();
description = isset($annotations[0]) ? str_replace('"""', '', $annotations[0]->getDescription()) : "";
return $description;
How simple it is! It took about only one hour to develop that.
If you are not an engineer, it would be an unbelievable thing to be able to recognize texts from images. But, it is a straightforward thing for software engineers in this crazy era.
It was a short time, but it was an excellent experience
Just as I said, I joined this development team in the middle. So, I have developed for just three months in this team.
However, it was an excellent experience. I developed some new features I hadn't developed.
I want to grow my skill with experience much development like this.
Thank you for reading!