Forge + Bash Aliases

Recently I received a Forge feature request to allow custom Bash alias installation on fresh servers. However, it’s already possible to accomplish this using recipes and a relatively new feature that allows you to run a given recipe immediately after provisioning a server. Here’s a quick walkthrough.

Creating The Recipe

First, click the recipe link at the top of the screen and create a new recipe titled “Install Bash Aliases”. The recipe should run as the “forge” user. My recipe looks like this:

As you can see, my recipe uses a “heredoc” to place text into a file located at /home/forge/.bash_aliases. This file will be run automatically when we SSH into our server.

Creating The Server

Now, let’s create a fresh server. After selecting your server provider and size, select the “Install Bash Aliases” recipe in the “Post-Provision Recipe” drop-down menu. This is the recipe that will be run after the server is provisioned.

Finally, just click “Create Server” and wait a few minutes for your server to provision! Be sure to let me know about any other useful Forge recipes you have discovered!

If you don’t have a Forge account, now is a great time to sign up. Forge allows you to painlessly create and manage PHP 7.1 servers which include MySQL, Redis, Memcached, and everything else you need to run robust, modern Laravel applications.

Show your support

Clapping shows how much you appreciated Taylor Otwell’s story.