Deploying a Laravel app onto AWS Lightsail

The below are end-to-end instructions on how you can provision a Lightsail server and deploy a Laravel app onto it! :sailboat:

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:

  1. 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)

  2. Once the instance is running, select option to ‘connect’ which opens a console session

  3. Switch to root by running su root

  4. In a separate window, log into your Cleaver account and go to the ‘Add new server’ section

  5. Select the custom server option and then copy the script to run on the customer server as root user

  6. Run the script in your Lightsail console

  7. Copy the public IP for your Lightsail server

  8. Paste the public IP into the Cleaver custom server setup

  9. 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

  10. 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)

  11. 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

  12. Once provision is complete, add the Laravel site to your server

  13. Next, add a database and database user in the database tab if your Laravel app connects to a db

  14. Now, let’s setup the webapp by going to the webapp tab and select add new web app

  15. 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)

  16. Once the details for the new web app are filled in, save it

  17. In the new web app, go to the environment tab and then add in the environment details for your Laravel app

  18. 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

  19. Go to deployments tab and deploy!

Once deployment is complete, check out the URL for your app and make sure everything looks as expected. :rocket:

1 Like

It would great if Cleaver supported Lightsail out of the box.