The below are end-to-end instructions on how you can provision a Lightsail server and deploy a Laravel app onto it!
The first thing to note is that Cleaver has integrations with many VPS providers, including AWS. However, Cleaver currently only supports the ECS suite of servers and does not yet support Lightsail. However, don’t let that stop you! You can easily procure a Lightsail instance and then add that as a custom server in Cleaver.
The second thing to note is that Cleaver “requires” an Ubuntu 20.04 image installed on a custom server and the 20.04 image is not available on Lightsail as of this writing. So, we will select Ubuntu 18.04 instead - which does work in this instance.
Steps:
-
Set up your Lightsail instance at lightsail.aws.amazon.com; be sure to select the ‘OS only’ option and then select Ubuntu 18.04 (unless 20.04 is available, if so, then choose that option)
-
Once the instance is running, select option to ‘connect’ which opens a console session
-
Switch to root by running
su root
-
In a separate window, log into your Cleaver account and go to the ‘Add new server’ section
-
Select the custom server option and then copy the script to run on the customer server as root user
-
Run the script in your Lightsail console
-
Copy the public IP for your Lightsail server
-
Paste the public IP into the Cleaver custom server setup
-
Select NodeJS and PHP 7.4, or whichever version you want to use for your Laravel app - you can also select a database to install as well
-
Select ‘Provision’ server - you will receive an email once the provision is complete (be sure to keep the contents of the email in a safe place as the information is not available anywhere else)
-
While the server is provisioning, this is a good time to point the domain you are using to the Lightsail server -> go ahead and do that now, especially, if you plan on enabling SSL certs
-
Once provision is complete, add the Laravel site to your server
-
Next, add a database and database user in the database tab if your Laravel app connects to a db
-
Now, let’s setup the webapp by going to the webapp tab and select add new web app
-
In the new web app screen, add in the details and make sure you select the server and site you just setup (if you haven’t added your VC profile, you will need to have done that prior to creating a web app)
-
Once the details for the new web app are filled in, save it
-
In the new web app, go to the environment tab and then add in the environment details for your Laravel app
-
Next, go to deployment hooks tab and make sure you have the hooks you need to deploy. For a basic Laravel app, you may leave as is or enable the ‘Install Composer Dev Dependencies’ hook
-
Go to deployments tab and deploy!
Once deployment is complete, check out the URL for your app and make sure everything looks as expected.