Posts

Benefits of Vue.js Development

Image
Vue.js is a popular JavaScript framework for building user interfaces. It is lightweight, easy to learn, and has a strong focus on simplicity and flexibility. Here are some key benefits of using Vue.js for web development: Reactive data binding: Vue.js uses a reactive data model, which means that changes to the data automatically update the view, and vice versa. This makes it easy to build dynamic and responsive user interfaces. Components: Vue.js uses a component-based architecture, which allows developers to break up their applications into smaller, reusable chunks of code. This makes it easy to manage and maintain large-scale projects. Flexibility: Vue.js is highly adaptable and can be easily integrated into other projects or frameworks. It also has a small footprint and can be used for building both small and large-scale applications. Performance: Vue.js has a built-in system for tracking changes in the data and updating the view, which makes it fast and efficient. Additionally, it...

How to add your application as a sub-domain to Vapor

Image
Recently I was trying to deploy a Laravel Application using Vapor. I wanted to deploy it to a subdomain. There were many projects deployed on several subdomains of our main domain. Since I wanted to deploy using Vapor which is basically serverless, there were basically no IP Addresses or URLs to point the domain to. I went through the Vapor Documentation about the domain section, but it said nothing about how to point the subdomain. So I contacted the Laravel Vapor support about my problem. They responded that I needed to add the main Domain to Vapor and the subdomain will automatically be added and no problem will happen to my existing subdomains after doing this. After their response, I added the main domain from the Vapor UI. PS: Thanks for the great support from  Mohamed Said . Vapor imported the DNS zone’s existing records into Vapor. After that, I created a certificate for the domain from Vapor UI. Then I added the sud domain to the vapor.yml file in my production env...

Database Access Overhead in Vapor

Image
Recently I was trying to deploy a Laravel Application using Vapor. I had to create a database for my application using Vapor. As per the Vapor Docs, a network would automatically be created when deploying for the first time. But in our project for some reason, the network was not automatically creating. So I had to create a new network from Vapor UI. I had to select the region and a name for the network to create it. Then I created a fixed publicly accessible database with minimum configuration (db.t3.micro — 2VCPU 1Gib RAM). Then I set up the tables in the database and deployed the application. However, the application was running slower than I expected. I tried several optimizations in the application but the application was still slow. After spending some time I found the issue was with the database connection being slow. I then scaled the database from the Vapor UI to db.t3.medium — (2 VCPU, 4Gib RAM). But still, the database connection was slow. To ...

Steps to do a file upload in Laravel Vapor

Image
Since Laravel Vapor is serverless you cannot store files directly in the filesystem. All files should be stored in a cloud storage system, such as AWS S3. You can use the Vapor application to store the file in AWS S3 by adding the storage key as the S3 bucket name to the environment’s vapor.yml configuration. id: 3958 name: vapor-example environments: Production: storage: vapor-blog build: - 'composer install --no-dev' - 'php artisan event:cache' - 'npm ci && npm run prod && rm -rf node_modules' deploy: - 'php artisan migrate --force' On deploying if the bucket doesn’t exist in S3, Vapor will create a new bucket and configure it. File Uploads For file uploads, the Vapor documentation says to use the Vapor’s NPM package includes a Vapor.store helper. I tried to use the Vapor.store helper package but was having trouble to use this package. My console was giving an error like the Vapor command not found. I spend many hours f...

How to Deploy a web app with Laravel Vapor

Image
Laravel Vapor is a full-featured serverless management & deployment dashboard for PHP/Laravel. In this blog, I am discussing how to deploy a web app with Vapor. Vapor is an auto-scaling, serverless deployment platform for Laravel, powered by AWS Lambda. It is a cost-effective system, you only need to pay for the usage of your application. Vapor makes it easy to use AWS Lambda powered serverless application in such a way that you didn’t need to do any setup for AWS Lambda. Vapor requires PHP 7.3+ and Laravel 6.0+. First, you need to create an account at https://vapor.laravel.com/. There is no trial period, you need to subscribe to it using an active credit card. After creating an account you need to set up your Vapor locally in your laravel application. Setting up Vapor locally In order to deploy your Vapor applications, you need to install the Vapor CLI using the composer using the command composer require laravel/vapor-cli To execute a vapor command you need to...