Laravel
Learn how to deploy a Laravel application to Valyent
Introduction
Laravel is a powerful PHP web framework known for its elegant syntax and developer-friendly features. In this article, we’ll guide you through deploying a Laravel application to Valyent.
Prerequisites
- A UNIX-like system (see WSL if you are using Windows) for using the Valyent CLI.
- A Valyent account, with a registered payment method (sign up here).
- PHP, Composer, NodeJS, and NPM installed on your machine.
Installing the Valyent CLI
Inspect the installation script here and the GitHub repository.
Authenticating
Initializing the Laravel project
If you don’t have a Laravel project yet, create one using Composer:
Now, change your directory to the newly created Laravel application:
Initializing the project for Valyent
Note that Laravel applications may require at least 512MB of RAM to run.
Initialize the valyent.toml
configuration file to link your local codebase to a Valyent application:
This command will prompt you to select or create a project and an associated application.
Adding the Dockerfile
Create a Dockerfile to enable Valyent to build a Docker image for your Laravel application:
Fill it with the following content:
Adding the .dockerignore file
Create a .dockerignore
file to exclude unnecessary files from the Docker image:
Fill it with the following content:
Deploy the project
We are now ready to deploy the Laravel application to Valyent.
There is a few environment variables that need to be set before we can deploy the application.
Expose the application’s port by setting up the PORT
environment variable:
Now, deploy the Laravel application:
Once the deployment is complete, run:
to view your Laravel application in your browser.
Please note that this guide assumes a standard Laravel setup. Adjustments may be needed based on your specific Laravel project structure or additional requirements.