Dependency injection (DI) is a programming pattern in which a dependency is passed using the parameters instead of instantiating it within the function or class. DI enables creating isolated individual components within application code and makes it easy to switch those dependencies in the future as the requirement changes. Passing parameters as a dependency also allows to easily unit test those components in isolation by injecting their mocked version.
For the rest of…
I have been building GraphQL APIs in a Serverless environment for over 3 years now. I can’t even imagine working with RESTful APIs anymore. Combine the power of GraphQL with the scalability of AWS Lambda, and you have got a server that can handle infinite amounts of traffic.
In this tutorial, we build and deploy a GraphQL server to AWS Lambda and access it via API Gateway endpoint. We use CloudFormation and AWS CLI to deploy all our AWS Resources and application code.
Monorepo is a single repository that holds all code and multiple projects in a single git repository. Monorepo setup is quite attractive to work with because of its flexibility and ability to manage various services and frontends in one single repository. It also eliminates the hassle of tracking changes in multiple repositories and updating dependencies as projects change.
On the other hand, monorepo also comes with its challenges, specifically with Continuous Integration. As individual sub-projects within the monorepo changes, we need to identify which sub-projects changed to build and deploy the changed ones. …
I have been working on Java for at least 7 years now. It is still my first language of preference. It is a very old and stable language with a large ecosystem around it. The stability of ecosystem and mature libraries allows us to write production ready application with confidence. However, it lacks many features that the modern programming languages like Ruby, C#, Python and others offer.
I have recently gotten my AWS Certified Solutions Architect — Associate certificate. In this post, I will share how I prepared for the exam and the resources that helped me get certified. You should be able to use this post as a high-level guide on where to start and how to prepare for the certification exam.
If you are unsure if you should get certified or not, AWS is currently the largest cloud service provider with over 100 cloud services under its belt. In fact, according to TechCrunch it is 10 times bigger than its next 14 competitors. AWS is…
This is part 3 of the series of setting up Laravel with docker post. In part 1, we set up Laravel application using Dockerfile. In part2, we improved on our initial to use docker-compose. Instead of building the container from scratch, we used the official docker containers and put them together to have a working application. If you haven’t read part 2, I strongly suggest you to do so.
If you work in a team and not everyone in the team are familiar with docker, it would be a steep learning curve for the team to use our containers. …
In part 1 of this post, we built a docker image to run Laravel application. In this post we will install the same Laravel application but use docker-compose to do so. Docker compose allows to easily work with multi container applications and prevents from having to type large docker commands as we did in part 1. We will also use redis for caching and mysql for data storage along with nginx and PHP.
We will use official PHP, nginx and redis images instead of building our own. …
I often write
bash scripts to automate common tasks in my projects. Often the script makes changes that require a reboot. And when the machine finishes rebooting the script needs to resume from where it left.
Following script creates a temporary file that we use as a flag in the script to check if the script is resuming from a reboot. We also temporarily update the
.zshrc to trigger the script automatically after reboot. When the script resumes, we remove the temporary file and the extra line we added in the `bashrc` or `zshrc`.
# filename: reload_bash_shell.sh
Laravel is one of the most popular PHP framework available right now. In this post we will set up laravel application using Docker. Docker enables independence between software application and the infrastructure by enabling containerization of the platform.
Docker is available on most of the operating systems. Download and install the appropriate version of docker for your operating system from Docker Store. Verify the installation by going into the terminal and by typing
docker -v. This should give you the version of docker installed in your computer.
Docker version 17.09.0-ce, build afdb6d4
Our project structure will look as follows. Application…
Tmux is a terminal multiplexer which allows us to create and manage multiple terminal windows. In this post we will configure tmux to have vim style copy and paste.
Tmux configuration file is located at
~/.tmux.conf. Lets add following configuration in it.
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel
bind-key p paste-buffer
To reload updated configuration we will run the following command
tmux source-file ~/.tmux.conf in terminal. This will apply the newly updated configuration.
After the configuration is applied, we can press
Ctrl+a v to enter visual mode in…
Lead Software Engineer at A Cloud Guru